Set new trap

This commit is contained in:
Santiago Lo Coco 2022-01-29 17:13:08 -03:00
parent 7a95d7ab5b
commit 8f5709ba71
2 changed files with 5 additions and 2 deletions

View File

@ -520,7 +520,8 @@ checkForSystemdUnit() {
else else
systemctl is-active --quiet "${2}" && return systemctl is-active --quiet "${2}" && return
fi fi
trap 'systemctl stop ${2}; forceExit=true' INT trapBackup=$(trap)
trap 'systemctl stop ${2}; forceExit=true' INT QUIT TERM
forceExit=false forceExit=false
calcAndRun dialog --infobox "\"\nWaiting for the ${1} to finish. Please wait.\"" 5 WIDTH calcAndRun dialog --infobox "\"\nWaiting for the ${1} to finish. Please wait.\"" 5 WIDTH
if [ "${3}" = "oneshot" ]; then if [ "${3}" = "oneshot" ]; then
@ -536,7 +537,7 @@ checkForSystemdUnit() {
systemctl is-active --quiet "${2}" systemctl is-active --quiet "${2}"
done done
fi fi
trap - INT eval "$trapBackup"
} }
printStepIfDebug() { printStepIfDebug() {
@ -625,6 +626,7 @@ runScript() {
clear clear
fi fi
trap 'printAndExit "You pressed <Ctrl-c/d> or exit calsais script."' INT QUIT TERM
calcAndRun dialog --title "calsais" --msgbox "\"\n${welcomeMsg}\"" 7 WIDTH calcAndRun dialog --title "calsais" --msgbox "\"\n${welcomeMsg}\"" 7 WIDTH
while [ $i -lt "${#steps[@]}" ]; do while [ $i -lt "${#steps[@]}" ]; do

1
log.txt Normal file
View File

@ -0,0 +1 @@
forceExit=true