@@ -4,6 +4,85 @@ cd `dirname $0`
4
4
5
5
DATE_FILE=./date.txt
6
6
7
+ export DIALOGOPTS=" --colors --no-shadow"
8
+ if [ -f " $DATE_FILE " ] ; then
9
+ DATE=" ` cat $DATE_FILE ` "
10
+ export DIALOGOPTS=" $DIALOGOPTS --backtitle \" OpenDingux update $DATE \" "
11
+ fi
12
+
13
+ echo " screen_color = (RED,RED,ON)" > /tmp/dialog_err.rc
14
+
15
+ # ----------
16
+ # 1. Select and confirm device
17
+ # ----------
18
+ THISDEVICE=./thisdevice
19
+ DEVICE=$( $THISDEVICE --detect)
20
+ while true ; do
21
+ if [ -n " $DEVICE " ]; then
22
+ eval $( $THISDEVICE --device $DEVICE | grep DEVICE_NAME)
23
+ if [ -z " $DEVICE_NAME " ]; then
24
+ DEVICE=
25
+ continue
26
+ fi
27
+ DEVICE_LINE="
28
+ \Zb\Z3$DEVICE_NAME \Zn
29
+ "
30
+ if [ " $DEVICE_SELECTED " -eq 1 ]; then
31
+ TITLE=" The selected device is"
32
+ else
33
+ TITLE=" We detected this device as"
34
+ fi
35
+ DEVICE_CONFIRMATION=" $TITLE :
36
+ $DEVICE_LINE
37
+ Flashing incorrect firmware will
38
+ likely make your device unbootable.
39
+
40
+ You can select your device from
41
+ manually from the list.
42
+
43
+ Proceed with the current device?"
44
+
45
+ dialog --yes-label ' Continue' --no-label ' Select' \
46
+ --yesno " $DEVICE_CONFIRMATION " 0 0
47
+ if [ $? -eq 0 ] ; then
48
+ break
49
+ fi
50
+ else
51
+ DEVICE_WARNING=" \Zb\Z1We could not detect your device\Zn
52
+
53
+ Flashing incorrect firmware will
54
+ likely make your device unbootable.
55
+
56
+ Please CAREFULLY select your device
57
+ manually from the list."
58
+
59
+ dialog --defaultno --yes-label ' Select' --no-label ' Exit' \
60
+ --yesno " $DEVICE_WARNING " 0 0
61
+ if [ $? -ne 0 ] ; then
62
+ exit $?
63
+ fi
64
+ fi
65
+
66
+ exec 3>&1
67
+ NEW_DEVICE=$( $THISDEVICE --devices $1 | while read i; do
68
+ echo $i | cut -d' -' -f1 | xargs
69
+ echo $i | cut -d' -' -f2- | xargs
70
+ done | tr \\ n \\ 0 | xargs -0 \
71
+ dialog --menu " Select your device from the list" 0 0 3 \
72
+ 2>&1 1>&3 )
73
+ EXIT_STATUS=$?
74
+ exec 3>& -
75
+ if [ $EXIT_STATUS -ne 0 ] ; then
76
+ continue
77
+ fi
78
+
79
+ DEVICE=$NEW_DEVICE
80
+ DEVICE_SELECTED=1
81
+ done
82
+
83
+ # ----------
84
+ # 2. Final confirmation
85
+ # ----------
7
86
DISCLAIMER=" \Zb\Z3NOTICE\Zn
8
87
9
88
While we carefully constructed this
@@ -16,30 +95,27 @@ you perform the update.
16
95
17
96
Do you want to update now?"
18
97
19
- UP_TO_DATE=yes
20
-
21
- if [ -f " $DATE_FILE " ] ; then
22
- DATE=" ` cat $DATE_FILE ` "
23
- export DIALOGOPTS=" --colors --no-shadow --backtitle \" OpenDingux update $DATE \" "
24
- fi
25
-
26
- echo " screen_color = (RED,RED,ON)" > /tmp/dialog_err.rc
27
-
28
98
dialog --defaultno --yes-label ' Update' --no-label ' Cancel' --yesno " $DISCLAIMER " 0 0
29
99
if [ $? -ne 0 ] ; then
30
100
exit $?
31
101
fi
32
102
103
+ # ----------
104
+ # 3. Flashing
105
+ # ----------
33
106
clear
34
107
echo ' Update in progress - please be patient.'
35
108
echo
36
109
37
110
if [ " $( whoami) " = " root" -a ! -x /usr/sbin/od-update ]; then
38
- ./od-update $1
111
+ PATH= $( pwd ) : $PATH FORCE_DEVICE= " $DEVICE " ./od-update $1
39
112
else
40
- sudo od-update $1
113
+ sudo PATH= $( pwd ) : $PATH FORCE_DEVICE= " $DEVICE " od-update $1
41
114
fi
42
115
116
+ # ----------
117
+ # 4. Checking status
118
+ # ----------
43
119
ERR=$?
44
120
if [ $ERR -ne 0 ] ; then
45
121
case $ERR in
@@ -92,6 +168,9 @@ if [ $ERR -ne 0 ] ; then
92
168
exit $ERR
93
169
fi
94
170
171
+ # ----------
172
+ # 5. Reboot
173
+ # ----------
95
174
case $1 in
96
175
rs90)
97
176
LAST_KERNEL=START
0 commit comments