0

I have to run an installation script on ssh. I've pretty much made it automatic except for packages like apt-fast etc. These packages throw up prompts when you install them normally and on ssh they require user input. For example one of the packages sudo requires input like this:

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] ? 

I want that I can somehow pass 'N' through some command without having to manually type in N.

1 Answers1

0

The configuration files are managed by ucf and you can set system wide configuration via editing /etc/ucf.conf For reference, here's an unedited example from one of my Ubuntu 16.04 installations:

#
# 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.

If you wish to keep your currently installed versions of all configuration files you can simply edit this file and remove the comment marker # from the line that contains # conf_force_conffold=YES

For more precise handling, it's worth mentioning that you can control specific configuration files with ucf. That however is beyond the scope of this answer.

Source:

http://manpages.ubuntu.com/manpages/xenial/man5/ucf.conf.5.html

Elder Geek
  • 36,023
  • 25
  • 98
  • 183