Add CTRL+C handler

This commit is contained in:
timoxa0 2024-08-11 16:01:21 +05:00
parent 563466c887
commit 2bc641aa22

View file

@ -5,10 +5,19 @@ SIMPLEINIT_CMDLINE="root=PARTLABEL=linux loglevel=3 fbcon=rotate:1"
function log() {
printf "\e[1m\e[92m==>\e[0m \e[1m%s\e[0m\n" "$*"
}
function log_err() {
printf "\e[1m\e[31m==>\e[0m \e[1m%s\e[0m\n" "$*"
}
function sigterm_handler() {
printf "\e[1m\e[31m>\e[0m \e[1m%s\e[0m\n" "Shutdown signal received."
exit 1
}
trap 'trap " " SIGINT SIGTERM SIGHUP; kill 0; wait; sigterm_handler' SIGINT SIGTERM SIGHUP
function create_image() {
name="$(realpath "./raw/${1}.img")"
if [ -z "$2" ]; then