sxmo_init: run cleanup when killed
If system service manager stops tinydm (e.g. if someone runs service tinydm restart) it should send sigterm to this script. If we're allowed a chance to, we should do our best to cleanup in this case. Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This commit is contained in:

committed by
Willow Barraco

parent
f24d0f7e1d
commit
6a3269d358
@@ -10,12 +10,19 @@ start() {
|
|||||||
[ -f "$XDG_STATE_HOME"/sxmo.log ] && mv "$XDG_STATE_HOME"/sxmo.log "$XDG_STATE_HOME"/sxmo.log.old
|
[ -f "$XDG_STATE_HOME"/sxmo.log ] && mv "$XDG_STATE_HOME"/sxmo.log "$XDG_STATE_HOME"/sxmo.log.old
|
||||||
|
|
||||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
||||||
dbus-run-session -- "$0" "with_dbus"
|
dbus-run-session -- "$0" "with_dbus" &
|
||||||
else
|
else
|
||||||
# with_dbus calls exec because dbus-run-session starts it in a
|
# with_dbus calls exec because dbus-run-session starts it in a
|
||||||
# new shell, but we need to keep this shell; start a subshell
|
# new shell, but we need to keep this shell; start a subshell
|
||||||
( with_dbus )
|
( with_dbus ) &
|
||||||
fi
|
fi
|
||||||
|
wait
|
||||||
|
}
|
||||||
|
|
||||||
|
finish() {
|
||||||
|
cleanup
|
||||||
|
sxmo_hook_stop.sh
|
||||||
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@@ -33,9 +40,9 @@ init() {
|
|||||||
. "$XDG_CONFIG_HOME/sxmo/profile"
|
. "$XDG_CONFIG_HOME/sxmo/profile"
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
|
trap 'finish' INT TERM EXIT
|
||||||
start
|
start
|
||||||
cleanup
|
|
||||||
sxmo_hook_stop.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
|
Reference in New Issue
Block a user