update wayland
[scm/bb/meta-tizen.git] / meta-tizen-adaptation / meta / recipes-graphics / wayland / weston-init / init
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
11 killproc() {
12         pid=`/bin/pidof $1`
13         [ "$pid" != "" ] && kill $pid
14 }
15
16 read CMDLINE < /proc/cmdline
17 for x in $CMDLINE; do
18         case $x in
19         weston=false)
20                 echo "Weston disabled"
21                 exit 0;
22                 ;;
23         esac
24 done
25
26 case "$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   ;;
54 esac
55
56 exit 0