base-files: Remove nand.sh dependency from emmc upgrade
[openwrt/openwrt.git] / package / base-files / files / lib / upgrade / common.sh
index 5af061f6a43990afea92f8eacd865fe5249d8300..53b8865a57887d6ac75fa2d7a13fd68a7914be3b 100644 (file)
@@ -127,6 +127,33 @@ get_magic_fat32() {
        (get_image "$@" | dd bs=1 count=5 skip=82) 2>/dev/null
 }
 
+identify_magic_long() {
+       local magic=$1
+       case "$magic" in
+               "55424923")
+                       echo "ubi"
+                       ;;
+               "31181006")
+                       echo "ubifs"
+                       ;;
+               "68737173")
+                       echo "squashfs"
+                       ;;
+               "d00dfeed")
+                       echo "fit"
+                       ;;
+               "4349"*)
+                       echo "combined"
+                       ;;
+               "1f8b"*)
+                       echo "gzip"
+                       ;;
+               *)
+                       echo "unknown $magic"
+                       ;;
+       esac
+}
+
 part_magic_efi() {
        local magic=$(get_magic_gpt "$@")
        [ "$magic" = "EFI PART" ]