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

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

test timefix spark smal deep display uhr

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