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