treewide: fix initramfs detection
authorRobert Marko <robimarko@gmail.com>
Sun, 20 Dec 2020 17:02:54 +0000 (18:02 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 20 Dec 2020 17:14:56 +0000 (17:14 +0000)
Commit "initramfs: switch to tmpfs to fix ujail" switched initramfs to
now use tmpfs, it causes $(rootfs_type) to now return tmpfs when
running initramfs image instead of being empty.

This broke initramfs detection which is required so that when installing
on MikroTik devices firmware partition would first get erased fully
before writing.

So, lets test for $(rootfs_type) returning "tmpfs" instead.

Fixes: 7fd3c68 ("initramfs: switch to tmpfs to fix ujail)
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh
target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh

index 5ee549236983495c1f9c9db9ed3b002a990ec1ed..97d388168f5dee08b56756666d9dcf47a548d697 100644 (file)
@@ -39,7 +39,7 @@ platform_do_upgrade() {
                ;;
        *)
                # NOR devices: erase firmware if booted from initramfs
-               [ -z "$(rootfs_type)" ] && mtd erase firmware
+               [ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware
 
                default_do_upgrade "$1"
                ;;
index c68b012d0b6320e9e3276c5677050813743e6908..99ed36e429111cc19851fc43bcc2963c719e759c 100755 (executable)
@@ -31,7 +31,7 @@ platform_do_upgrade() {
        mikrotik,routerboard-760igs|\
        mikrotik,routerboard-m11g|\
        mikrotik,routerboard-m33g)
-               [ -z "$(rootfs_type)" ] && mtd erase firmware
+               [ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware
                ;;
        asus,rt-ac65p|\
        asus,rt-ac85p)