diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-01-08 15:30:37 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-01-08 15:30:37 +0000 |
commit | 4e88bcfb001bb1be4a79ab7326d8c726a5776eba (patch) | |
tree | 7fa52a3e57d4a643874640139535ccd9f6b582b9 | |
parent | 8094fa46da2d35632617ca1498148f7ad7483748 (diff) | |
download | mtk-20170518-4e88bcfb001bb1be4a79ab7326d8c726a5776eba.zip mtk-20170518-4e88bcfb001bb1be4a79ab7326d8c726a5776eba.tar.gz mtk-20170518-4e88bcfb001bb1be4a79ab7326d8c726a5776eba.tar.bz2 |
base-files: implement a --force option for sysupgrade to override image checks, useful to upgrade old ar71xx installations to current trunk ones
SVN-Revision: 29688
-rw-r--r-- | package/base-files/Makefile | 4 | ||||
-rwxr-xr-x | package/base-files/files/sbin/sysupgrade | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 241986c..e384e23 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2007-2011 OpenWrt.org +# Copyright (C) 2007-2012 OpenWrt.org # Copyright (C) 2010 Vertical Communications # # This is free software, licensed under the GNU General Public License v2. @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=base-files -PKG_RELEASE:=100 +PKG_RELEASE:=101 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ PKG_BUILD_DEPENDS:=opkg/host diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index fcf01b0..be11c5b 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 |