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 !!!!
I think the apt-get command line you're looking for is
apt-get -o Dpkg::Options::="--force-confnew" install your-package
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.
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:
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confnew" install localepurge
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:
#!/bin/sh export DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confnew" install -y localepurge foo bar
Where the -y tells apt-get to stop asking questions (see the man page).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With