]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - debian/lightdm.upstart
Only delete socket if we're about to use it
[sojka/lightdm.git] / debian / lightdm.upstart
1 # LightDM - light Display Manager
2 #
3 # The display manager service manages the X servers running on the
4 # system, providing login and auto-login services
5 #
6 # based on gdm upstart script
7
8 description     "LightDM Display Manager"
9 author          "Robert Ancell <robert.ancell@canonical.com>"
10
11 start on ((filesystem
12            and runlevel [!06]
13            and started dbus
14            and plymouth-ready)
15           or runlevel PREVLEVEL=S)
16
17 stop on runlevel [016]
18
19 respawn
20
21 emits login-session-start
22 emits desktop-session-start
23 emits desktop-shutdown
24
25 script
26     if [ -n "$UPSTART_EVENTS" ]
27     then
28         # Check kernel command-line for inhibitors, unless we are being called
29         # manually
30         for ARG in $(cat /proc/cmdline); do
31             if [ "$ARG" = "text" ]; then
32                 plymouth quit || : 
33                 stop
34                 exit 0
35             fi
36         done
37
38         [ ! -f /etc/X11/default-display-manager -o "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/bin/lightdm" -o "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/lightdm" ] || { stop; exit 0; }
39
40         if [ "$RUNLEVEL" = S -o "$RUNLEVEL" = 1 ]
41         then
42             # Single-user mode
43             plymouth quit || :
44             exit 0
45         fi
46     fi
47
48     exec lightdm
49 end script
50
51 post-start script
52     sleep 5
53     clear > /dev/tty7
54 end script
55
56 post-stop script
57         clear > /dev/tty7
58         sleep 1
59         if [ "$UPSTART_STOP_EVENTS" = runlevel ]; then
60                 initctl emit desktop-shutdown
61         fi
62 end script