]> git.sur5r.net Git - i3/i3status/blob - debian/i3status.i3status-wmii.init
debian: fix issues with initscript
[i3/i3status] / debian / i3status.i3status-wmii.init
1 #!/bin/sh
2 #
3 ### BEGIN INIT INFO
4 # Provides:          i3status-wmii
5 # Required-Start:    $remote_fs $network
6 # Required-Stop:     $remote_fs $network
7 # Default-Start:     2 3 4 5
8 # Default-Stop:      0 1 6
9 # Short-Description: Generates a status line for wmii
10 # Description:       Combines several system information into a status line for
11 #                    wmii.
12 ### END INIT INFO
13
14 need_root() {
15         # For the pidfile, you must be root. i3status itself works as user
16         [ $(id -ru) -eq 0 ] || { echo "You need to be root"; exit 1; }
17 }
18
19 [ -f /etc/default/i3status-wmii ] && . /etc/default/i3status-wmii
20
21 if [ "$I3STATUS_WMII_ENABLE" != "yes" ]
22 then
23         echo "Not starting i3status-wmii (Not enabled in /etc/default/i3status-wmii)"
24         exit 0
25 fi
26
27 . /lib/lsb/init-functions
28
29 case "$1" in
30 start)  need_root
31         log_daemon_msg "Starting wmii status bar filler" "i3status-wmii"
32         start-stop-daemon --start --background --quiet --make-pidfile --pidfile /var/run/i3status-wmii.pid --name i3status-wmii --startas /usr/bin/i3status-wmii
33         log_end_msg $?
34         ;;
35 stop)   need_root
36         log_daemon_msg "Stopping wmii status bar filler" "i3status-wmii"
37         start-stop-daemon --stop --quiet --pidfile /var/run/i3status-wmii.pid --name i3status-wmii
38         log_end_msg $?
39         ;;
40 restart|reload|force-reload)    need_root
41         log_daemon_msg "Restarting wmii status bar filler" "i3status-wmii"
42         start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/i3status-wmii.pid --name i3status-wmii
43         start-stop-daemon --start --background --quiet --make-pidfile --pidfile /var/run/i3status-wmii.pid --name i3status-wmii --startas /usr/bin/i3status-wmii
44         ;;
45 *)      log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
46         exit 2
47         ;;
48 esac
49 exit 0