omap3-pandora-kernel2: update
[openpandora.oe.git] / recipes / pandora-system / pandora-auto-startx / rc.auto-startx
1 #!/bin/sh
2 #
3 # /etc/init.d/auto-startx: start/stop X windows
4 #
5
6
7 case $1 in
8 start)
9         if [ ! -f /etc/default/autologin ] ; then
10                 if [ -x /usr/sbin/first-boot-wizard.sh ] ; then
11                         /usr/bin/xinit /usr/sbin/first-boot-wizard.sh 2>&1 > /var/log/first-boot-wizard.log
12                 else
13                         echo -n "No user specified for auto login. Creating..."
14                         adduser --disabled-password "Pandora User,,," user
15                         echo 'export PREFERED_USER=user' > /etc/default/autologin
16                         echo "Done."
17                 fi
18         fi
19
20         . /etc/default/autologin
21
22         mkdir -p /var/run/console && touch /var/run/console/$PREFERED_USER
23
24         /bin/su - $PREFERED_USER -l -c "/bin/bash --login -c startx >/dev/null 2>&1" &
25         ;;
26 stop)
27         killall Xorg
28         ;;
29 restart)
30         $0 stop
31         sleep 2
32         $0 start
33         ;;
34 *)
35         echo "usage: $0 [start|stop|restart]"
36         ;;
37 esac
38  
39 # End of file