diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2010-10-11 16:34:41 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-10-12 21:32:44 +0200 |
commit | 5c3538f44d9912e013844b3fe82c51ce62a8247f (patch) | |
tree | 8b636a266f0c00dae9694f95166aa5f7c44518a7 /defaultenv/bin/update | |
parent | a828cef9b5bc5f1b3c50193dda069697e5b9691b (diff) | |
download | barebox-5c3538f44d9912e013844b3fe82c51ce62a8247f.tar.gz barebox-5c3538f44d9912e013844b3fe82c51ce62a8247f.tar.xz |
defaultenv/update: merge update_rootfs and update_kernel
use getopt to simplify it and prepare for xmodem support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'defaultenv/bin/update')
-rw-r--r-- | defaultenv/bin/update | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/defaultenv/bin/update b/defaultenv/bin/update new file mode 100644 index 0000000000..bdac11f209 --- /dev/null +++ b/defaultenv/bin/update @@ -0,0 +1,45 @@ +#!/bin/sh + +. /env/config + +type="" +device_type="" + +while getopt "ht:d:f:" Option +do +if [ ${Option} = t ]; then + type=${OPTARG} +elif [ ${Option} = d ]; then + device_type=${OPTARG} +elif [ ${Option} = f ]; then + imagename=${OPTARG} +else + . /env/bin/_update_help + exit 0 +fi +done + +if [ x${type} = xkernel ]; then + image=$kernelimage +elif [ x${type} = xrootfs ]; then + image=$rootfsimage + type=root +else + . /env/bin/_update_help + exit 1 +fi + +if [ x${imagename} != x ]; then + image=${imagename} +fi + +if [ x${device_type} = xnand ]; then + part=/dev/nand0.${type}.bb +elif [ x${device_type} = xnor ]; then + part=/dev/nor0.${type} +else + . /env/bin/_update_help + exit 1 +fi + +. /env/bin/_update |