mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-22 16:10:55 +02:00
format HDD & keep blockchain
This commit is contained in:
@@ -9,11 +9,13 @@ source /home/admin/raspiblitz.info
|
||||
SETUPFILE="/var/cache/raspiblitz/temp/raspiblitz.setup"
|
||||
source $SETUPFILE
|
||||
|
||||
# values to determine by dialogs
|
||||
network=""
|
||||
lightning=""
|
||||
|
||||
# chose blockchain
|
||||
#################################
|
||||
# SELECT BLOCKCHAIN
|
||||
# when not already set by setupfile
|
||||
|
||||
if [ "${network}" == "" ]; then
|
||||
|
||||
OPTIONS=()
|
||||
OPTIONS+=(BITCOIN "Setup BITCOIN Blockchain (BitcoinCore)")
|
||||
OPTIONS+=(LITECOIN "Setup LITECOIN Blockchain (experimental)")
|
||||
@@ -41,6 +43,12 @@ case $CHOICE in
|
||||
echo "User Cancel"
|
||||
exit 1
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
#################################
|
||||
# SELECT LIGHTNING
|
||||
# only possible when network is bitcoin
|
||||
|
||||
if [ "${network}" == "bitcoin" ]; then
|
||||
|
||||
|
@@ -5,7 +5,7 @@ if [ "$1" == "format" ]; then
|
||||
whiptail --title " FORMATTING DATA DRVE " --yes-button "DELETE DATA" --no-button "STOP SETUP" --yesno "Your data drive will now be formatted. This will delete all data on your connected HDD/SSD. Make sure that there is no important data or old funds on that data drive.
|
||||
|
||||
Are you sure to format the HDD/SSD and DELETE ALL DATA on it?
|
||||
" 14 65
|
||||
" 12 65
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
# 0 --> delete data
|
||||
|
@@ -109,13 +109,51 @@ if [ "${setupPhase}" == "setup" ]; then
|
||||
# FRESH SETUP
|
||||
if [ "${menuresult}" == "0" ]; then
|
||||
|
||||
############################################
|
||||
# Format HDD/SSD - Keep Blockchain
|
||||
formatNeeded=1
|
||||
|
||||
# check if there is a blockchain to use (so HDD is already formatted)
|
||||
# thats also true if the node is coming from another nodeOS
|
||||
if [ "${hddBlocksBitcoin}" == "1" ] || [ "${hddBlocksLitecoin}" == "1" ] || [ "${hddGotMigrationData}" != "" ]; then
|
||||
/home/admin/setup.scripts/dialogDeleteData.sh keepblockchain
|
||||
if [ "$?" == "1" ]; then
|
||||
|
||||
# dont format HDD later - reuse data and clean up
|
||||
formatNeeded=0
|
||||
|
||||
# when blockchain comes from another node migrate data first
|
||||
if [ "${hddGotMigrationData}" != "" ]; then
|
||||
echo "TODO: Migrate data from '{hddGotMigrationData}'"
|
||||
fi
|
||||
|
||||
# delete everything but blockchain
|
||||
echo "TODO: Delete everything but blockchain"
|
||||
|
||||
# by keeping that blockchain - user choosed already the blockchain type
|
||||
if [ "${hddBlocksLitecoin}" == "1" ]; then
|
||||
echo "network=litecoin" >> $SETUPFILE
|
||||
else
|
||||
echo "network=bitcoin" >> $SETUPFILE
|
||||
fi
|
||||
|
||||
# exit with 0 to restart process from outside loop
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# if other data is on HDD/SSD from migration/recover warn on formatting drive
|
||||
if [ "${orgSetupPhase}" != "${setupPhase}" ]; then
|
||||
if [ "${formatNeeded}" == "1" ]; then
|
||||
/home/admin/setup.scripts/dialogDeleteData.sh
|
||||
if [ "$?" == "1" ]; then
|
||||
# exit with 0 to restart process from outside loop
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# delete everything but blockchain
|
||||
echo "TODO: Format HDD/SSD"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
############################################
|
||||
|
Reference in New Issue
Block a user