2013-06-01 34 views
2

我已經爲Linux Mint 14的用戶(也可在Ubuntu 12.10上使用)製作了這個安裝後腳本,現在我正在爲Linux Mint 15和' echo -ne「\ n」| sudo add-apt-repository ppa:some-ppa-to-add'命令在Linux Mint 15上不起作用,但仍可用於Mint 14.我想爲新版Linux Mint更新此腳本。自動化輸入按鍵不適用於Linux Mint 15

這裏是我的帖子的鏈接安裝素文字:The Minty Developer

爲薄荷14的輸出是這樣的:

$ echo -ne "\n" | sudo add-apt-repository ppa:apt-fast/stable 
You are about to add the following PPA to your system: 
This PPA contains tested (stable) builds of apt-fast. 
More info: https://launchpad.net/~apt-fast/+archive/stable 
gpg: keyring `/tmp/tmpddxueh/secring.gpg' created 
gpg: requesting key CA8DA16B from hkp server keyserver.ubuntu.com 
gpg: /tmp/tmpddxueh/trustdb.gpg: trustdb created 
gpg: key CA8DA16B: public key "Launchpad PPA for apt-fast" imported 
gpg: Total number processed: 1 
gpg:    imported: 1 (RSA: 1) 
OK 

而且這裏的一對薄荷15的輸出:

$ echo -ne "\n" | sudo add-apt-repository ppa:apt-fast/stable 
You are about to add the following PPA to your system: 
This PPA contains tested (stable) builds of apt-fast. 
More info: https://launchpad.net/~apt-fast/+archive/stable 

而且而已。什麼都沒發生。 我也測試過只是回聲| ppa:一些ppa-to-add,這是相同的結果。

任何人都可以幫助我弄清楚如何使這行代碼/命令工作,以便腳本可以更新爲那些有興趣使用他們的系統的新版本的人?

謝謝。

回答

1

您可以使用add-apt-repository --yes,但您通過回答該問題重寫系統範圍的安全策略。

你不說誰是用戶;如果你的腳本爲我做了這些,我會很生氣,但我不是典型的最終用戶。我只是看着你的劇本,而且它一般都是會話式的。如果說像

我會從合理可靠來源添加這些軟件包,並設置,以便他們將自動更新,等等等等

會比較有禮貌。

新增

有一個在add-apt-repository無證功能,它允許您以編程方式覆蓋問題:

if (sys.stdin.isatty() and 
    not "FORCE_ADD_APT_REPOSITORY" in os.environ): 
    if options.remove: 
     print(_("Press [ENTER] to continue or ctrl-c to cancel removing it")) 
      else: 
     print(_("Press [ENTER] to continue or ctrl-c to cancel adding it")) 
     sys.stdin.readline() 

因此bash的序列

export FORCE_ADD_APT_REPOSITORY=force 
sudo add-apt-repository ppa:webupd8team/sublime-text-2 
sudo add-apt-repository ... 

應停止的問題。它仍然會顯示噪聲

You are about to add the following PPA to your system: 
Sublime Text 2 packages - the .deb will automatically download the 
latest build from http://www.sublimetext.com/dev or beta from 
http://www.sublimetext.com/2 (Adobe Flash Player installer - style). 

More info and feedback: 
http://www.webupd8.org/2011/03/sublime-text-2-ubuntu-ppa.html 
http://www.webupd8.org/2012/03/sublime-text-2-ppa-separate-development.html 
More info: https://launchpad.net/~webupd8team/+archive/sublime-text-2 

但放在標準輸出所以應該能夠被髮送到> /dev/null有錯誤還出現在標準錯誤。

+0

謝謝我會測試它,我一定會給腳本添加類似的東西:) –

+0

雖然--yes標誌沒有工作。 :( –

+0

我開始瀏覽apt- *腳本套件,'--yes'標記文檔僅適用於修復'lp:'存儲庫的一個問題。我還沒有找到它要求添加的地方鑰匙,但我的意志是堅強的... – msw