Swap condition blocks

This commit is contained in:
Santiago Lo Coco 2022-01-05 14:35:15 -03:00
parent 489adc762e
commit 5db88c59aa
1 changed files with 6 additions and 6 deletions

View File

@ -457,17 +457,17 @@ checkForSystemdUnit() {
forceExit=false
calcWidthAndRun "whiptail --infobox \"Waiting for the ${1} to finish. Please wait.\" 7 WIDTH"
if [ "${3}" = "oneshot" ]; then
systemctl is-active --quiet ${2}
while [ $? -ne 0 ] && [ $forceExit = false ]; do
sleep 1
systemctl is-active --quiet ${2}
done
else
while [ $forceExit = false ]; do
result=$(systemctl show -p ActiveState --value ${2})
[ "$result" = "activating" ] && break
sleep 1
done
else
systemctl is-active --quiet ${2}
while [ $? -ne 0 ] && [ $forceExit = false ]; do
sleep 1
systemctl is-active --quiet ${2}
done
fi
trap - INT
}