11#! /bin/sh
22
3- if [ $# -ne 1 ]; then
3+ if [ $# -lt 1 ]; then
44 echo -e " Incorrect number of parameters.
55Usage:
6- \t$0 <data_dir>"
6+ \t$0 <data_dir> [device] "
77 exit 1
88fi
99
10- if [ -z " $FORCE_DEVICE " ]; then
11- DEVICE=$( thisdevice --detect)
12- [ -z " $DEVICE " ] && DEVICE=undetected
10+ if [ -x ./thisdevice ]; then
11+ THISDEVICE=./thisdevice
1312else
14- DEVICE= " $FORCE_DEVICE "
13+ THISDEVICE= $( which thisdevice 2> /dev/null )
1514fi
1615
17- DEVICEINFO=$( thisdevice --device " $DEVICE " 2> /dev/null)
16+ if [ -z " $THISDEVICE " ]; then
17+ echo " thisdevice utility can't be found"
18+ exit 12
19+ fi
20+
21+ [ -z " $DEVICE " ] && DEVICE=$2
22+ [ -z " $DEVICE " -a -r /tmp/_force_thisdevice ] && DEVICE=$( cat /tmp/_force_thisdevice)
23+ [ -z " $DEVICE " ] && DEVICE=$( $THISDEVICE --detect)
24+ [ -z " $DEVICE " ] && DEVICE=undetected
25+
26+ DEVICEINFO=$( $THISDEVICE --device " $DEVICE " 2> /dev/null)
1827if [ $? -ne 0 ] ; then
1928 echo " Unknown device $DEVICE "
2029 exit 12
@@ -26,13 +35,13 @@ BOOTLD=$1/ubiboot-$DEVICE_BOOTLOADER.bin
2635DEVICETREE=$1 /$DEVICE_DEVICETREE .dtb
2736
2837if [ ! -r " $BOOTLD " ]; then
29- echo " Bootloader $2 does not exists"
38+ echo " Bootloader $DEVICE_BOOTLOADER does not exists"
3039 exit 13
3140fi
3241
3342[ ! -r $DEVICETREE ] && DEVICETREE=/sys/firmware/fdt
3443if [ ! -r " $DEVICETREE " ]; then
35- echo " Device tree $3 does not exists"
44+ echo " Device tree $DEVICE_DEVICETREE does not exists"
3645 exit 14
3746fi
3847
@@ -99,7 +108,7 @@ if [ -r $ROOTFS -a "$0" != "/tmp/od-update" ] ; then
99108 umount $MNT
100109
101110 # Run the updated od-update script from the rootfs
102- exec /tmp/od-update $*
111+ exec /tmp/od-update " $@ "
103112 else
104113 umount $MNT
105114 fi
0 commit comments