You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
190 lines
5.8 KiB
190 lines
5.8 KiB
13 years ago
|
#!/bin/sh
|
||
|
### BEGIN INIT INFO
|
||
13 years ago
|
# Provides: x-display-manager tdm-trinity
|
||
13 years ago
|
# Required-Start: $local_fs $remote_fs
|
||
|
# Required-Stop: $local_fs $remote_fs
|
||
|
# Should-Start: console-screen
|
||
|
# Should-Stop: console-screen
|
||
|
# Default-Start: 2 3 4 5
|
||
|
# Default-Stop: 0 1 6
|
||
13 years ago
|
# Short-Description: X display manager for Trinity
|
||
13 years ago
|
# Description: TDM manages a collection of X servers, which may be on the local host or remote machines.
|
||
13 years ago
|
### END INIT INFO
|
||
13 years ago
|
# /etc/init.d/tdm-trinity: start or stop the X display manager
|
||
13 years ago
|
# Script originally stolen from the xdm package
|
||
|
#
|
||
|
# description: K Display Manager
|
||
|
#
|
||
|
set -e
|
||
|
|
||
13 years ago
|
# To start tdm-trinity even if it is not the default display manager, change
|
||
13 years ago
|
# HEED_DEFAULT_DISPLAY_MANAGER to "false."
|
||
|
HEED_DEFAULT_DISPLAY_MANAGER=true
|
||
|
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
|
||
|
|
||
13 years ago
|
TDEDIRS=/opt/trinity/
|
||
13 years ago
|
PATH=/opt/trinity/bin:/bin:/usr/bin:/sbin:/usr/sbin
|
||
13 years ago
|
DAEMON=/opt/trinity/bin/tdm
|
||
|
PIDFILE=/var/run/tdm.pid
|
||
|
UPGRADEFILE=/var/run/tdm.upgrade
|
||
13 years ago
|
|
||
13 years ago
|
# parameters to support tdm customization
|
||
|
TDMRC=/etc/trinity/tdm/tdmrc
|
||
|
BACKGROUNDRC=/etc/trinity/tdm/backgroundrc
|
||
13 years ago
|
|
||
13 years ago
|
#if configuration is changed by tdmtheme or other tools, don't do magick
|
||
|
if grep -q "Theme=@@@ToBeReplacedByDesktopBase@@@" ${TDMRC} && grep -q "Wallpaper=default_blue.jpg" ${BACKGROUNDRC}
|
||
13 years ago
|
then
|
||
|
|
||
|
|
||
|
|
||
13 years ago
|
TDMOVERRIDEDIR=/etc/default/tdm-trinity.d
|
||
|
TDMCFGDIR=/var/run/tdm-trinity
|
||
|
TDMCFG=$TDMCFGDIR/tdmrc
|
||
|
BACKGROUNDCFG=$TDMCFGDIR/backgroundrc
|
||
13 years ago
|
|
||
|
test -x $DAEMON || exit 0
|
||
|
|
||
|
# uncomment, if you want auto-logon to be runlevel-dependant
|
||
|
#test "$runlevel" || { runlevel=`runlevel`; runlevel=${runlevel#* }; }
|
||
|
#test "$runlevel" = 4 && ARG=-autolog || ARG=-noautolog
|
||
|
|
||
|
# uncomment, if you want tons of debug info in your syslog
|
||
|
#ARG="$ARG -debug 255"
|
||
|
|
||
13 years ago
|
# we use an alternative tdm master configuration file
|
||
|
ARG="$ARG -config $TDMCFG"
|
||
13 years ago
|
|
||
|
# we source overrides. run-parts sorts the list in a predictable order
|
||
13 years ago
|
if [ -d "$TDMOVERRIDEDIR" ]; then
|
||
|
for part in $(run-parts --list "$TDMOVERRIDEDIR" 2>/dev/null || true); do
|
||
13 years ago
|
. "$part"
|
||
|
done
|
||
|
fi
|
||
|
|
||
13 years ago
|
# we generate tdm configuration files
|
||
|
gentdmconf --in $TDMCFGDIR 1> /dev/null
|
||
13 years ago
|
|
||
13 years ago
|
# we update tdm configuration files (only overridden values)
|
||
|
[ -n "$USEBACKGROUND" ] && sed -i "s|^#\?UseBackground=.*|UseBackground=$USEBACKGROUND|" $TDMCFG
|
||
|
[ -n "$BACKGROUNDCFG" ] && sed -i "s|^#\?BackgroundCfg=.*|BackgroundCfg=$BACKGROUNDCFG|" $TDMCFG
|
||
|
[ -n "$USETHEME" ] && sed -i "s|^#\?UseTheme=.*|UseTheme=$USETHEME|" $TDMCFG
|
||
|
[ -n "$THEME" ] && sed -i "s|^#\?Theme=.*|Theme=$THEME|" $TDMCFG
|
||
13 years ago
|
[ -n "$WALLPAPER" ] && sed -i "s|^#\?Wallpaper=.*|Wallpaper=`readlink -f $WALLPAPER`|" $BACKGROUNDCFG
|
||
|
|
||
|
|
||
|
fi
|
||
|
# autologin overrides are useful for live debian environment
|
||
|
if [ -n "$AUTOLOGINUSER" ]; then
|
||
13 years ago
|
sed -i "s|^#\?AutoLoginEnable=.*|AutoLoginEnable=true|" $TDMCFG
|
||
|
sed -i "s|^#\?AutoLoginUser=.*|AutoLoginUser=$AUTOLOGINUSER|" $TDMCFG
|
||
13 years ago
|
fi
|
||
13 years ago
|
[ -n "$AUTOLOGINDELAY" ] && sed -i "s|^#\?AutoLoginDelay=.*|AutoLoginDelay=$AUTOLOGINDELAY|" $TDMCFG
|
||
|
[ -n "$AUTOLOGINAGAIN" ] && sed -i "s|^#\?AutoLoginAgain=.*|AutoLoginAgain=$AUTOLOGINAGAIN|" $TDMCFG
|
||
|
[ -n "$AUTOLOGINLOCKED" ] && sed -i "s|^#\?AutoLoginLocked=.*|AutoLoginLocked=$AUTOLOGINLOCKED|" $TDMCFG
|
||
13 years ago
|
|
||
|
# If we upgraded the daemon, we can't use the --exec argument to
|
||
|
# start-stop-daemon since the inode will have changed. The risk here is that
|
||
|
# in a situation where the daemon died, its pidfile was not cleaned up, and
|
||
|
# some other process is now running under that pid, start-stop-daemon will send
|
||
|
# signals to an innocent process. However, this seems like a corner case.
|
||
|
# C'est la vie!
|
||
|
if [ -e $UPGRADEFILE ]; then
|
||
|
SSD_ARGS="--pidfile $PIDFILE --startas $DAEMON"
|
||
|
else
|
||
|
SSD_ARGS="--pidfile $PIDFILE --exec $DAEMON"
|
||
|
fi
|
||
|
|
||
|
stillrunning () {
|
||
|
if expr "$(cat /proc/$DAEMONPID/cmdline 2> /dev/null)" : "$DAEMON" > /dev/null 2>&1; then
|
||
|
true
|
||
|
else
|
||
|
# if the daemon does not remove its own pidfile, we will
|
||
|
rm -f $PIDFILE $UPGRADEFILE
|
||
|
false
|
||
|
fi;
|
||
|
}
|
||
|
|
||
|
case "$1" in
|
||
|
start)
|
||
|
if [ -e $DEFAULT_DISPLAY_MANAGER_FILE ] &&
|
||
|
[ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] &&
|
||
|
[ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "$DAEMON" ]; then
|
||
13 years ago
|
echo "Not starting K Display Manager (tdm-trinity); it is not the default display manager."
|
||
13 years ago
|
else
|
||
13 years ago
|
echo -n "Starting K Display Manager: tdm-trinity"
|
||
13 years ago
|
start-stop-daemon --start --quiet $SSD_ARGS -- $ARG || echo -n " already running"
|
||
|
echo "."
|
||
|
fi
|
||
|
;;
|
||
|
|
||
|
restart)
|
||
13 years ago
|
/etc/init.d/tdm-trinity stop
|
||
13 years ago
|
if [ -f $PIDFILE ]; then
|
||
|
if stillrunning; then
|
||
|
exit 1
|
||
|
fi
|
||
|
fi
|
||
13 years ago
|
/etc/init.d/tdm-trinity start
|
||
13 years ago
|
;;
|
||
|
|
||
|
reload)
|
||
|
echo -n "Reloading K Display Manager configuration..."
|
||
|
if start-stop-daemon --stop --signal 1 --quiet $SSD_ARGS; then
|
||
|
echo "done."
|
||
|
else
|
||
13 years ago
|
echo "tdm-trinity not running."
|
||
13 years ago
|
fi
|
||
|
;;
|
||
|
|
||
|
force-reload)
|
||
13 years ago
|
/etc/init.d/tdm-trinity reload
|
||
13 years ago
|
;;
|
||
|
|
||
|
stop)
|
||
13 years ago
|
echo -n "Stopping K Display Manager: tdm-trinity"
|
||
13 years ago
|
if [ ! -f $PIDFILE ]; then
|
||
|
echo " not running ($PIDFILE not found)."
|
||
|
exit 0
|
||
|
else
|
||
|
DAEMONPID=$(cat $PIDFILE | tr -d '[:blank:]')
|
||
|
KILLCOUNT=1
|
||
|
if [ ! -e $UPGRADEFILE ]; then
|
||
|
if start-stop-daemon --stop --quiet $SSD_ARGS; then
|
||
13 years ago
|
# give tdm's signal handler a second to catch its breath
|
||
13 years ago
|
sleep 1
|
||
|
else
|
||
|
echo -n " not running"
|
||
|
fi
|
||
|
fi
|
||
|
while [ $KILLCOUNT -le 5 ]; do
|
||
|
if stillrunning; then
|
||
|
kill $DAEMONPID
|
||
|
else
|
||
|
break
|
||
|
fi
|
||
|
sleep 1
|
||
|
KILLCOUNT=$(( $KILLCOUNT + 1 ))
|
||
|
done
|
||
|
if stillrunning; then
|
||
|
echo -n " not responding to TERM signal (pid $DAEMONPID)"
|
||
|
else
|
||
|
rm -f $UPGRADEFILE
|
||
|
fi
|
||
|
fi
|
||
|
echo "."
|
||
|
|
||
|
# Launches usplash on shutdown
|
||
|
if ( `grep -q '\( \|^\)splash\( \|$\)' /proc/cmdline` && `which usplash_down >/dev/null` ) ; then
|
||
|
usplash_down
|
||
|
fi
|
||
|
;;
|
||
|
|
||
|
*)
|
||
13 years ago
|
echo "Usage: /etc/init.d/tdm-trinity {start|stop|restart|reload|force-reload}"
|
||
13 years ago
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
exit 0
|