diff --git a/home.admin/98repairMenu.sh b/home.admin/98repairMenu.sh index 11c9542e2..11fa0a0f9 100755 --- a/home.admin/98repairMenu.sh +++ b/home.admin/98repairMenu.sh @@ -87,7 +87,7 @@ fi OPTIONS+=(REINDEX-UTXO "Redindex Just Bitcoin Chainstate (Fast)") OPTIONS+=(REINDEX-FULL "Redindex Full Bitcoin Blockchain (Slow)") OPTIONS+=(RESET-CHAIN "Delete Blockchain & Re-Download") -OPTIONS+=(RESET-HDD "Delete HDD Data but keep Blockchain") +#OPTIONS+=(RESET-HDD "Delete HDD Data but keep Blockchain") OPTIONS+=(RESET-ALL "Delete HDD completely to start fresh") OPTIONS+=(DELETE-ELEC "Delete Electrum Index") @@ -152,7 +152,8 @@ case $CHOICE in ;; RESET-ALL) askBackupCopy - /home/admin/XXcleanHDD.sh -all + sudo /home/admin/config.scripts/blitz.data.sh reset OVERWRITE + sleep 3 infoResetSDCard sudo shutdown now exit 1; diff --git a/home.admin/config.scripts/blitz.data.sh b/home.admin/config.scripts/blitz.data.sh index 35b602b7d..bba2f14e9 100644 --- a/home.admin/config.scripts/blitz.data.sh +++ b/home.admin/config.scripts/blitz.data.sh @@ -2305,23 +2305,44 @@ if [ "$1" = "reset" ]; then echo "error='no storage device found'" exit 1 fi - # ask user to confirm - echo "# WARNING: This will delete all data on ${storageDevice}" - echo "# Are you really sure? (y/n)" - read -r answer - if [ "${answer}" != "y" ]; then - echo "# User canceled" - exit 1 + # check ask overide + if [ "$2" != "OVERWRITE" ]; then + # ask user to confirm + echo "# WARNING: This will delete all data on ${storageDevice}" + echo "# Are you really sure? (y/n)" + read -r answer + if [ "${answer}" != "y" ]; then + echo "# User canceled" + exit 1 + fi + echo "# Are you REALLY REALLY sure? (Y/N)" + read -r answer + if [ "${answer}" != "Y" ]; then + echo "# User canceled" + exit 1 + fi fi - echo "# Are you REALLY REALLY sure? (Y/N)" - read -r answer - if [ "${answer}" != "Y" ]; then - echo "# User canceled" - exit 1 - fi - echo "# Deleting all partitions on ${storageDevice} ..." + echo "# Update Tools ..." apt-get install -y gdisk + echo "# Stop Bitcoin and umount ..." + swapoff -a + systemctl stop bitcoind + sleep 3 + rm -rf /mnt/disk_storage/* + rm -rf /mnt/disk_storage/.[!.]* + rm -rf /mnt/disk_storage/..?* + umount -f /mnt/disk_storage 2>/dev/null + umount -l /mnt/disk_storage 2>/dev/null + umount -f /mnt/disk_data 2>/dev/null + umount -l /mnt/disk_data 2>/dev/null + umount -f /mnt/disk_system 2>/dev/null + umount -l /mnt/disk_system 2>/dev/null + partprobe /dev/${storageDevice} + echo "# Deleting all partitions on ${storageDevice} ..." + wipefs -a /dev/${storageDevice} sgdisk --zap-all /dev/${storageDevice} + sync + partprobe /dev/${storageDevice} echo "# DONE" exit 0 fi