Fix help text, add cleanup trap

This commit is contained in:
Salt 2019-06-21 07:57:54 -05:00
parent af0e75479f
commit e3cb7b6cb0

View File

@ -55,6 +55,22 @@ startfile() {
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
step_generate() {
log "Creating default config setup in \"$g_configdir\""
@ -227,7 +243,7 @@ EOF
}
step_printhelp() {
cat << EOF
Usage: $0 [OPTION...]
Usage: $(basename -- "$0") [OPTION...]
Start or generate a desktop environment configuration
-h Show this help text