Как сделать автоматическую установку пакета?
Я должен запустить скрипт установки на 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