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

Last change on this file since 44537 was 44537, checked in by obi, 3 years ago

fix vfd sf8008ü

  • Property svn:executable set to *
File size: 9.0 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
170starthyprid()
171{
172        if [ "$model" == "spark7162" ]; then
173                echo "[$0] starthyprid"
174                if [ `cat /mnt/config/titan.cfg | grep ^"hypridtuner=" | cut -d "=" -f2 | wc -l` -eq 1 ]; then
175                        hypridtuner=`cat /mnt/config/titan.cfg | grep ^"hypridtuner=" | cut -d "=" -f2`
176                else
177                        hypridtuner=c
178                fi
179
180                sed "s/sed options spark7162 UnionTunerType=.*/sed options spark7162 UnionTunerType=$hypridtuner/" -i /etc/modprobe.d/_spark7162.conf
181        fi
182}
183
184startled()
185{
186        if [ "$model" == "sf8008" ]; then
187                echo "[$0] startled ser power > blue"
188                echo 1 > /proc/stb/fp/ledpowercolor
189        fi
190}
191
192startgui()
193{
194        STARTDEFAULT="/usr/local/bin/titan /mnt/config/titan.cfg"
195
196        if [ -e "/var/etc/.checkdualboot" ] && [ -e "/usr/bin/enigma2" ];then
197#               startbootlogo
198                (sleep 10; killall infobox) &
199                pid=$!
200                if [ -e "/mnt/config/dualboot" ];then
201                        infobox -pos -1 75% GUI#2 "Aktiviere Auswahlmenu (TitanNit/Enigma2)" "  Dualboot - nein" "  Dualboot - ja" ; ret=$?
202                else
203                        infobox -pos -1 75% GUI#1 "Aktiviere Auswahlmenu (TitanNit/Enigma2)" "  Dualboot - nein" "  Dualboot - ja" ; ret=$?
204                fi
205                kill -9 $pid
206                echo " " > /dev/vfd
207
208                if [ "$ret" = "2" ];then
209                        infobox -pos -1 75% 2 "Dualboot"  "  an" &
210                        echo enable dualboot
211                        touch /mnt/config/dualboot
212                else
213                        if [ "$ret" = "1" ];then
214                                rm /mnt/config/dualboot
215                                infobox -pos -1 75% 2 "Dualboot" "  aus" &
216                        else
217                                if [ -e "/mnt/config/dualboot" ];then
218                                        infobox -pos -1 75% 2 "Dualboot"  "  an" &
219                                else
220                                        infobox -pos -1 75% 2 "Dualboot" "  aus" &
221                                fi
222                        fi
223                fi
224                echo "Starting" > /dev/vfd
225                echo remove checkdualboot flag
226                rm -f /var/etc/.checkdualboot
227                sync
228                sleep 10
229#       else
230#               rm -f /etc/rc2.d/*
231#               rm -f /etc/rc3.d/*
232#               rm -f /etc/rcS.d/*
233        fi
234
235        # kill webif
236        fuser -k 80/tcp
237
238        if [ -e /mnt/config/dualboot ] && [ -e "/usr/bin/enigma2" ];then
239                if [ ! -e /mnt/config/dualboot.titan ] && [ ! -e /mnt/config/dualboot.enigma2 ] || [ -e /mnt/config/dualboot.titan ];then
240
241                        (sleep 10; killall infobox) &
242                        pid=$!
243                        infobox -pos -1 75% GUI#1 "++ DualBoot-Auswahl ++" "---- TitanNit  ----" "---- Enigma2 ----" ; ret=$?
244                        kill -9 $pid
245                        echo " " > /dev/vfd
246
247                        case $ret in
248                                2)
249                                        START="/usr/bin/enigma2"
250                                        rm -f /mnt/config/dualboot.titan
251                                        touch /mnt/config/dualboot.enigma2
252                                        $STARTDEFAULT;;
253                                *)
254                                        START="/usr/local/bin/titan /mnt/config/titan.cfg"
255                                        rm -f /mnt/config/dualboot.enigma2
256                                        touch /mnt/config/dualboot.titan;;
257                        esac
258                else
259
260                        (sleep 10; killall infobox) &
261                        pid=$!
262                        infobox -pos -1 75% GUI#2 "++ DualBoot-Auswahl ++" "---- TitanNit  ----" "---- Enigma2 ----" ; ret=$?
263                        kill -9 $pid
264                        echo " " > /dev/vfd
265
266                        case $ret in
267                                1)
268                                        START="/usr/local/bin/titan /mnt/config/titan.cfg"
269                                        rm -f /mnt/config/dualboot.enigma2
270                                        touch /mnt/config/dualboot.titan;;
271                                *)
272                                        START="/usr/bin/enigma2"
273                                        rm -f /mnt/config/dualboot.titan
274                                        touch /mnt/config/dualboot.enigma2
275                                        $STARTDEFAULT;;
276                        esac
277                fi
278        fi
279
280#       if [ "$START" = "/usr/bin/enigma2" ];then
281#               startInit3
282#               #/usr/bin/showiframe /usr/share/bootlogo.mvi
283#               startbootlogo
284#       fi
285
286        if [ -z "$START" ]; then START="$STARTDEFAULT"; fi
287
288        LD_PRELOAD=$LIBS $START
289
290        # titan exit codes:
291        #
292        # 1 - halt
293        # 2 - reboot
294        # 3 - restart enigma
295        #
296        # >128 signal
297
298        ret=$?
299
300        if [ "$ret" -ne "1" ]; then
301                if [ -e /proc/stb/info/boxtype ]; then
302                        stbcheck=`cat /proc/stb/info/boxtype | cut -c1-2`
303                        if [ $stbcheck == "u5" ]; then
304                                killall -9 showiframe; sleep 5
305                        fi
306                        stbcheck=`cat /proc/stb/info/boxtype`
307                        if [ $stbcheck == "sf8008" ] || [ $stbcheck == "sf8008s" ] || [ $stbcheck == "sf8008t" ] || [ $stbcheck == "ustym4kpro" ] || [ $stbcheck == "cc1" ] ; then
308                                killall -9 libreader; sleep 5
309                        fi
310                fi
311        fi
312
313        case $ret in
314                1)
315                        /sbin/halt
316                        ;;
317                2)
318                        if [ -f /proc/stb/fp/force_restart ]; then
319                                echo 1 > /proc/stb/fp/force_restart
320                        fi
321                        /sbin/reboot
322                        ;;
323                3)
324                        rm -fR /home/root/.gstreamer-0.10
325                        rm -f /tmp/.listen.camd.socket.ignore
326                        ;;
327                4)
328                        /sbin/rmmod lcd
329                        /usr/sbin/fpupgrade --upgrade 2>&1 | tee /home/root/fpupgrade.log
330                        sleep 1;
331                        /sbin/rmmod fp
332                        /sbin/modprobe fp
333                        /sbin/reboot
334                        ;;
335                16)
336                        echo "rescue" > /proc/stb/fp/boot_mode
337                        /sbin/reboot
338                        ;;
339                42)
340                        python /usr/lib/enigma2/python/upgrade.pyo
341                        ;;
342                43)
343                        init 1
344                        ;;
345                44)
346                        # little hack but it will be fixed soon in drivers
347                        /usr/lib/enigma2/python/Plugins/SystemPlugins/MICOMUpgrade/bin/fbclear
348                        /usr/bin/showiframe /usr/lib/enigma2/python/Plugins/SystemPlugins/MICOMUpgrade/wait.mvi
349                        echo fpupload >/proc/vfd && sleep 3 && dd bs=256k if=/tmp/micom.bin of=/dev/mcu
350                        /usr/bin/showiframe /usr/lib/enigma2/python/Plugins/SystemPlugins/MICOMUpgrade/reboot.mvi
351                        # Wait forever for the user to power off
352                        while(true) ; do sleep 60 ; done
353                        ;;
354                45)
355                        echo "    " > /dev/lcd0
356                        /usr/bin/gigablue_wol
357                        ;;
358                *)
359                        rm -f /tmp/.listen.camd.socket.ignore
360                        ;;
361        esac
362}
363
364case $1 in
365        first)
366                starthyprid
367#               startmnt
368#               startplugins
369                starthotplug
370                startemu
371#               startopkg
372                startdate
373                startbootlogo
374                startlibs
375                starthomedir
376                startrcreboot
377#               startdelpack
378                startCi
379                workarounds
380                startled
381                startgui;;
382        last)
383                checkemu
384                startusercmd;;
385        reboot)
386                startdropcaches;;
387esac
388
Note: See TracBrowser for help on using the repository browser.