Improve automated installs and remove sleep during progress updates

This commit is contained in:
Jason Ertel
2020-05-26 16:11:31 -04:00
parent 4049df8cb4
commit 8e1bd32f4d
2 changed files with 26 additions and 6 deletions

View File

@@ -968,7 +968,7 @@ parse_options() {
fi fi
;; ;;
--proxy=*) --proxy=*)
echo "Unimplimented" echo "Unimplemented"
return return
if [[ $2 != --proxy-user=* ]] || [[ $3 != --proxy-pass=* ]]; then if [[ $2 != --proxy-user=* ]] || [[ $3 != --proxy-pass=* ]]; then
@@ -1268,8 +1268,6 @@ set_progress_str() {
'----'\ '----'\
"$percentage% - ${progress_bar_text^^}"\ "$percentage% - ${progress_bar_text^^}"\
"----" >> "$setup_log" 2>&1 "----" >> "$setup_log" 2>&1
sleep 5
} }
sensor_pillar() { sensor_pillar() {

View File

@@ -25,11 +25,33 @@ setup_type=$1
export setup_type export setup_type
automation=$2 automation=$2
automated=no
function progress() {
if [ $automated == no ]; then
whiptail --title "Security Onion Install" --gauge 'Please wait while installing' 6 60 0
fi
}
if [[ -f automation/$automation && $(basename $automation) == $automation ]]; then if [[ -f automation/$automation && $(basename $automation) == $automation ]]; then
echo "Preselecting variable values based on automated setup: $automation" echo "Preselecting variable values based on automated setup: $automation"
exit 1
source automation/$automation source automation/$automation
sleep 30 # Re-implement with network availability probe automated=yes
attempt=1
attempts=60
ip a | grep "$MNIC:" | grep "state UP"
while [ $? -ne 0 ]; do
if [ $attempt -gt $attempts ]; then
echo "Network unavailable - setup cannot continue"
exit 1
fi
echo "Waiting for network to come up (attempt $attempt of $attempts)"
attempt=$((attempt + 1))
sleep 10;
ip a | grep "$MNIC:" | grep "state UP"
done
fi fi
case "$setup_type" in case "$setup_type" in
@@ -498,7 +520,7 @@ fi
set_progress_str 95 'Verifying setup' set_progress_str 95 'Verifying setup'
salt-call -l info state.highstate >> $setup_log 2>&1 salt-call -l info state.highstate >> $setup_log 2>&1
} | whiptail --title "Hybrid Hunter Install" --gauge "Please wait while installing" 6 60 0 } | progress
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