mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-19 12:10:33 +02:00
format HDD & keep blockchain
This commit is contained in:
@@ -9,23 +9,25 @@ source /home/admin/raspiblitz.info
|
||||
SETUPFILE="/var/cache/raspiblitz/temp/raspiblitz.setup"
|
||||
source $SETUPFILE
|
||||
|
||||
# values to determine by dialogs
|
||||
network=""
|
||||
lightning=""
|
||||
|
||||
# chose blockchain
|
||||
OPTIONS=()
|
||||
OPTIONS+=(BITCOIN "Setup BITCOIN Blockchain (BitcoinCore)")
|
||||
OPTIONS+=(LITECOIN "Setup LITECOIN Blockchain (experimental)")
|
||||
CHOICE=$(dialog --clear \
|
||||
#################################
|
||||
# SELECT BLOCKCHAIN
|
||||
# when not already set by setupfile
|
||||
|
||||
if [ "${network}" == "" ]; then
|
||||
|
||||
OPTIONS=()
|
||||
OPTIONS+=(BITCOIN "Setup BITCOIN Blockchain (BitcoinCore)")
|
||||
OPTIONS+=(LITECOIN "Setup LITECOIN Blockchain (experimental)")
|
||||
CHOICE=$(dialog --clear \
|
||||
--backtitle "RaspiBlitz ${codeVersion} - Setup" \
|
||||
--title "⚡ Blockchain ⚡" \
|
||||
--menu "\nChoose which Blockchain to run: \n " \
|
||||
11 64 5 \
|
||||
"${OPTIONS[@]}" \
|
||||
2>&1 >/dev/tty)
|
||||
clear
|
||||
case $CHOICE in
|
||||
clear
|
||||
case $CHOICE in
|
||||
BITCOIN)
|
||||
# bitcoin core
|
||||
network="bitcoin"
|
||||
@@ -40,7 +42,13 @@ case $CHOICE in
|
||||
clear
|
||||
echo "User Cancel"
|
||||
exit 1
|
||||
esac
|
||||
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