Add systemd unit for tdm-trinity on Debian

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit dd7fe04417)
pull/92/head
Slávek Banko 8 years ago
parent a445d8e120
commit 1e29387fa0

@ -1,4 +1,5 @@
debian/local/tdm.options etc/trinity/tdm/
debian/tdm.service lib/systemd/system/
debian/tmp/etc/trinity/tdm/tdmrc
debian/tmp/etc/trinity/tdm/Xaccess
debian/tmp/etc/trinity/tdm/Xreset

@ -44,6 +44,24 @@ if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" ]; then
rm "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
fi
# set default-display-manager systemd service link according to our config
DEFAULT_SERVICE=/etc/systemd/system/display-manager.service
if [ "$1" = configure ] && [ -d /etc/systemd/system/ ]; then
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
SERVICE=/lib/systemd/system/$(basename $(cat "$DEFAULT_DISPLAY_MANAGER_FILE")).service
if [ -h "$DEFAULT_SERVICE" ] && [ $(readlink "$DEFAULT_SERVICE") = /dev/null ]; then
echo "Display manager service is masked" >&2
elif [ -e "$SERVICE" ]; then
ln -sf "$SERVICE" "$DEFAULT_SERVICE"
else
echo "WARNING: $SERVICE is the selected default display manager but does not exist" >&2
rm -f "$DEFAULT_SERVICE"
fi
else
rm -f "$DEFAULT_SERVICE"
fi
fi
# restarting the daemon may cause output to stdout
db_stop
@ -126,17 +144,23 @@ if [ -x "/etc/init.d/tdm-trinity" ]; then
if [ -x "`which insserv 2>/dev/null`" ]; then
insserv tdm-trinity >/dev/null
else
update-rc.d tdm-trinity defaults 13 01 >/dev/null
if [ -x "`which update-rc.d 2>/dev/null`" ]; then
update-rc.d tdm-trinity defaults 13 01 >/dev/null
fi
fi
fi
if [ -n "$NOSTART" ]; then
exit 0
else
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d tdm-trinity start || true
if [ -x "`which service 2>/dev/null`" ]; then
service tdm-trinity start || true
else
/etc/init.d/tdm-trinity start || true
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d tdm-trinity start || true
else
/etc/init.d/tdm-trinity start || true
fi
fi
fi

@ -0,0 +1,12 @@
[Unit]
Description=Trinity Display Manager
Documentation=man:tdm-trinity(1)
Conflicts=getty@tty7.service plymouth-quit.service
After=systemd-user-sessions.service getty@tty7.service plymouth-quit.service
[Service]
# temporary safety check until all DMs are converted to correct
# display-manager.service symlink handling
ExecStartPre=/bin/sh -c '[ "$(basename $(cat /etc/X11/default-display-manager 2>/dev/null))" = "tdm" ]'
ExecStart=/opt/trinity/bin/tdm
Restart=always
Loading…
Cancel
Save