first commit

main
Ben 1 year ago
commit edb63e42e6

@ -0,0 +1,35 @@
#!/bin/sh
[ "${ACTION}" = "released" ] || exit 0
. /lib/functions.sh
. /lib/functions/service.sh
logger -s -t "reset_button" "Reset button pressed, restoring from backup"
# specify the backup file
BACKUP_FILE="/etc/resetbutton.tar"
# check if backup file exists
if [ -f "$BACKUP_FILE" ]; then
logger -s -t "reset_button" "Backup file found, restoring..."
# stop all services before restoration
service_stop_all
# Extract the backup file
tar -xf $BACKUP_FILE -C /
# restart all services
service_start_all
logger -s -t "reset_button" "Restoration complete"
else
logger -s -t "reset_button" "No backup file found. Performing normal reset."
# Fallback to the default reset behavior if no backup is found
jffs2_mark_erase
fi
# sync to make sure all changes are written to disk
sync

Binary file not shown.
Loading…
Cancel
Save