我已经为Linux 14的用户制作了这个post安装脚本(也可以在Ubuntu12.10上使用),现在我正在为Linux 15和'echo -ne“\n- sudo添加-apt存储库ppa测试它:一些-ppa‘命令不适用于Linux 15,但仍然可以在Mint 14上使用。我想为Linux的新版本更新这个脚本。
这里有一个链接,指向我的post install:Minty开发者
Mint 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:一些的测试,结果是一样的。
有人能帮我弄清楚如何使这一行代码/命令工作起来吗?这样脚本就可以被更新,让那些有兴趣使用它的人使用他们的系统的新版本?
谢谢。
发布于 2013-06-01 06:44:01
您可以使用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但这是放在stdout上的,因此应该能够在stderr上仍然出现错误的情况下将其发送到> /dev/null。
https://stackoverflow.com/questions/16869758
复制相似问题