[fix] Reboot on early failure too, better if statements

This commit is contained in:
William Wernert
2020-06-10 15:29:54 -04:00
parent 379a5445e8
commit 7de02752e5

View File

@@ -51,18 +51,17 @@ echo "---- Starting setup at $(date -u) ----" >> $setup_log 2>&1
automated=no automated=no
function progress() { function progress() {
if [ $automated == no ]; then
if grep -q "ERROR" $setup_log || [[ -s /var/spool/mail/root ]]; then if grep -q "ERROR" $setup_log || [[ -s /var/spool/mail/root ]]; then
whiptail_setup_failed if [[ $automated == no ]]; then whiptail_setup_failed; else exit 1; fi
fi
if [[ -z $SKIP_REBOOT ]]; then shutdown -r now; fi
else
if [ $automated == no ]; then
whiptail --title "Security Onion Install" --gauge 'Please wait while installing' 6 60 0 whiptail --title "Security Onion Install" --gauge 'Please wait while installing' 6 60 0
else else
if grep -q "ERROR" $setup_log || [[ -s /var/spool/mail/root ]]; then
exit 1
fi
cat >> $setup_log 2>&1 cat >> $setup_log 2>&1
fi fi
fi
} }
if [[ -f automation/$automation && $(basename $automation) == $automation ]]; then if [[ -f automation/$automation && $(basename $automation) == $automation ]]; then
@@ -599,10 +598,12 @@ fi
success=$(tail -10 $setup_log | grep Failed | awk '{ print $2}') success=$(tail -10 $setup_log | grep Failed | awk '{ print $2}')
if [[ "$success" = 0 ]]; then if [[ "$success" = 0 ]]; then
whiptail_setup_complete whiptail_setup_complete
if [[ -n $ALLOW_ROLE && -n $ALLOW_CIDR ]]; then if [[ -n $ALLOW_ROLE && -n $ALLOW_CIDR ]]; then
export IP=$ALLOW_CIDR export IP=$ALLOW_CIDR
so-allow -$ALLOW_ROLE >> $setup_log 2>&1 so-allow -$ALLOW_ROLE >> $setup_log 2>&1
fi fi
if [[ $THEHIVE == 1 ]]; then if [[ $THEHIVE == 1 ]]; then
check_hive_init check_hive_init
fi fi