only check for factory reset conditions on first comma service run

This commit is contained in:
Adeeb Shihadeh
2025-01-22 16:51:36 -08:00
parent 4f3cbd21b8
commit d39db39e77
+16 -13
View File
@@ -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