Update S58factoryreset

This commit is contained in:
Cyril 2024-05-21 11:29:51 +02:00
parent 4bf34cb33b
commit 3c6ae0c22e

View file

@ -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