![如何使包安装自动进行?](https://linux22.com/image/1089377/%E5%A6%82%E4%BD%95%E4%BD%BF%E5%8C%85%E5%AE%89%E8%A3%85%E8%87%AA%E5%8A%A8%E8%BF%9B%E8%A1%8C%EF%BC%9F.png)
我必须在 ssh 上运行安装脚本。除了 apt-fast 等软件包外,我几乎已经将其自动化。这些软件包在正常安装时会弹出提示,而在 ssh 上则需要用户输入。例如,其中一个软件包 sudo 需要输入如下内容:
Configuration file '/etc/sudoers'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
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 : start a shell to examine the situation
The default action is to keep your current version.
*** sudoers (Y/I/N/O/D/Z) [default=N] ?
我希望能够以某种方式通过某些命令传递“N”,而不必手动输入 N。
答案1
配置文件由管理ucf
,您可以通过编辑来设置系统范围的配置。/etc/ucf.conf
作为参考,这是我的一个 Ubuntu 16.04 安装中的未经编辑的示例:
#
# This file is a bourne shell snippet, and is sourced by the
# ucf script for configuration.
#
# Debugging information: The default value is 0 (no debugging
# information is printed). To change the default behavior, uncomment
# the following line and set the value to 1.
#
# DEBUG=0
# Verbosity: The default value is 0 (quiet). To change the default
# behavior, uncomment the following line and set the value to 1.
#
# VERBOSE=0
# The src directory. This is the directory where the historical
# md5sums for a file are looked for. Specifically, the historical
# md5sums are looked for in the subdirectory ${filename}.md5sum.d/
#
# conf_source_dir=/some/path/
# Force the installed file to be retained. The default is have this
# variable unset, which makes the script ask in case of doubt. To
# change the default behavior, uncomment the following line and set
# the value to YES
#
# conf_force_conffold=YES
# Force the installed file to be overridden. The default is have this
# variable unset, which makes the script ask in case of doubt. To
# change the default behavior, uncomment the following line and set
# the value to YES
#
# conf_force_conffnew=YES
# Please note that only one of conf_force_conffold and
# conf_force_conffnew should be set.
如果您希望保留所有配置文件的当前安装版本,您可以简单地编辑此文件并#
从包含以下内容的行中删除注释标记:# conf_force_conffold=YES
为了更精确的处理,值得一提的是,您可以使用 控制特定的配置文件ucf
。但这超出了本答案的范围。
来源:
http://manpages.ubuntu.com/manpages/xenial/man5/ucf.conf.5.html