base-files: sysupgrade: fix handing get_image unpack commands

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: 30f61a34b4 ("base-files: always use staged sysupgrade")
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
v19.07.3_mercusys_ac12_duma
Matthias Schiffer 6 years ago
parent c22117a791
commit 3b6f865b01
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

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

Loading…
Cancel
Save