]> rtime.felk.cvut.cz Git - sojka/debian/lightdm.git/blob - debian/lightdm.init
upload
[sojka/debian/lightdm.git] / debian / lightdm.init
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides:          lightdm
4 # Should-Start:      console-screen kbd acpid dbus hal consolekit
5 # Required-Start:    $local_fs $remote_fs x11-common
6 # Required-Stop:     $local_fs $remote_fs
7 # Default-Start:     2 3 4 5
8 # Default-Stop:      0 1 6
9 # Short-Description: Light Display Manager
10 # Description:       Debian init script for the Light Display Manager
11 ### END INIT INFO
12 #
13 # Author:       Yves-Alexis Perez <corsac@debian.org> using gdm script from 
14 #               Ryan Murray <rmurray@debian.org>
15 #
16 set -e
17
18 PATH=/sbin:/bin:/usr/sbin:/usr/bin
19 DAEMON=/usr/sbin/lightdm
20
21 test -x $DAEMON || exit 0
22
23 if [ -r /etc/default/locale ]; then
24   . /etc/default/locale
25   export LANG LANGUAGE
26 fi
27
28 . /lib/lsb/init-functions
29
30 # To start lightdm even if it is not the default display manager, change
31 # HEED_DEFAULT_DISPLAY_MANAGER to "false."
32 HEED_DEFAULT_DISPLAY_MANAGER=true
33 DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
34
35 case "$1" in
36   start)
37         CONFIGURED_DAEMON=$(basename "$(cat $DEFAULT_DISPLAY_MANAGER_FILE 2> /dev/null)")
38         if grep -wqs text /proc/cmdline; then
39             log_warning_msg "Not starting Light Display Manager (lightdm); found 'text' in kernel commandline."
40         elif [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ] && \
41            [ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] && \
42            [ "$CONFIGURED_DAEMON" != lightdm ] ; then
43                 log_action_msg "Not starting Light Display Manager; it is not the default display manager"
44         else
45                 log_daemon_msg "Starting Light Display Manager" "lightdm"
46                 start-stop-daemon --start --quiet --pidfile /var/run/lightdm.pid --name lightdm --exec $DAEMON -b|| echo -n " already running"
47                 log_end_msg $?
48         fi
49   ;;
50   stop)
51         log_daemon_msg "Stopping Light Display Manager" "lightdm"
52         set +e
53         start-stop-daemon --stop --quiet --pidfile /var/run/lightdm.pid \
54                 --name lightdm --retry 5
55         set -e
56         log_end_msg $?
57   ;;
58   reload)
59         log_daemon_msg "Scheduling reload of Light Display Manager configuration" "lightdm"
60         set +e
61         start-stop-daemon --stop --signal USR1 --quiet --pidfile \
62                 /var/run/lightdm.pid --name lightdm
63         set -e
64         log_end_msg $?
65   ;;
66   status)
67         status_of_proc -p "$PIDFILE" "$DAEMON" lightdm && exit 0 || exit $?
68   ;;
69   restart|force-reload)
70         $0 stop
71         sleep 1
72         $0 start
73   ;;
74   *)
75         echo "Usage: /etc/init.d/lightdm {start|stop|restart|reload|force-reload|status}"
76         exit 1
77   ;;
78 esac
79
80 exit 0