@@ -71,7 +71,7 @@ STATUS_NOT_CONTINUE="User elected not to continue" # Exiting, but not an error
71
71
STATUS_NO_REBOOT=" User elected not to reboot"
72
72
STATUS_CLEAR=" Clear" # Clear the file
73
73
STATUS_ERROR=" Error encountered"
74
- # STATUS_INT="Got interupt "
74
+ STATUS_INT=" Got interrupt "
75
75
STATUS_VARIABLES=() # Holds all the variables and values to save
76
76
77
77
# Some versions of Linux default to 750 so web server can't read it
@@ -2364,7 +2364,7 @@ exit_installation()
2364
2364
clear_status
2365
2365
else
2366
2366
[[ -n ${MORE_STATUS} ]] && MORE_STATUS=" ; MORE_STATUS='${MORE_STATUS} '"
2367
- echo -e " STATUS_INSTALLATION='${STATUS } '${MORE_STATUS} " > " ${STATUS_FILE} "
2367
+ echo -e " STATUS_INSTALLATION='${STATUS_CODE } '${MORE_STATUS} " > " ${STATUS_FILE} "
2368
2368
echo -e " ${STATUS_VARIABLES[@]} " >> " ${STATUS_FILE} "
2369
2369
fi
2370
2370
fi
@@ -2375,6 +2375,12 @@ exit_installation()
2375
2375
}
2376
2376
2377
2377
2378
+ # ###
2379
+ handle_interrupts ()
2380
+ {
2381
+ display_msg --log info " \nGot interrupt - saving installation status, then exiting.\n"
2382
+ exit_installation 1 " ${STATUS_INT} " " Saving status."
2383
+ }
2378
2384
2379
2385
# ############################################# Main part of program
2380
2386
@@ -2451,6 +2457,7 @@ TESTING="${TESTING}" # xxx keeps shellcheck quiet
2451
2457
shift
2452
2458
done
2453
2459
2460
+
2454
2461
if [[ -n ${FUNCTION} ]]; then
2455
2462
# Don't log when a single function is executed.
2456
2463
DISPLAY_MSG_LOG=" "
2463
2470
[[ ${HELP} == " true" ]] && usage_and_exit 0
2464
2471
[[ ${OK} == " false" ]] && usage_and_exit 1
2465
2472
2473
+ trap " handle_interrupts" SIGTERM SIGINT
2474
+
2466
2475
# See if we should skip some steps.
2467
2476
# When most function are called they add a variable with the function's name set to "true".
2468
2477
if [[ -z ${FUNCTION} && -s ${STATUS_FILE} ]]; then
0 commit comments