base-files: sysupgrade: fix handing get_image unpack commands
authorMatthias Schiffer <mschiffer@universe-factory.net>
Sun, 10 Jun 2018 13:41:52 +0000 (15:41 +0200)
committerMatthias Schiffer <mschiffer@universe-factory.net>
Mon, 11 Jun 2018 17:25:40 +0000 (19:25 +0200)
On bcm53xx and brcm47xx, commands are passed to default_do_upgrade that
expect the image to be passed on stdin, rather than as an argument.

Fixes: 30f61a34b4cf ("base-files: always use staged sysupgrade")
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
package/base-files/files/lib/upgrade/common.sh

index 5f5c9dc8a318773a8f4007d5911ae897431638d2..38056fd346b1cf990c6db77f4e470ddf58304815 100644 (file)
@@ -78,18 +78,18 @@ rootfs_type() {
 
 get_image() { # <source> [ <command> ]
        local from="$1"
-       local cat="$2"
+       local cmd="$2"
 
-       if [ -z "$cat" ]; then
+       if [ -z "$cmd" ]; then
                local magic="$(dd if="$from" bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')"
                case "$magic" in
-                       1f8b) cat="zcat";;
-                       425a) cat="bzcat";;
-                       *) cat="cat";;
+                       1f8b) cmd="zcat";;
+                       425a) cmd="bzcat";;
+                       *) cmd="cat";;
                esac
        fi
 
-       $cat "$from" 2>/dev/null
+       cat "$from" 2>/dev/null | $cmd
 }
 
 get_magic_word() {