[LEDE-DEV] [PATCH] base-files: ensure reset only works if an overlay exists

Chris Blake chrisrblake93 at gmail.com
Wed Oct 19 07:54:54 PDT 2016


Currently the reset script will try to run jffs2reset on boards that are
running a rw ext4 or other rootfs, which will then cause jffs2reset to
fail and the board to never reboot. This change ensures that jffs2reset
is only ran if an overlay is mounted.

Signed-off-by: Chris Blake <chrisrblake93 at gmail.com>
---
 package/base-files/files/etc/rc.button/reset | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/package/base-files/files/etc/rc.button/reset b/package/base-files/files/etc/rc.button/reset
index c6dc7cf..fab9a6c 100755
--- a/package/base-files/files/etc/rc.button/reset
+++ b/package/base-files/files/etc/rc.button/reset
@@ -11,15 +11,16 @@ timeout)
 	set_state failsafe
 ;;
 released)
-	if [ "$SEEN" -lt 1 ]
+	OVERLAY="$(cat /proc/mounts | grep ' /overlay ' 2>/dev/null)"
+	if [ "$SEEN" -gt 5 -a -n "$OVERLAY" ]
+	then
+		echo "FACTORY RESET" > /dev/console
+		jffs2reset -y && reboot &
+	elif [ "$SEEN" ]
 	then
 		echo "REBOOT" > /dev/console
 		sync
 		reboot
-	elif [ "$SEEN" -gt 5 ]
-	then
-		echo "FACTORY RESET" > /dev/console
-		jffs2reset -y && reboot &
 	fi
 ;;
 esac
-- 
2.7.4




More information about the Lede-dev mailing list