From 708bedf2e402a6d9f7d48d5f27ab014f5e38104a Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Tue, 8 Dec 2020 18:07:31 +0100 Subject: [PATCH] core: fix wrong preinit check In older firmware /var/run is created by boot init.d script. In new firmware a file is used to signal preint state. Use these 2 check to assume preint state and deny mount of modroot in the wrong state Signed-off-by: Ansuel Smith --- decompressed/base/usr/sbin/mount_modoverlay | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decompressed/base/usr/sbin/mount_modoverlay b/decompressed/base/usr/sbin/mount_modoverlay index 2da749a36..748efd66c 100755 --- a/decompressed/base/usr/sbin/mount_modoverlay +++ b/decompressed/base/usr/sbin/mount_modoverlay @@ -20,7 +20,7 @@ activebank=$(cat /proc/banktable/active) #only if OBP is applied try to mount #mount will fail if coming from a failboot from bank1 (=mtd3 have a valid firmware) #also check that we are in preinit to avoid "hot" mount -if [[ "$bootedbank" != "$activebank" && "$bootedbank" == "bank_2" && ! -d /proc/1 ]]; then +if ([ -f /tmp/.preinit ] || [ ! -d /var/run ]) && [ "$bootedbank" != "$activebank" ] && [ "$bootedbank" = "bank_2" ]; then [ -d /tmp/modoverlay ] || mount_root fi