diff options
author | acinonyx <acinonyx@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-06-29 21:13:05 +0000 |
---|---|---|
committer | acinonyx <acinonyx@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2009-06-29 21:13:05 +0000 |
commit | 75b6ff70318b01f5a7ef2d4d3959ec5f25dc6b03 (patch) | |
tree | da679391f44b2b0e41ecab4a4931ede1c660fdb5 /package/base-files/files | |
parent | e2e0b921de20d12a3e331a2f067455f2a6489153 (diff) |
[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/base-files/files')
-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 2c392496a..06c257b63 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 f25195a52..fb1e91a66 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) ;; *) |