summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracinonyx <acinonyx@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-06-29 21:13:05 +0000
committeracinonyx <acinonyx@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-06-29 21:13:05 +0000
commit75b6ff70318b01f5a7ef2d4d3959ec5f25dc6b03 (patch)
treeda679391f44b2b0e41ecab4a4931ede1c660fdb5
parente2e0b921de20d12a3e331a2f067455f2a6489153 (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
-rw-r--r--package/base-files/files/lib/upgrade/common.sh24
-rwxr-xr-xpackage/base-files/files/sbin/sysupgrade2
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) ;;
*)