ae4cd64bf00fea5d4475621de80b6709e85c1900
[openblackhole/openblackhole-enigma2.git] / tools / enigma2.sh.in
1 #!/bin/sh
2
3 prefix=@prefix@
4 exec_prefix=@exec_prefix@
5 datarootdir=@datarootdir@
6
7 if [ -x @bindir@/showiframe ]; then
8         if [ -f @sysconfdir@/enigma2/backdrop.mvi ]; then
9                 @bindir@/showiframe @sysconfdir@/enigma2/backdrop.mvi
10         elif [ -f @sysconfdir@/enigma2/bootlogo.mvi ]; then
11                 @bindir@/showiframe @sysconfdir@/enigma2/bootlogo.mvi
12         elif [ -f @datadir@/bootlogo.mvi ]; then
13                 @bindir@/showiframe @datadir@/bootlogo.mvi
14         fi
15 fi
16
17 # hook to execute scripts always before enigma2 start
18 if [ -x @bindir@/enigma2_pre_start.sh ]; then
19         @bindir@/enigma2_pre_start.sh
20 fi
21
22 if [ -d /home/root ]; then
23         cd /home/root
24 fi
25
26 LIBS=@libdir@/libopen.so.0.0.0
27
28 #check for receiver specific passthrough helper lib
29 if [ -e @libdir@/libpassthrough.so ]; then
30         LIBS="$LIBS @libdir@/libpassthrough.so"
31 fi
32
33 sync
34 LD_PRELOAD=$LIBS @bindir@/enigma2
35
36 # enigma2 exit codes:
37 #
38 # 1 - halt
39 # 2 - reboot
40 # 3 - restart enigma
41 #
42 # >128 signal
43
44 ret=$?
45 case $ret in
46         1)
47                 /sbin/halt
48                 ;;
49         2)
50                 /sbin/reboot
51                 ;;
52         3)
53                 rm -fR /home/root/.gstreamer-0.10
54                 ;;
55         4)
56                 /sbin/rmmod lcd
57                 /usr/sbin/fpupgrade --upgrade 2>&1 | tee /home/root/fpupgrade.log
58                 sleep 1;
59                 /sbin/rmmod fp
60                 /sbin/modprobe fp
61                 /sbin/reboot
62                 ;;
63         42)
64                 # bind the console (when available)
65                 [ -f /sys/class/vtconsole/vtcon1/bind ] && echo 1 > /sys/class/vtconsole/vtcon1/bind
66                 opkg upgrade 2>&1 | tee /home/root/ipkgupgrade.log
67                 /sbin/reboot
68                 ;;
69         *)
70                 ;;
71 esac