summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/wayland/weston-init/init
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/wayland/weston-init/init')
-rw-r--r--meta/recipes-graphics/wayland/weston-init/init56
1 files changed, 56 insertions, 0 deletions
diff --git a/meta/recipes-graphics/wayland/weston-init/init b/meta/recipes-graphics/wayland/weston-init/init
new file mode 100644
index 0000000000..8e662e00a5
--- /dev/null
+++ b/meta/recipes-graphics/wayland/weston-init/init
@@ -0,0 +1,56 @@
1#!/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
11killproc() {
12 pid=`/bin/pidof $1`
13 [ "$pid" != "" ] && kill $pid
14}
15
16read CMDLINE < /proc/cmdline
17for x in $CMDLINE; do
18 case $x in
19 weston=false)
20 echo "Weston disabled"
21 exit 0;
22 ;;
23 esac
24done
25
26case "$1" in
27 start)
28 . /etc/profile
29
30 # This is all a nasty hack
31 if test -z "$XDG_RUNTIME_DIR"; then
32 export XDG_RUNTIME_DIR=/run/user/root
33 mkdir --parents $XDG_RUNTIME_DIR
34 chmod 0700 $XDG_RUNTIME_DIR
35 fi
36
37 openvt -s weston
38 ;;
39
40 stop)
41 echo "Stopping Weston"
42 killproc weston
43 ;;
44
45 restart)
46 $0 stop
47 sleep 1
48 $0 start
49 ;;
50
51 *)
52 echo "usage: $0 { start | stop | restart }"
53 ;;
54esac
55
56exit 0