From a08923030b956fcd366dd0f9731afbc6ae6a80e3 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Mon, 16 Nov 2020 16:26:38 -0500 Subject: [PATCH] [feat] Exit setup if less than required number of NICs present --- setup/so-whiptail | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/setup/so-whiptail b/setup/so-whiptail index 21e394b65..a1f07868c 100755 --- a/setup/so-whiptail +++ b/setup/so-whiptail @@ -340,11 +340,27 @@ whiptail_requirements_error() { [ -n "$TESTING" ] && return - whiptail --title "Security Onion Setup" \ - --yesno "This machine currently has $current_val $requirement_needed, but needs $needed_val to meet minimum requirements. Press YES to continue anyway, or press NO to cancel." 10 75 + if [[ $(echo "$requirement_needed" | tr '[:upper:]' '[:lower:]') == 'nics' ]]; then + whiptail --title "Security Onion Setup" \ + --msgbox "This machine currently has $current_val $requirement_needed, but needs $needed_val to meet minimum requirements. Press OK to exit setup and reconfigure the machine." 10 75 + + # Same as whiptail_cancel, but changed the wording to exit instead of cancel. + whiptail --title "Security Onion Setup" --msgbox "Exiting Setup. No changes have been made." 8 75 + if [ -d "/root/installtmp" ]; then + { + echo "/root/installtmp exists"; + install_cleanup; + echo "/root/installtmp removed"; + } >> $setup_log 2>&1 + fi + exit + else + whiptail --title "Security Onion Setup" \ + --yesno "This machine currently has $current_val $requirement_needed, but needs $needed_val to meet minimum requirements. Press YES to continue anyway, or press NO to cancel." 10 75 - local exitstatus=$? - whiptail_check_exitstatus $exitstatus + local exitstatus=$? + whiptail_check_exitstatus $exitstatus + fi } whiptail_storage_requirements() {