initial commit
[ETG_Helmet] / SOFTWARE / OMEGA2 / init.sh
1 #/bin/bash
2
3 if [ "$TMPFS" == "" ]; then 
4         . "common.sh"
5 fi
6
7 echo $$ > $PID/$0
8
9
10 ledInint
11 led main fast
12
13 GPSdisable
14
15 # ------------------------- check microSD -------------------------------------------------------------
16
17 if [ ! -s $SD ]; then 
18         echo "SD card not mounted" | myLog
19         playRoboMessage "External partition has not been mounted. Trying to fix this issue."
20
21         if [ ! -e "/dev/mmcblk0p1" ]; then
22
23                 echo morse > /sys/class/leds/omega2p\:amber\:system/trigger
24                 echo "No micro SD detected, please check SD card integrity or reboot device." > /sys/class/leds/omega2p\:amber\:system/message
25                 
26                 while [ 1 ]; do
27                         playRoboMessage "No micro SD detected, please check SD card integrity or reboot device."
28                         echo "No micro SD detected, please check SD card integrity or reboot device." | tee /dev/console
29                         sleep 10
30                 done
31         fi
32
33         doFSCK
34
35         if [ ! -s $SD ]; then 
36
37                 playRoboMessage "Issue has not been fixed."
38
39                 while [ 1 ]; do
40                         playRoboMessage "Please restart device using the buttom switcher."
41                         sleep 10
42                 done 
43         else 
44                 playRoboMessage "Issue has been successfully fixed."
45         fi
46
47         playRoboMessage "In the case of relapse of errors, please change micro SD. You can find details in service manual, on Electronic Tour Guide creator website."
48
49 fi
50
51 # ------------------------- create TMPFS --------------------------------------------------------------
52
53 rm -r $TMPFS
54
55 mkdir -p $TMPFS
56
57 touch $TMPFS/$volume $TMPFS/$state $TMPFS/$prevLayer $DEVNULL
58
59 if [ ! -s "$TMPFS/$currentLang" ]; then 
60
61         LANGUAGE_DEF_NUM=$(ls -c1 $CONTENT | grep -n "$LANGUAGE_DEF_NAME" | awk -F':' '{print $1; exit}')
62
63         if [ "$LANGUAGE_DEF_NUM" != "" ]; then
64                 echo $LANGUAGE_DEF_NAME > "$TMPFS/$currentLang"
65                 echo $LANGUAGE_DEF_NUM > "$TMPFS/$currentLangNum"
66         else 
67                 ls -c1 $CONTENT | head -1 > "$TMPFS/$currentLang"
68                 echo 1 > "$TMPFS/$currentLangNum"
69         fi 
70
71 #       echo $(ls -c1 $CONTENT | head -$LANGUAGE_DEF | tail -1 ) > "$TMPFS/$currentLang"
72 #       echo $LANGUAGE_DEF > "$TMPFS/$currentLangNum"
73 fi
74
75 : > $TMPFS/$kbdExec
76
77 echo $VOLDEF > $TMPFS/$volume
78
79 # ------------------------- create FIFOs --------------------------------------------------------------
80
81 mkfifo $TIMENMEA
82 mkfifo $TMPFS/$message
83
84 # ------------------------- copy MAP and create narrative structure filesystem ------------------------
85
86 cp "$MAPSRC" "$MAP"
87
88 narrativeStructureReset         # creating files for each location in /tmp/...
89
90
91
92
93
Contact me: dev (at) shalnoff (dot) com
PGP fingerprint: A6B8 3B23 6013 F18A 0C71 198B 83D8 C64D 917A 5717