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

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

oebuild add spark hyprid tuner start

  • Property svn:executable set to *
File size: 8.9 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
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                        /sbin/reboot
314                        ;;
315                3)
316                        rm -fR /home/root/.gstreamer-0.10
317                        rm -f /tmp/.listen.camd.socket.ignore
318                        ;;
319                4)
320                        /sbin/rmmod lcd
321                        /usr/sbin/fpupgrade --upgrade 2>&1 | tee /home/root/fpupgrade.log
322                        sleep 1;
323                        /sbin/rmmod fp
324                        /sbin/modprobe fp
325                        /sbin/reboot
326                        ;;
327                16)
328                        echo "rescue" > /proc/stb/fp/boot_mode
329                        /sbin/reboot
330                        ;;
331                42)
332                        python /usr/lib/enigma2/python/upgrade.pyo
333                        ;;
334                43)
335                        init 1
336                        ;;
337                44)
338                        # little hack but it will be fixed soon in drivers
339                        /usr/lib/enigma2/python/Plugins/SystemPlugins/MICOMUpgrade/bin/fbclear
340                        /usr/bin/showiframe /usr/lib/enigma2/python/Plugins/SystemPlugins/MICOMUpgrade/wait.mvi
341                        echo fpupload >/proc/vfd && sleep 3 && dd bs=256k if=/tmp/micom.bin of=/dev/mcu
342                        /usr/bin/showiframe /usr/lib/enigma2/python/Plugins/SystemPlugins/MICOMUpgrade/reboot.mvi
343                        # Wait forever for the user to power off
344                        while(true) ; do sleep 60 ; done
345                        ;;
346                45)
347                        echo "    " > /dev/lcd0
348                        /usr/bin/gigablue_wol
349                        ;;
350                *)
351                        rm -f /tmp/.listen.camd.socket.ignore
352                        ;;
353        esac
354}
355
356case $1 in
357        first)
358                starthyprid
359#               startmnt
360#               startplugins
361                starthotplug
362                startemu
363#               startopkg
364                startdate
365                startbootlogo
366                startlibs
367                starthomedir
368                startrcreboot
369#               startdelpack
370                startCi
371                workarounds
372                startgui;;
373        last)
374                checkemu
375                startusercmd;;
376        reboot)
377                startdropcaches;;
378esac
379
Note: See TracBrowser for help on using the repository browser.