diff options
author | Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> | 2009-06-29 21:13:05 +0000 |
---|---|---|
committer | Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> | 2009-06-29 21:13:05 +0000 |
commit | a4fb93f13441f79c2fdce799b3f320ef656a6b89 (patch) | |
tree | da679391f44b2b0e41ecab4a4931ede1c660fdb5 /package | |
parent | 70e74033fa86d65dfa4d222b0883fb88c1ab44ff (diff) | |
download | upstream-a4fb93f13441f79c2fdce799b3f320ef656a6b89.tar.gz upstream-a4fb93f13441f79c2fdce799b3f320ef656a6b89.tar.bz2 upstream-a4fb93f13441f79c2fdce799b3f320ef656a6b89.zip |
[package] base-files: Fix sysupgrade .tar.gz configuration restoring
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16626 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r-- | package/base-files/files/lib/upgrade/common.sh | 24 | ||||
-rwxr-xr-x | package/base-files/files/sbin/sysupgrade | 2 |
2 files changed, 13 insertions, 13 deletions
diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 2c392496a0..06c257b639 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -105,26 +105,26 @@ rootfs_type() { get_image() { # <source> [ <command> ] local from="$1" - local cmd="$2" - local conc - - if [ -z "$cmd" ]; then - case "$from" in - http://*|ftp://*) cmd="wget -O- -q";; - *) cmd="cat";; - esac + local conc="$2" + local cmd + + case "$from" in + http://*|ftp://*) cmd="wget -O- -q";; + *) cmd="cat";; + esac + if [ -z "$conc" ]; then local magic="$(eval $cmd $from | dd bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')" case "$magic" in - 1f8b) conc="| zcat";; - 425a) conc="| bzcat";; + 1f8b) conc="zcat";; + 425a) conc="bzcat";; esac fi - eval "$cmd $from $conc" + eval "$cmd $from ${conc:+| $conc}" } get_magic_word() { - get_image "$1" | dd bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"' + get_image "$@" | dd bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"' } refresh_mtd_partitions() { diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index f25195a520..fb1e91a668 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -88,7 +88,7 @@ for check in $sysupgrade_image_check; do done if [ -n "$CONF_IMAGE" ]; then - case "$(get_magic_word "$CONF_IMAGE")" in + case "$(get_magic_word $CONF_IMAGE cat)" in # .gz files 1f8b) ;; *) |