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/base-files/files/lib/upgrade | |
parent | 70e74033fa86d65dfa4d222b0883fb88c1ab44ff (diff) | |
download | master-187ad058-a4fb93f13441f79c2fdce799b3f320ef656a6b89.tar.gz master-187ad058-a4fb93f13441f79c2fdce799b3f320ef656a6b89.tar.bz2 master-187ad058-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/base-files/files/lib/upgrade')
-rw-r--r-- | package/base-files/files/lib/upgrade/common.sh | 24 |
1 files changed, 12 insertions, 12 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() { |