apt-get install时自动保留当前版本的configuration文件

我需要自动安装一个包,其configuration文件已经存在于服务器上。

我正在寻找像这样的东西:

apt-get install --yes --force-yes --keep-current-confs mysql-server

可能是一个愚蠢的问题,但我找不到这样的select。

在Raphael Hertzog的博客上find答案:

 apt-get install -o Dpkg::Options::="--force-confold" --force-yes -y mysql-server 

这是dpkg的configurationangular色,因此select要保留的conf文件。

在当前的Ubuntu系统上,你需要更多一点:

 export DEBIAN_FRONTEND=noninteractive ; apt-get dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes