diff --git a/CHANGELOG.md b/CHANGELOG.md index a0382614..69dfe746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Setup: * Install cron if it isn't already installed. * Fix a units problem in the minimum memory check. * If you override the STORAGE_ROOT, your setting will now persist if you re-run setup. +* Hangs due to apt wanting the user to resolve a conflict should now be fixed (apt will just clobber the problematic file now). v0.06 (January 4, 2015) ----------------------- diff --git a/setup/functions.sh b/setup/functions.sh index 23c2492b..94ea87cd 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -22,6 +22,20 @@ function hide_output { rm -f $OUTPUT } +function apt_get_quiet { + # Run apt-get in a totally non-interactive mode. + # + # Somehow all of these options are needed to get it to not ask the user + # questions about a) whether to proceed (-y), b) package options (noninteractive), + # and c) what to do about files changed locally (we don't cause that to happen but + # some VM providers muck with their images; -o). + # + # Although we could pass -qq to apt-get to make output quieter, many packages write to stdout + # and stderr things that aren't really important. Use our hide_output function to capture + # all of that and only show it if there is a problem (i.e. if apt_get returns a failure exit status). + DEBIAN_FRONTEND=noninteractive hide_output apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" "$@" +} + function apt_install { # Report any packages already installed. PACKAGES=$@ @@ -46,18 +60,10 @@ function apt_install { echo installing $TO_INSTALL... fi - # 'DEBIAN_FRONTEND=noninteractive' is to prevent dbconfig-common from asking you questions. - # - # Although we could pass -qq to apt-get to make output quieter, many packages write to stdout - # and stderr things that aren't really important. Use our hide_output function to capture - # all of that and only show it if there is a problem (i.e. if apt_get returns a failure exit status). - # - # Also note that we still include the whole original package list in the apt-get command in + # We still include the whole original package list in the apt-get command in # case it wants to upgrade anything, I guess? Maybe we can remove it. Doesn't normally make # a difference. - DEBIAN_FRONTEND=noninteractive \ - hide_output \ - apt-get -y install $PACKAGES + apt_get_quiet install $PACKAGES } function get_default_hostname { diff --git a/setup/network-checks.sh b/setup/network-checks.sh index 887bdd26..428fa4ca 100644 --- a/setup/network-checks.sh +++ b/setup/network-checks.sh @@ -1,6 +1,6 @@ # Install the 'host', 'sed', and and 'nc' tools. This script is run before # the rest of the system setup so we may not yet have things installed. -hide_output apt-get -y install bind9-host sed netcat-openbsd +apt_get_quiet install bind9-host sed netcat-openbsd # Stop if the PRIMARY_HOSTNAME is listed in the Spamhaus Domain Block List. # The user might have chosen a name that was previously in use by a spammer diff --git a/setup/questions.sh b/setup/questions.sh index 339b7ec2..08531fe8 100644 --- a/setup/questions.sh +++ b/setup/questions.sh @@ -4,7 +4,7 @@ if [ -z "$NONINTERACTIVE" ]; then # e.g. if we piped a bootstrapping install script to bash to get started. In that # case, the nifty '[ -t 0 ]' test won't work. But with Vagrant we must suppress so we # use a shell flag instead. Really supress any output from installing dialog. - hide_output apt-get -y install dialog + apt_get_quiet install dialog message_box "Mail-in-a-Box Installation" \ "Hello and thanks for deploying a Mail-in-a-Box! \n\nI'm going to ask you a few questions. diff --git a/setup/system.sh b/setup/system.sh index 549db583..a5519839 100755 --- a/setup/system.sh +++ b/setup/system.sh @@ -9,7 +9,7 @@ source setup/functions.sh # load our functions echo Updating system packages... hide_output apt-get update -hide_output apt-get -y upgrade +apt_get_quiet upgrade # Install basic utilities. #