From 3c6ae0c22e66302ddbfea90596a2afce3bef3bc8 Mon Sep 17 00:00:00 2001 From: Cyril Date: Tue, 21 May 2024 11:29:51 +0200 Subject: [PATCH] Update S58factoryreset --- files/services/S58factoryreset | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/files/services/S58factoryreset b/files/services/S58factoryreset index 23cc942..97787c1 100755 --- a/files/services/S58factoryreset +++ b/files/services/S58factoryreset @@ -1,10 +1,7 @@ #!/bin/sh # -# This script will execute just before klipper starts and it does not rely on wipe data -# it does the equivalent of `echo "all" | nc -U /var/run/wipe.sock` -# -# It needs to run after S12udev is started which is what mounts the usb key +# This script does the equivalent of `echo "all" | nc -U /var/run/wipe.sock` # FLAG_FILE="/tmp/udisk/sda1/factory_reset" @@ -16,7 +13,20 @@ factory_reset() { echo "Info: Factory reset was executed successfully, the printer will restart..." /etc/init.d/rcK >/dev/null 2>&1 /bin/rm -rf /overlay/upper/* >/dev/null 2>&1 - /usr/bin/find /usr/data/ -path '/usr/data/creality' -prune -o -path '/usr/data/wpa_supplicant.conf' -prune -o -path '/usr/data/machine_production_info' -prune -o -path '/usr/data/' -o -print -exec rm -rf {} \; >/dev/null 2>&1 + /usr/bin/find /usr/data/ \ + -path '/usr/data/creality' -prune -o \ + -path '/usr/data/wpa_supplicant.conf' -prune -o \ + -path '/usr/data/machine_production_info' -prune -o \ + -path '/usr/data/' -o -print \ + -exec rm -rf {} \; >/dev/null 2>&1 + /usr/bin/find /usr/data/creality/userdata \ + -path '/usr/data/creality/userdata/config/system_config.json' -prune -o \ + -path '/usr/data/creality/userdata/user_agree_root' -prune -o \ + -path '/usr/data/creality/userdata' -o -type d -o -print \ + -exec rm {} \; >/dev/null 2>&1 + /usr/bin/find /usr/data/creality/ \ + -depth -print \ + -exec rmdir {} \; >/dev/null 2>&1 /bin/sync >/dev/null 2>&1 /sbin/swapoff -a >/dev/null 2>&1 /sbin/reboot -f >/dev/null 2>&1