File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1198,7 +1198,9 @@ main() {
11981198 # Run test in interactive terminal (first boot only)
11991199 if [ -f " ${DAPPNODE_DIR} /.firstboot" ]; then
12001200 apt-get update
1201- apt-get install -y kbd
1201+ # A package upgrade may leave console-setup pending configuration.
1202+ # Never let debconf open a hidden prompt while rc.local owns tty1.
1203+ DEBIAN_FRONTEND=noninteractive apt-get install -y kbd
12021204 openvt -s -w -- sudo -u root " ${DAPPNODE_DIR} /scripts/dappnode_test_install.sh"
12031205 exit 0
12041206 fi
Original file line number Diff line number Diff line change 22
33# Execute script with flag UPDATE to update the host: ./dappnode_install_pre.sh UPDATE
44
5+ # This script also runs from unattended ISO late-commands, where debconf has no
6+ # terminal on which it can safely ask package-configuration questions.
7+ export DEBIAN_FRONTEND=noninteractive
8+
59DAPPNODE_DIR=" /usr/src/dappnode"
610LOGS_DIR=" $DAPPNODE_DIR /logs"
711lsb_dist=" $( . /etc/os-release && echo " $ID " ) "
@@ -105,8 +109,10 @@ install_iptables() {
105109
106110# HOST UPDATE
107111host_update () {
108- apt-get update 2>&1 | tee -a $LOG_FILE
109- apt-get -y upgrade 2>&1 | tee -a $LOG_FILE
112+ # Process substitution keeps apt-get's exit status while still logging its
113+ # output. A regular pipeline would return tee's status and hide dpkg errors.
114+ apt-get update > >( tee -a " $LOG_FILE " ) 2>&1 || return $?
115+ apt-get -y upgrade > >( tee -a " $LOG_FILE " ) 2>&1
110116}
111117
112118check_ubuntu_connectivity () {
@@ -152,7 +158,10 @@ touch $LOG_FILE
152158# Only update && upgrade host if needed
153159if [ " $1 " == " UPDATE" ]; then
154160 echo -e " \e[32m \n\n Updating && upgrading host \n\n \e[0m" 2>&1 | tee -a $LOG_FILE
155- host_update 2>&1 | tee -a $LOG_FILE
161+ if ! host_update; then
162+ echo -e " \e[31m \n\n ERROR: host update failed \n\n \e[0m" 2>&1 | tee -a " $LOG_FILE "
163+ exit 1
164+ fi
156165fi
157166
158167if find /etc/apt/ -name " *.list" -print0 | xargs --null cat | grep -q " https://download.docker.com/linux/$lsb_dist " ; then
You can’t perform that action at this time.
0 commit comments