protect old data from deletion

This commit is contained in:
rootzoll
2021-05-21 21:18:37 -05:00
parent bfb04ca919
commit a52a8bd066
3 changed files with 27 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ lightning=""
# chose blockchain
OPTIONS=()
OPTIONS+=(BITCOIN "Setup BITCOIN Blockchain (BitcoinCore)")
OPTIONS+=(LITECOIN "Setup LITECOIN Blockchain")
OPTIONS+=(LITECOIN "Setup LITECOIN Blockchain (experimental)")
CHOICE=$(dialog --clear \
--backtitle "RaspiBlitz ${codeVersion} - Setup" \
--title "⚡ Blockchain ⚡" \

View File

@@ -0,0 +1,14 @@
#!/bin/bash
whiptail --title " FORMATTING DATA DRVE " --yes-button "DELETE DATA" --no-button "CANCEL" --yesno "For fresh setup your data drive needs to be formatted, but there is old data on your HDD/SSD that could contain funds.
Are you really sure that you want delete that old data?
" 10 65
if [ "$?" == "0" ]; then
# 0 --> delete data
exit 0
else
# 1 --> cancel
exit 1
fi

View File

@@ -8,6 +8,9 @@ source /home/admin/raspiblitz.info
# this key/value file contains the state during the setup process
SETUPFILE="/var/cache/raspiblitz/temp/raspiblitz.setup"
# remember original setupphase
orgSetupPhase="${setupPhase}"
# init SETUPFILE & temp dir on mem drive
sudo mkdir /var/cache/raspiblitz/temp
sudo chown admin:admin /var/cache/raspiblitz/temp
@@ -106,6 +109,15 @@ if [ "${setupPhase}" == "setup" ]; then
# FRESH SETUP
if [ "${menuresult}" == "0" ]; then
# if other data is on HDD/SSD from migration/recover warn on formatting drive
if [ "${orgSetupPhase}" != "${setupPhase}" ]; then
/home/admin/setup.scripts/dialogDeleteData.sh
if [ "$?" == "1" ]; then
# exit with 0 to restart process from outside loop
exit 0
fi
fi
############################################
# Choosing Blockchain & Lightning