mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-21 14:11:06 +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"
|
SETUPFILE="/var/cache/raspiblitz/temp/raspiblitz.setup"
|
||||||
source $SETUPFILE
|
source $SETUPFILE
|
||||||
|
|
||||||
# values to determine by dialogs
|
|
||||||
network=""
|
|
||||||
lightning=""
|
|
||||||
|
|
||||||
# chose blockchain
|
#################################
|
||||||
OPTIONS=()
|
# SELECT BLOCKCHAIN
|
||||||
OPTIONS+=(BITCOIN "Setup BITCOIN Blockchain (BitcoinCore)")
|
# when not already set by setupfile
|
||||||
OPTIONS+=(LITECOIN "Setup LITECOIN Blockchain (experimental)")
|
|
||||||
CHOICE=$(dialog --clear \
|
if [ "${network}" == "" ]; then
|
||||||
|
|
||||||
|
OPTIONS=()
|
||||||
|
OPTIONS+=(BITCOIN "Setup BITCOIN Blockchain (BitcoinCore)")
|
||||||
|
OPTIONS+=(LITECOIN "Setup LITECOIN Blockchain (experimental)")
|
||||||
|
CHOICE=$(dialog --clear \
|
||||||
--backtitle "RaspiBlitz ${codeVersion} - Setup" \
|
--backtitle "RaspiBlitz ${codeVersion} - Setup" \
|
||||||
--title "⚡ Blockchain ⚡" \
|
--title "⚡ Blockchain ⚡" \
|
||||||
--menu "\nChoose which Blockchain to run: \n " \
|
--menu "\nChoose which Blockchain to run: \n " \
|
||||||
11 64 5 \
|
11 64 5 \
|
||||||
"${OPTIONS[@]}" \
|
"${OPTIONS[@]}" \
|
||||||
2>&1 >/dev/tty)
|
2>&1 >/dev/tty)
|
||||||
clear
|
clear
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
BITCOIN)
|
BITCOIN)
|
||||||
# bitcoin core
|
# bitcoin core
|
||||||
network="bitcoin"
|
network="bitcoin"
|
||||||
@@ -40,7 +42,13 @@ case $CHOICE in
|
|||||||
clear
|
clear
|
||||||
echo "User Cancel"
|
echo "User Cancel"
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#################################
|
||||||
|
# SELECT LIGHTNING
|
||||||
|
# only possible when network is bitcoin
|
||||||
|
|
||||||
if [ "${network}" == "bitcoin" ]; then
|
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.
|
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?
|
Are you sure to format the HDD/SSD and DELETE ALL DATA on it?
|
||||||
" 14 65
|
" 12 65
|
||||||
|
|
||||||
if [ "$?" == "0" ]; then
|
if [ "$?" == "0" ]; then
|
||||||
# 0 --> delete data
|
# 0 --> delete data
|
||||||
|
@@ -109,13 +109,51 @@ if [ "${setupPhase}" == "setup" ]; then
|
|||||||
# FRESH SETUP
|
# FRESH SETUP
|
||||||
if [ "${menuresult}" == "0" ]; then
|
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 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
|
/home/admin/setup.scripts/dialogDeleteData.sh
|
||||||
if [ "$?" == "1" ]; then
|
if [ "$?" == "1" ]; then
|
||||||
# exit with 0 to restart process from outside loop
|
# exit with 0 to restart process from outside loop
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# delete everything but blockchain
|
||||||
|
echo "TODO: Format HDD/SSD"
|
||||||
|
exit 1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
|
Reference in New Issue
Block a user