source: titan/oealliance/var/etc/autostart/start.sh @ 44611

Last change on this file since 44611 was 44611, checked in by obi, 4 years ago

sh4 oebuild fix rtc time

  • Property svn:executable set to *
File size: 8.7 KB
Line 
1startconfig=/mnt/config/start-config
2if [ ! -e "$startconfig" ]; then startconfig="/etc/titan.restore/mnt/config/start-config"; fi
3
4. $startconfig
5. /sbin/start-progress
6. /sbin/start-function
7
8model=`cat /etc/model`
9realbox=`cat /proc/stb/info/boxtype`
10arch=`cat /etc/.arch`
11board=`cat /etc/.board`
12
13starthotplug()
14{
15        echo "[$0] starthotplug"
16        hotplug.sh first
17}
18
19startlibs()
20{
21        #check for sundtek tuner helper lib
22        if [ -e /opt/lib/libmediaclient.so ]; then
23                LIBS="/opt/lib/libmediaclient.so /usr/lib/libopen.so.0.0.0"
24        elif [ -e /usr/lib/libopen.so.0.0.0 ]; then
25                LIBS="/usr/lib/libopen.so.0.0.0"
26        fi
27
28        #check for specific pagecache helper lib
29        if [ -e /usr/lib/libpagecache.so ]; then
30                LIBS="$LIBS /usr/lib/libpagecache.so"
31        fi
32
33        #check for receiver specific passthrough helper lib
34        if [ -e /usr/lib/libpassthrough.so ]; then
35                LIBS="$LIBS /usr/lib/libpassthrough.so"
36        fi
37
38        # in case sysctl.conf is not properly loaded - load sysctl.conf here again...
39        sysctl -p
40
41        if [ -e /usr/lib/libssl.so.1.0.2 ] && [ ! -e /usr/lib/libssl.so.1.0.0 ];then
42                echo "create symlink /usr/lib/libssl.so.1.0.2 -> /usr/lib/libssl.so.1.0.0"
43                ln -s /usr/lib/libssl.so.1.0.2 /usr/lib/libssl.so.1.0.0
44        fi
45
46        if [ -e /usr/lib/libcrypto.so.1.0.2 ] && [ ! -e /usr/lib/libcrypto.so.1.0.0 ];then
47                echo "create symlink /usr/lib/libcrypto.so.1.0.2 -> /usr/lib/libcrypto.so.1.0.0"
48                ln -s /usr/lib/libcrypto.so.1.0.2 /usr/lib/libcrypto.so.1.0.0
49        fi
50
51        if [ -e /usr/lib/libssl.so.1.0.2 ] && [ ! -e /usr/lib/libssl.so.0.9.8 ];then
52                echo "create symlink /usr/lib/libssl.so.1.0.2 -> /usr/lib/libssl.so.0.9.8"
53                ln -s /usr/lib/libssl.so.1.0.2 /usr/lib/libssl.so.0.9.8
54        fi
55
56        if [ -e /usr/lib/libcrypto.so.1.0.2 ] && [ ! -e /usr/lib/libcrypto.so.0.9.8 ];then
57                echo "create symlink /usr/lib/libcrypto.so.1.0.2 -> /usr/lib/libcrypto.so.0.9.80"
58                ln -s /usr/lib/libcrypto.so.1.0.2 /usr/lib/libcrypto.so.0.9.8
59        fi
60}
61
62startdate()
63{
64# dm7020hdv2 ok
65#               (ntpdate -b ptbtime1.ptb.de; time=`date +%s`; echo -e `expr $time + 7200`  > /proc/stb/fp/rtc) &
66#               echo "[startdate] ntpdate -b ptbtime1.ptb.de; /bin/fake-hwclock save force"
67#               (ntpdate -b ptbtime1.ptb.de; /bin/fake-hwclock save force; date; date -u) &
68                if [ -e /bin/fake-hwclock ]; then
69                        opkg remove fake-hwclock --force-depends
70                        date -d "1974-01-04"
71                fi
72}
73
74startdelpack()
75{
76        if [ -e /var/etc/.firstok ]; then
77                opkg remove minidlna --force-depends
78                rm /var/etc/.firstok
79        fi
80}
81
82startbootlogo()
83{
84        if [ -e /proc/stb/info/boxtype ]; then
85                stbcheck=`cat /proc/stb/info/boxtype`
86                if [ $stbcheck == "sf8008" ] || [ $stbcheck == "sf8008s" ] || [ $stbcheck == "sf8008t" ] || [ $stbcheck == "ustym4kpro" ] || [ $stbcheck == "cc1" ]; then
87                        count=`ps -ef |grep libreader |grep -v "grep" |wc -l`
88                        if [ 0 == $count ];then
89                                libreader 720P_50
90                        fi
91                fi
92        fi
93
94        if [ -x /usr/bin/showiframe ]; then
95                if [ -e /proc/stb/info/boxtype ]; then
96                        stbcheck=`cat /proc/stb/info/boxtype | cut -c1-2`
97                        if [ ! $stbcheck == "u5" ]; then
98                                killall -9 showiframe; sleep 1
99                        fi
100                else
101                        killall -9 showiframe; sleep 1
102                fi
103                if [ -f /etc/enigma2/backdrop.mvi ]; then
104                        /usr/bin/showiframe /etc/enigma2/backdrop.mvi
105                elif [ -f /usr/share/backdrop.mvi ]; then
106                        /usr/bin/showiframe /usr/share/backdrop.mvi
107                fi
108        fi
109}
110
111starthomedir()
112{
113        if [ -d /home/root ]; then
114                cd /home/root
115                export HOME=/home/root
116        fi
117}
118
119startemu()
120{
121        emu.sh "start" "" &
122}
123
124checkemu()
125{
126        emuret=`emu.sh check | grep "checkemu running emu="`
127        if [ -z "$emuret" ]; then
128                startemu restart
129        fi
130}
131
132startusercmd()
133{
134        if [ -e /mnt/config/usercmd.sh ]; then
135                /mnt/config/usercmd.sh
136        fi
137}
138
139startdropcaches()
140{
141        echo 3 > /proc/sys/vm/drop_caches
142}
143
144startrcreboot()
145{
146                RCDEV=`grep "rcdev=" /mnt/config/titan.cfg | cut -d "=" -f 2`
147                awk -f /etc/init.d/getfb.awk $RCDEV &
148}
149
150workarounds()
151{
152        if [ $realbox == "hd51" ] || [ $realbox == "multibox" ]; then
153                if [ ! -e "/usr/bin/enigma2" ];then
154                        touch /usr/bin/enigma2
155                        /etc/init.d/partitions-by-name &
156                fi
157        fi
158}
159
160startCi()
161{
162        if [ "$model" == "hd51" ] || [ "$model" == "mutant51" ]; then
163                if [ -e /mnt/bin/ciplushelper ];then
164                        /mnt/bin/ciplushelper &
165                        sleep 1
166                fi
167        fi
168}
169
170startled()
171{
172        if [ "$model" == "sf8008" ]; then
173                echo "[$0] startled ser power > blue"
174                echo 1 > /proc/stb/fp/ledpowercolor
175        fi
176}
177
178startgui()
179{
180        STARTDEFAULT="/usr/local/bin/titan /mnt/config/titan.cfg"
181
182        if [ -e "/var/etc/.checkdualboot" ] && [ -e "/usr/bin/enigma2" ];then
183#               startbootlogo
184                (sleep 10; killall infobox) &
185                pid=$!
186                if [ -e "/mnt/config/dualboot" ];then
187                        infobox -pos -1 75% GUI#2 "Aktiviere Auswahlmenu (TitanNit/Enigma2)" "  Dualboot - nein" "  Dualboot - ja" ; ret=$?
188                else
189                        infobox -pos -1 75% GUI#1 "Aktiviere Auswahlmenu (TitanNit/Enigma2)" "  Dualboot - nein" "  Dualboot - ja" ; ret=$?
190                fi
191                kill -9 $pid
192                echo " " > /dev/vfd
193
194                if [ "$ret" = "2" ];then
195                        infobox -pos -1 75% 2 "Dualboot"  "  an" &
196                        echo enable dualboot
197                        touch /mnt/config/dualboot
198                else
199                        if [ "$ret" = "1" ];then
200                                rm /mnt/config/dualboot
201                                infobox -pos -1 75% 2 "Dualboot" "  aus" &
202                        else
203                                if [ -e "/mnt/config/dualboot" ];then
204                                        infobox -pos -1 75% 2 "Dualboot"  "  an" &
205                                else
206                                        infobox -pos -1 75% 2 "Dualboot" "  aus" &
207                                fi
208                        fi
209                fi
210                echo "Starting" > /dev/vfd
211                echo remove checkdualboot flag
212                rm -f /var/etc/.checkdualboot
213                sync
214                sleep 10
215#       else
216#               rm -f /etc/rc2.d/*
217#               rm -f /etc/rc3.d/*
218#               rm -f /etc/rcS.d/*
219        fi
220
221        # kill webif
222        fuser -k 80/tcp
223
224        if [ -e /mnt/config/dualboot ] && [ -e "/usr/bin/enigma2" ];then
225                if [ ! -e /mnt/config/dualboot.titan ] && [ ! -e /mnt/config/dualboot.enigma2 ] || [ -e /mnt/config/dualboot.titan ];then
226
227                        (sleep 10; killall infobox) &
228                        pid=$!
229                        infobox -pos -1 75% GUI#1 "++ DualBoot-Auswahl ++" "---- TitanNit  ----" "---- Enigma2 ----" ; ret=$?
230                        kill -9 $pid
231                        echo " " > /dev/vfd
232
233                        case $ret in
234                                2)
235                                        START="/usr/bin/enigma2"
236                                        rm -f /mnt/config/dualboot.titan
237                                        touch /mnt/config/dualboot.enigma2
238                                        $STARTDEFAULT;;
239                                *)
240                                        START="/usr/local/bin/titan /mnt/config/titan.cfg"
241                                        rm -f /mnt/config/dualboot.enigma2
242                                        touch /mnt/config/dualboot.titan;;
243                        esac
244                else
245
246                        (sleep 10; killall infobox) &
247                        pid=$!
248                        infobox -pos -1 75% GUI#2 "++ DualBoot-Auswahl ++" "---- TitanNit  ----" "---- Enigma2 ----" ; ret=$?
249                        kill -9 $pid
250                        echo " " > /dev/vfd
251
252                        case $ret in
253                                1)
254                                        START="/usr/local/bin/titan /mnt/config/titan.cfg"
255                                        rm -f /mnt/config/dualboot.enigma2
256                                        touch /mnt/config/dualboot.titan;;
257                                *)
258                                        START="/usr/bin/enigma2"
259                                        rm -f /mnt/config/dualboot.titan
260                                        touch /mnt/config/dualboot.enigma2
261                                        $STARTDEFAULT;;
262                        esac
263                fi
264        fi
265
266#       if [ "$START" = "/usr/bin/enigma2" ];then
267#               startInit3
268#               #/usr/bin/showiframe /usr/share/bootlogo.mvi
269#               startbootlogo
270#       fi
271
272        if [ -z "$START" ]; then START="$STARTDEFAULT"; fi
273
274        LD_PRELOAD=$LIBS $START
275
276        # titan exit codes:
277        #
278        # 1 - halt
279        # 2 - reboot
280        # 3 - restart enigma
281        #
282        # >128 signal
283
284        ret=$?
285
286        if [ "$ret" -ne "1" ]; then
287                if [ -e /proc/stb/info/boxtype ]; then
288                        stbcheck=`cat /proc/stb/info/boxtype | cut -c1-2`
289                        if [ $stbcheck == "u5" ]; then
290                                killall -9 showiframe; sleep 5
291                        fi
292                        stbcheck=`cat /proc/stb/info/boxtype`
293                        if [ $stbcheck == "sf8008" ] || [ $stbcheck == "sf8008s" ] || [ $stbcheck == "sf8008t" ] || [ $stbcheck == "ustym4kpro" ] || [ $stbcheck == "cc1" ] ; then
294                                killall -9 libreader; sleep 5
295                        fi
296                fi
297        fi
298
299        case $ret in
300                1)
301                        /sbin/halt
302                        ;;
303                2)
304                        if [ -f /proc/stb/fp/force_restart ]; then
305                                echo 1 > /proc/stb/fp/force_restart
306                        fi
307                        /var/etc/autostart/start.sh reboot
308                        /sbin/reboot
309                        ;;
310                3)
311                        rm -fR /home/root/.gstreamer-0.10
312                        rm -f /tmp/.listen.camd.socket.ignore
313                        ;;
314                4)
315                        /sbin/rmmod lcd
316                        /usr/sbin/fpupgrade --upgrade 2>&1 | tee /home/root/fpupgrade.log
317                        sleep 1;
318                        /sbin/rmmod fp
319                        /sbin/modprobe fp
320                        /sbin/reboot
321                        ;;
322                16)
323                        echo "rescue" > /proc/stb/fp/boot_mode
324                        /sbin/reboot
325                        ;;
326                42)
327                        python /usr/lib/enigma2/python/upgrade.pyo
328                        ;;
329                43)
330                        init 1
331                        ;;
332                44)
333                        # little hack but it will be fixed soon in drivers
334                        /usr/lib/enigma2/python/Plugins/SystemPlugins/MICOMUpgrade/bin/fbclear
335                        /usr/bin/showiframe /usr/lib/enigma2/python/Plugins/SystemPlugins/MICOMUpgrade/wait.mvi
336                        echo fpupload >/proc/vfd && sleep 3 && dd bs=256k if=/tmp/micom.bin of=/dev/mcu
337                        /usr/bin/showiframe /usr/lib/enigma2/python/Plugins/SystemPlugins/MICOMUpgrade/reboot.mvi
338                        # Wait forever for the user to power off
339                        while(true) ; do sleep 60 ; done
340                        ;;
341                45)
342                        echo "    " > /dev/lcd0
343                        /usr/bin/gigablue_wol
344                        ;;
345                *)
346                        rm -f /tmp/.listen.camd.socket.ignore
347                        ;;
348        esac
349}
350
351case $1 in
352        first)
353#               starthyprid
354#               startmnt
355#               startplugins
356                starthotplug
357                startemu
358#               startopkg
359                startdate
360                startbootlogo
361                startlibs
362                starthomedir
363                startrcreboot
364#               startdelpack
365                startCi
366                workarounds
367                startled
368                startgui;;
369        last)
370                checkemu
371                startusercmd;;
372        reboot)
373                starthyprid
374                startdropcaches;;
375esac
376
Note: See TracBrowser for help on using the repository browser.