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

Chris Blake chrisrblake93 at gmail.com
Wed Oct 19 23:11:22 PDT 2016


Hey Rafal,

I agree that would work in terms of functionality, but the issue with
that logic is if you hold the button over 5 seconds, the system LED
will start flashing (as expected) but then no action is taken on the
board. The reason for my logic change was just to ensure the board
would reboot in that case.

Regards,
Chris Blake

On Thu, Oct 20, 2016 at 1:05 AM, Rafał Miłecki <zajec5 at gmail.com> wrote:
> On 20 October 2016 at 07:37, Chris Blake <chrisrblake93 at gmail.com> wrote:
>> On Thu, Oct 20, 2016 at 12:29 AM, Rafał Miłecki <zajec5 at gmail.com> wrote:
>>> On 20 October 2016 at 05:23, Chris Blake <chrisrblake93 at gmail.com> wrote:
>>>> 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="$( grep ' /overlay ' /proc/mounts )"
>>>> +       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
>>>
>>> Before:
>>> if $SEEN < 1 => reboot
>>> if $SEEN > 5 => factory
>>>
>>> After
>>> if $SEEN > 5 => factory
>>> else => reboot
>>>
>>> Can you see that changed behavior now?
>>
>> Rafal,
>>
>> Indeed I do. If you have a better idea for implementation I am all
>> ears on feedback to resolve this bug.
>
> Don't rework this script so much, just add:
> OVERLAY="$( grep ' /overlay ' /proc/mounts )"
> as you did and replace:
> elif [ "$SEEN" -gt 5 ]
> with:
> elif [ "$SEEN" -gt 5 -a -n "$OVERLAY" ]



More information about the Lede-dev mailing list