From d39db39e772de4bd700193403f8c4c5f09eb94cd Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 22 Jan 2025 16:51:36 -0800 Subject: [PATCH] only check for factory reset conditions on first comma service run --- userspace/usr/comma/comma.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/userspace/usr/comma/comma.sh b/userspace/usr/comma/comma.sh index 0f8006e..4dcb641 100755 --- a/userspace/usr/comma/comma.sh +++ b/userspace/usr/comma/comma.sh @@ -44,19 +44,22 @@ handle_setup_keys () { } # factory reset handling -if [ -f "$RESET_TRIGGER" ]; then - echo "launching system reset, reset trigger present" - rm -f $RESET_TRIGGER - $RESET -elif (( "$(cat /sys/devices/platform/soc/894000.i2c/i2c-2/2-0017/touch_count)" > 4 )); then - echo "launching system reset, got taps" - $RESET -elif ! mountpoint -q /data; then - echo "userdata not mounted. loading system reset" - if [ "$(head -c 15 /dev/disk/by-partlabel/userdata)" == "COMMA_RESET" ]; then - $RESET --format - else - $RESET --recover +if [ ! -f /tmp/booted ]; then + touch /tmp/booted + if [ -f "$RESET_TRIGGER" ]; then + echo "launching system reset, reset trigger present" + rm -f $RESET_TRIGGER + $RESET + elif (( "$(cat /sys/devices/platform/soc/894000.i2c/i2c-2/2-0017/touch_count)" > 4 )); then + echo "launching system reset, got taps" + $RESET + elif ! mountpoint -q /data; then + echo "userdata not mounted. loading system reset" + if [ "$(head -c 15 /dev/disk/by-partlabel/userdata)" == "COMMA_RESET" ]; then + $RESET --format + else + $RESET --recover + fi fi fi