@@ -4,6 +4,85 @@ cd `dirname $0`
44
55DATE_FILE=./date.txt
66
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+ # ----------
786DISCLAIMER=" \Zb\Z3NOTICE\Zn
887
988While we carefully constructed this
@@ -16,30 +95,27 @@ you perform the update.
1695
1796Do you want to update now?"
1897
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-
2898dialog --defaultno --yes-label ' Update' --no-label ' Cancel' --yesno " $DISCLAIMER " 0 0
2999if [ $? -ne 0 ] ; then
30100 exit $?
31101fi
32102
103+ # ----------
104+ # 3. Flashing
105+ # ----------
33106clear
34107echo ' Update in progress - please be patient.'
35108echo
36109
37110if [ " $( whoami) " = " root" -a ! -x /usr/sbin/od-update ]; then
38- ./od-update $1
111+ PATH= $( pwd ) : $PATH FORCE_DEVICE= " $DEVICE " ./od-update $1
39112else
40- sudo od-update $1
113+ sudo PATH= $( pwd ) : $PATH FORCE_DEVICE= " $DEVICE " od-update $1
41114fi
42115
116+ # ----------
117+ # 4. Checking status
118+ # ----------
43119ERR=$?
44120if [ $ERR -ne 0 ] ; then
45121 case $ERR in
@@ -92,6 +168,9 @@ if [ $ERR -ne 0 ] ; then
92168 exit $ERR
93169fi
94170
171+ # ----------
172+ # 5. Reboot
173+ # ----------
95174case $1 in
96175 rs90)
97176 LAST_KERNEL=START
0 commit comments