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.

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

  • 1
    AFAIK the Assume-No configure option doesn't apply to ucf dialogs (which is what the OP's question appears to show): according to this previous answer How do I apt-get -y dist-upgrade without a grub config prompt? ucf behavior can be modified UCF_FORCE_CONFFOLD and UCF_FORCE_CONFNEW environment variables – steeldriver Mar 24 '17 at 15:59
  • @steeldriver Thank you! I'll delve into this deeper when I return from the dentist. – Elder Geek Mar 24 '17 at 16:21
  • @steeldriver Thank you for pointing me in the right direction. Complete rewrite complete. – Elder Geek Mar 24 '17 at 20:03

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.