base-files: default_do_upgrade: accept & forward image extraction command
authorJohn Crispin <john@openwrt.org>
Fri, 5 Jun 2015 14:12:05 +0000 (14:12 +0000)
committerJohn Crispin <john@openwrt.org>
Fri, 5 Jun 2015 14:12:05 +0000 (14:12 +0000)
get_image allows passing 2nd argument that is used in a pipe for
extracting firmware from a non-native format. By accepting such command
in default_do_upgrade we allow platforms to use this helper for vendor
specific images.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
SVN-Revision: 45900

package/base-files/files/lib/upgrade/common.sh

index 8cdabc6bdaea1cb2c892d656979c8b7c808cf05c..189ef69e954a1948465cf3842ca6f775208bfe2d 100644 (file)
@@ -212,12 +212,16 @@ jffs2_copy_config() {
        fi
 }
 
+# Flash firmware to MTD partition
+#
+# $(1): path to image
+# $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m
 default_do_upgrade() {
        sync
        if [ "$SAVE_CONFIG" -eq 1 ]; then
-               get_image "$1" | mtd $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}"
+               get_image "$1" "$2" | mtd $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}"
        else
-               get_image "$1" | mtd write - "${PART_NAME:-image}"
+               get_image "$1" "$2" | mtd write - "${PART_NAME:-image}"
        fi
 }