diff options
author | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-01-08 15:30:37 +0000 |
---|---|---|
committer | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-01-08 15:30:37 +0000 |
commit | 39fdaaf30e4ebe9d774db6235cbbabf26f12469d (patch) | |
tree | 804c9d57b3d55b1ec9b1afad7d32f64a5c370246 /package/base-files/files/sbin/sysupgrade | |
parent | 57968b17ca658805ef2069321b960224109122b2 (diff) |
[package] base-files: implement a --force option for sysupgrade to override image checks, useful to upgrade old ar71xx installations to current trunk ones
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29688 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/sbin/sysupgrade')
-rwxr-xr-x | package/base-files/files/sbin/sysupgrade | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index fcf01b02d..be11c5bf3 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -12,6 +12,7 @@ export DELAY= export CONF_IMAGE= export CONF_BACKUP= export HELP=0 +export FORCE=0 # parse options while [ -n "$1" ]; do @@ -24,6 +25,7 @@ while [ -n "$1" ]; do -c) export SAVE_OVERLAY=1;; -b|--create-backup) export CONF_BACKUP="$2"; shift;; -f) export CONF_IMAGE="$2"; shift;; + -F|--force) export FORCE=1; shift;; -h|--help) export HELP=1; break;; -*) echo "Invalid option: $1" @@ -54,6 +56,8 @@ Options: then exit. Does not flash an image. If file is '-', i.e. stdout, verbosity is set to 0 (i.e. quiet). -n do not save configuration over reflash + -F / --force + Flash image even if image checks fail, this is dangerous! -q less verbose -v more verbose -h / --help display this help @@ -129,8 +133,13 @@ type platform_check_image >/dev/null 2>/dev/null || { for check in $sysupgrade_image_check; do ( eval "$check \"\$ARGV\"" ) || { - echo "Image check '$check' failed." - exit 1 + if [ $FORCE -eq 1 ]; then + echo "Image check '$check' failed but --force given - will update anyway!" + break + else + echo "Image check '$check' failed." + exit 1 + fi } done |