blob: 2e938f430719ea1b9924fdbfeb281e1f66474009 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#!/bin/sh
2#
3### BEGIN INIT INFO
4# Provides: weston
5# Required-Start: $local_fs $remote_fs
6# Required-Stop: $local_fs $remote_fs
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9### END INIT INFO
10
11if test -e /etc/default/weston ; then
12 . /etc/default/weston
13fi
14
15killproc() {
16 pid=`/bin/pidof $1`
17 [ "$pid" != "" ] && kill $pid
18}
19
20read CMDLINE < /proc/cmdline
21for x in $CMDLINE; do
22 case $x in
23 weston=false)
24 echo "Weston disabled"
25 exit 0;
26 ;;
27 esac
28done
29
30case "$1" in
31 start)
32 . /etc/profile
33
34 # This is all a nasty hack
35 if test -z "$XDG_RUNTIME_DIR"; then
36 export XDG_RUNTIME_DIR=/run/user/root
37 mkdir --parents $XDG_RUNTIME_DIR
38 chmod 0700 $XDG_RUNTIME_DIR
39 fi
40
41 openvt -s weston -- $OPTARGS
42 ;;
43
44 stop)
45 echo "Stopping Weston"
46 killproc weston
47 ;;
48
49 restart)
50 $0 stop
51 sleep 1
52 $0 start
53 ;;
54
55 *)
56 echo "usage: $0 { start | stop | restart }"
57 ;;
58esac
59
60exit 0