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

Karl Palsson karlp at tweak.net.au
Thu Oct 20 03:03:26 PDT 2016


It used to only do the sync+reboot for button presses less than 1
second. jffs2reset and reboot for button presses longer than 5
seconds, and _nothing_ for presses between 1 and 5 seconds.
(Potentially leaving room for someone else to add some other
hook, but realistically just useless)

I noticed it, but thought it was probably simpler this way, but
Rafal's right, if you're changing that behaviour as well, it
should at least be documented as deliberate in the commit note.

Sincerely,
Karl Palsson

Chris Blake <chrisrblake93 at gmail.com> wrote:
> Rafal,
> 
> I am not sure I see the issue you are mentioning. The patch's
> goal is to disable the "reset" feature for devices that do not
> have an overlay, and instead just reboot the device. This patch
> does that, and was tested on an ar71xx and x86_64 ext4
> platform.
> 
> Regards,
> Chris Blake
> 
> On Wed, Oct 19, 2016 at 4:33 PM, Rafał Miłecki
> <zajec5 at gmail.com> wrote:
> > On 19 October 2016 at 16:54, Chris Blake <chrisrblake93 at gmail.com> wrote:
> >> 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
> >
> > It seems to me you just changed behavior for pressing button for time
> > between 1 and 5 seconds. Your commit message doesn't state you wanted
> > to do that and I don't think we should.
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP Digital Signature
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20161020/61e8a72b/attachment.sig>


More information about the Lede-dev mailing list