big merge of 2388redis & 2669tor (#2790)

This commit is contained in:
/rootzoll
2021-12-14 23:34:35 +01:00
committed by GitHub
parent 1cdb50d38f
commit 85b0c97d41
132 changed files with 4895 additions and 4106 deletions

View File

@@ -3,14 +3,12 @@
# get basic system information
# these are the same set of infos the WebGUI dialog/controler has
source /home/admin/raspiblitz.info
# get values from cache
# SETUPFILE
# 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
@@ -19,6 +17,11 @@ echo "# RASPIBLITZ SETUP STATE" > $SETUPFILE
sudo chown admin:admin $SETUPFILE
sudo chmod 777 $SETUPFILE
source <(/home/admin/_cache.sh get setupPhase dnsworking)
# remember original setupphase
orgSetupPhase="${setupPhase}"
############################################
# PRESETUP: SET DNS (just if needed)
if [ "${dnsworking}" == "0" ]; then
@@ -36,8 +39,7 @@ if [ "${setupPhase}" == "update" ]; then
echo "setPasswordA=1" >> $SETUPFILE
else
# default to normal setup options
setupPhase="setup"
sudo sed -i "s/^setupPhase=.*/setupPhase='setup'/g" /home/admin/raspiblitz.info
/home/admin/_cache.sh set setupPhase "setup"
echo "# you refused recovery option - defaulting to normal setup menu"
fi
fi
@@ -53,8 +55,7 @@ if [ "${setupPhase}" == "recovery" ]; then
echo "setPasswordA=1" >> $SETUPFILE
else
# default to normal setup options
setupPhase="setup"
sudo sed -i "s/^setupPhase=.*/setupPhase='setup'/g" /home/admin/raspiblitz.info
/home/admin/_cache.sh set setupPhase "setup"
echo "# you refused recovery option - defaulting to normal setup menu"
fi
fi
@@ -74,14 +75,15 @@ if [ "${setupPhase}" == "migration" ]; then
echo "setPasswordC=1" >> $SETUPFILE
else
# on cancel - default to normal setup
setupPhase="setup"
sudo sed -i "s/^setupPhase=.*/setupPhase='setup'/g" /home/admin/raspiblitz.info
/home/admin/_cache.sh set setupPhase "setup"
echo "# you refused node migration option - defaulting to normal setup"
exit 1
fi
fi
source <(/home/admin/_cache.sh get setupPhase)
############################################
# DEFAULT: Basic Setup menu
# user might default to from quick options
@@ -94,7 +96,7 @@ if [ "${setupPhase}" == "setup" ]; then
# menu RECOVER menu option
if [ "${menuresult}" == "4" ]; then
setupPhase="${orgSetupPhase}"
sudo sed -i "s/^setupPhase=.*/setupPhase='${setupPhase}'/g" /home/admin/raspiblitz.info
/home/admin/_cache.sh set setupPhase "${setupPhase}"
# proceed with provision (mark Password A to be set)
echo "# OK update process starting .."
echo "setPasswordA=1" >> $SETUPFILE
@@ -103,7 +105,7 @@ if [ "${setupPhase}" == "setup" ]; then
# menu MIGRATE menu option
if [ "${menuresult}" == "5" ]; then
setupPhase="${orgSetupPhase}"
sudo sed -i "s/^setupPhase=.*/setupPhase='${setupPhase}'/g" /home/admin/raspiblitz.info
/home/admin/_cache.sh set setupPhase "${setupPhase}"
# mark migration to happen on provision
echo "migrationOS='${hddGotMigrationData}'" >> $SETUPFILE
# user needs to reset password A, B & C
@@ -127,6 +129,8 @@ if [ "${setupPhase}" == "setup" ]; then
# FORMAT DRIVE on NEW SETUP or MIGRATION UPLOAD
if [ "${menuresult}" == "0" ] || [ "${menuresult}" == "1" ]; then
source <(/home/admin/_cache.sh get hddGotMigrationData hddBlocksBitcoin hddBlocksLitecoin hddCandidate)
# check if there is a blockchain to use (so HDD is already formatted)
# thats also true if the node is coming from another nodeOS
existingBlockchain=""
@@ -178,7 +182,7 @@ if [ "${setupPhase}" == "setup" ]; then
# delete everything but blockchain
echo "Deleting everything on HDD/SSD while keeping blockchain ..."
sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount
sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount 1>/dev/null 2>/dev/null
sudo /home/admin/config.scripts/blitz.datadrive.sh clean all -keepblockchain
if [ "${error}" != "" ]; then
echo "CLEANING HDD FAILED:"
@@ -295,23 +299,20 @@ if [ "${setupPhase}" == "setup" ]; then
# source the setup state fresh
source $SETUPFILE
# prepare config file
# prepare & write basic config file (on temp mem drive)
CONFIGFILE="/var/cache/raspiblitz/temp/raspiblitz.conf"
sudo rm $CONFIGFILE 2>/dev/null
sudo touch $CONFIGFILE
sudo chown admin:admin $CONFIGFILE
sudo chmod 777 $CONFIGFILE
# write basic config file data
echo "# RASPIBLITZ CONFIG FILE" > $CONFIGFILE
echo "raspiBlitzVersion='${codeVersion}'" >> $CONFIGFILE
echo "lcdrotate=1" >> $CONFIGFILE
echo "lightning=${lightning}" >> $CONFIGFILE
echo "network=${network}" >> $CONFIGFILE
echo "chain=main" >> $CONFIGFILE
echo "lcdrotate='1'" >> $CONFIGFILE
echo "lightning='${lightning}'" >> $CONFIGFILE
echo "network='${network}'" >> $CONFIGFILE
echo "chain='main'" >> $CONFIGFILE
echo "hostname='${hostname}'" >> $CONFIGFILE
echo "runBehindTor=on" >> $CONFIGFILE
echo "runBehindTor='on'" >> $CONFIGFILE
fi
fi
@@ -324,7 +325,7 @@ echo "# Starting passwords dialog ..."
/home/admin/setup.scripts/dialogPasswords.sh
# set flag for bootstrap process to kick-off provision process
sudo sed -i "s/^state=.*/state=waitprovision/g" /home/admin/raspiblitz.info
/home/admin/_cache.sh set state "waitprovision"
clear
echo "# setup dialog done - results in:"