base-files: Ensure reset only works if an overlay exists
[lede-git/.git] / package / base-files / files / etc / rc.button / reset
index c6dc7cfbc04bb2a562045e1e1fbd27b45d079468..4265767437e8eda3c758fe7f7941d7f608c95782 100755 (executable)
@@ -2,8 +2,12 @@
 
 . /lib/functions.sh
 
+OVERLAY="$( grep ' /overlay ' /proc/mounts )"
+
 case "$ACTION" in
 pressed)
+       [ -z "$OVERLAY" ] && return 0
+
        return 5
 ;;
 timeout)
@@ -16,7 +20,7 @@ released)
                echo "REBOOT" > /dev/console
                sync
                reboot
-       elif [ "$SEEN" -gt 5 ]
+       elif [ "$SEEN" -gt 5 -a -n "$OVERLAY" ]
        then
                echo "FACTORY RESET" > /dev/console
                jffs2reset -y && reboot &