Fix help text, add cleanup trap
This commit is contained in:
parent
af0e75479f
commit
e3cb7b6cb0
18
firestarter
18
firestarter
@ -55,6 +55,22 @@ startfile() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Traps
|
||||||
|
trap_exit() {
|
||||||
|
if command -v loginctl > /dev/null 2>&1; then
|
||||||
|
# Use loginctl if possible
|
||||||
|
local sessionid="$(< /proc/self/sessionid)"
|
||||||
|
if [ -n "$sessionid" ]; then
|
||||||
|
loginctl terminate-session "$sessionid"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Otherwise just brute it
|
||||||
|
kill $(jobs -p)
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
trap trap_exit EXIT
|
||||||
|
|
||||||
# Steps in execution
|
# Steps in execution
|
||||||
step_generate() {
|
step_generate() {
|
||||||
log "Creating default config setup in \"$g_configdir\""
|
log "Creating default config setup in \"$g_configdir\""
|
||||||
@ -227,7 +243,7 @@ EOF
|
|||||||
}
|
}
|
||||||
step_printhelp() {
|
step_printhelp() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Usage: $0 [OPTION...]
|
Usage: $(basename -- "$0") [OPTION...]
|
||||||
Start or generate a desktop environment configuration
|
Start or generate a desktop environment configuration
|
||||||
|
|
||||||
-h Show this help text
|
-h Show this help text
|
||||||
|
Loading…
Reference in New Issue
Block a user