How to make apt-get accept New config files in a unattended install of debian from Repo

RamNat picture RamNat · Oct 17, 2011 · Viewed 9k times · Source

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 !!!!

Answer

pwan picture pwan · Nov 7, 2011

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.