我正在编写一个脚本,用于无人值守安装我们存储库中的软件包,它是一个带有 Debian 标记配置之一的软件包。
是否有任何选项可以传递给 apt-get/aptitude 以便它接受新的配置文件。
基本上我需要一个相当于 dpkg --force-confnew 的 apt/aptitude
我需要回答使用 Y
配置文件 `/opt/application/conf/XXX.conf'
==> 安装 apt-get 时提出的以下问题系统上由您或脚本创建的文件。
==>文件也在包维护者提供的包中。
您想对此做什么?您的选项是:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : background this process to examine the
默认操作是保留当前版本。
附加信息:
另外,我在管道中传递 sudo 密码以执行命令
echo "mysudopass"|sudo -S apt-get mypackage
当安装处于配置交互阶段时,这会标记安装错误。
我使用的是 Ubuntu 10.04
apt 版本:apt 0.7.25.3
为什么我不能使用 dpkg :这些 debians 是从 Repo 安装的,而我的机器上没有本地 debians
感谢大家提前提供帮助!
I am writing a script for a unattended install of a package that is in our Repo, It is a Software Package with one of the Debians marked config.
Is there any option that I can pass to apt-get/aptitude so that it accepts the new Config Files.
Basically I need a apt/aptitude equivalent of dpkg --force-confnew
I need to answer the following question posed while apt-get installation with a Y
Configuration file `/opt/application/conf/XXX.conf'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : background this process to examine the
The default action is to keep your current version.
Additional Info:
Also,I am passing the sudo password in a pipe to execute the command
echo "mysudopass"|sudo -S apt-get mypackage
This is flagging an Error in installation when the installation is at the Config Interactive phase.
I am on Ubuntu 10.04
apt version: apt 0.7.25.3
Why i cannotuse dpkg : These debians are to be installed from Repo and I dont have local debians on my machine
Thanks Guys for your Help in advance !!!!
发布评论
评论(3)
我认为您正在寻找的 apt-get 命令行是
至于您的 sudo -S 问题,也许尝试在“|”周围添加一些空格特点。
不是,问题 如何将密码传递给 su/sudo/ssh 而不覆盖 TTY ? 可能有用。
I think the apt-get command line you're looking for is
As for your sudo -S issue, maybe try adding some spaces around the '|' character.
Is not, the question How to pass the password to su/sudo/ssh without overriding the TTY? may be useful.
我尝试了其他答案中的建议,发现在尝试安装 localepurge 软件包时这还不够。
使用 debconf-set-selections 设置我需要的内容后,我必须使用以下内容:
只有将 DEBIAN_FRONTEND 环境变量设置为非交互式,我才能强制 localepurge 执行我所要求的操作。其他包可能也是如此。
当然,如果您愿意,可以使用脚本导出变量,但请注意它可能会与其他包混淆。例如:
-y 告诉 apt-get 停止询问问题(请参阅 手册页)。
I tried the suggestions in the other answers and discovered that it wasn't enough when trying to install the localepurge package.
After using debconf-set-selections to set what I needed, I had to use the following:
Only with the DEBIAN_FRONTEND environment variable set to noninteractive could I force localepurge to do what I had asked. This may be true of other packages.
Of course with a script you could export the variable if you wanted to, but be aware that it could mess with other packages. For example:
Where the -y tells apt-get to stop asking questions (see the man page).
您还可以通过创建
/etc/apt/apt.conf.d/local
并添加以下内容来配置apt
来执行此操作:You can also have
apt
configured to do that by creating/etc/apt/apt.conf.d/local
and adding: