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