Skip to content

Commit

Permalink
core: fix wrong preinit check
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Ansuel committed Dec 8, 2020
1 parent e8091fb commit 708bedf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion decompressed/base/usr/sbin/mount_modoverlay
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 708bedf

Please sign in to comment.