[platform/au1000/sysupgrade] fix sysupgrade when changing rootfs from jffs2 to 
squashfs and visa versa

till now only jffs2 was possible and sysupgrade refuses to change fs-type,
because of bad/invalid content in sysupgrade-file. manually overriding
works, so i made this patch. upgrade tested from r36088 to r38570.
(jffs2 to squashfs).

Signed-off-by: Bastian Bittorf <bitt...@bluebottle.com>
---
 .../au1000/base-files/lib/upgrade/platform.sh      |   25 +++++++++++++------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/target/linux/au1000/base-files/lib/upgrade/platform.sh 
b/target/linux/au1000/base-files/lib/upgrade/platform.sh
index 85ab213..e2c8687 100644
--- a/target/linux/au1000/base-files/lib/upgrade/platform.sh
+++ b/target/linux/au1000/base-files/lib/upgrade/platform.sh
@@ -1,19 +1,28 @@
 KERNEL_IMG="openwrt-au1000-au1500-vmlinux.bin"
-ROOTFS_IMG="openwrt-au1000-au1500-jffs2-128k.fs"
+ROOTFS_IMG_JFFS2="openwrt-au1000-au1500-jffs2-128k.fs"
+ROOTFS_IMG_SQASH="openwrt-au1000-au1500-squashfs.fs"
 
 platform_check_image() {
        [ "$ARGC" -gt 1 ] && return 1
        case "$(get_magic_word "$1")" in
                6f70)
-                       ( get_image "$1" | tar -tf - $KERNEL_IMG >/dev/null && \
-                         get_image "$1" | tar -tf - $ROOTFS_IMG >/dev/null) || 
{
-                               echo "Invalid image contents"
-                               return 1
-                       }
-                       return 0;;
+                       if get_image "$1" | tar -tf - "$KERNEL_IMG" >/dev/null 
; then
+                               if   get_image "$1" | tar -tf - 
"$ROOTFS_IMG_JFFS2" >/dev/null ; then
+                                       ROOTFS_IMG="$ROOTFS_IMG_JFFS2"
+                                       return 0
+                               elif get_image "$1" | tar -tf - 
"$ROOTFS_IMG_SQASH" >/dev/null ; then
+                                       ROOTFS_IMG="$ROOTFS_IMG_SQASH"
+                                       return 0
+                               fi
+                       fi
+
+                       echo "Invalid image contents, needing kernel + ( jffs2 
or squashfs )"
+                       return 1
+               ;;
                *)
                        echo "Invalid image type"
-                       return 1;;
+                       return 1
+               ;;
        esac
 }
 
-- 
1.7.2.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to