reorder dialogs

This commit is contained in:
rootzoll
2021-05-21 11:52:20 -05:00
parent 69ca1e07e5
commit 37c1d6b6fb
7 changed files with 117 additions and 129 deletions

View File

@@ -6,6 +6,7 @@ source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
echo "services default values"
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
if [ ${#BTCRPCexplorer} -eq 0 ]; then BTCRPCexplorer="off"; fi
if [ ${#specter} -eq 0 ]; then specter="off"; fi

View File

@@ -20,8 +20,8 @@ dialog --backtitle "RaspiBlitz - Setup" --title " RaspiBlitz Setup is done :) "
Press OK for a final reboot.
" 10 42
# let migration/init script do the rest
/home/admin/_bootstrap.migration.sh
# let update script do the rest
/home/admin/_bootstrap.update.sh
# copy logfile to analyse setup
cp $logFile /home/admin/raspiblitz.setup.log

View File

@@ -82,7 +82,7 @@ echo "--> CHECK CONFIG: sudo nginx -t"
sudo nginx -t
echo ""
if [ "${touchscreen}" = "0" ]; then
if [ "${touchscreen}" = "" ] || [ "${touchscreen}" = "0" ]; then
echo "- TOUCHSCREEN is OFF by config"
else
echo ""
@@ -92,7 +92,7 @@ else
echo ""
fi
if [ "${loop}" = "off" ]; then
if [ "${loop}" = "" ] || [ "${loop}" = "off" ]; then
echo "- Loop is OFF by config"
else
echo ""
@@ -102,7 +102,7 @@ else
echo ""
fi
if [ "${rtlWebinterface}" = "off" ]; then
if [ "${rtlWebinterface}" = "" ] || [ "${rtlWebinterface}" = "off" ]; then
echo "- RTL is OFF by config"
else
echo ""
@@ -112,7 +112,7 @@ else
echo ""
fi
if [ "${ElectRS}" = "off" ]; then
if [ "${ElectRS}" = "" ] || [ "${ElectRS}" = "off" ]; then
echo "- Electrum Rust Server is OFF by config"
else
echo ""
@@ -125,7 +125,7 @@ else
echo ""
fi
if [ "${lit}" = "off" ]; then
if [ "${lit}" = "" ] || [ "${lit}" = "off" ]; then
echo "- LIT is OFF by config"
else
echo ""
@@ -135,7 +135,7 @@ else
echo ""
fi
if [ "${BTCPayServer}" = "off" ]; then
if [ "${BTCPayServer}" = "" ] || [ "${BTCPayServer}" = "off" ]; then
echo "- BTCPayServer is OFF by config"
else
echo ""
@@ -145,7 +145,7 @@ else
echo ""
fi
if [ "${LNBits}" = "off" ]; then
if [ "${LNBits}" = "" ] || [ "${LNBits}" = "off" ]; then
echo "- LNbits is OFF by config"
else
echo ""
@@ -155,7 +155,7 @@ else
echo ""
fi
if [ "${thunderhub}" = "off" ]; then
if [ "${thunderhub}" = "" ] || [ "${thunderhub}" = "off" ]; then
echo "- Thunderhub is OFF by config"
else
echo ""
@@ -165,7 +165,7 @@ else
echo ""
fi
if [ "${specter}" = "off" ]; then
if [ "${specter}" = "" ] || [ "${specter}" = "off" ]; then
echo "- SPECTER is OFF by config"
else
echo ""
@@ -175,7 +175,7 @@ else
echo ""
fi
if [ "${sphinxrelay}" = "off" ]; then
if [ "${sphinxrelay}" = "" ] || [ "${sphinxrelay}" = "off" ]; then
echo "- SPHINX is OFF by config"
else
echo ""

View File

@@ -25,6 +25,10 @@ logFile="/home/admin/raspiblitz.log"
# used by display and later setup steps
infoFile="/home/admin/raspiblitz.info"
# SETUPFILE
# this key/value file contains the state during the setup process
setupFile="/var/cache/raspiblitz/temp/raspiblitz.setup"
# Init boostrap log file
echo "Writing logs to: ${logFile}"
echo "" > $logFile
@@ -359,17 +363,29 @@ echo "HDD already part of system: $isMounted" >> $logFile
if [ ${isMounted} -eq 0 ]; then
# write data needed for setup process into raspiblitz.info
echo "hddBlocksBitcoin=${hddBlocksBitcoin}">> ${infoFile}
echo "hddBlocksLitecoin=${hddBlocksLitecoin}">> ${infoFile}
echo "HDD is there but not AutoMounted yet - Waiting for user Setup/Update" >> $logFile
# determine correct info message
# determine correct setup phase
infoMessage="Please Login for Setup"
setupPhase="setup"
if [ "${hddRaspiData}" == "1" ]; then
infoMessage="Please Login for Update"
setupPhase="update"
elif [ "${hddGotMigrationData}" != "" ]; then
if [ "${hddGotMigrationData}" != "" ]; then
infoMessage="Please Login for Migration"
setupPhase="migration"
elif [ "${hddRaspiData}" == "1" ]; then
# determine if this is a recovery or an update
# TODO: improve version/update detetion later
isRecovery=$(echo "${hddRaspiVersion}" | grep -c "${codeVersion}")
if [ "${isRecovery}" == "1" ]; then
infoMessage="Please Login for Recovery"
setupPhase="recovery"
else
infoMessage="Please Login for Update"
setupPhase="update"
fi
fi
# signal "WAIT LOOP: SETUP" to LCD, SSH & WEBAPI
@@ -415,9 +431,6 @@ if [ ${isMounted} -eq 0 ]; then
done
echo "DEBUG ls /mnt/hdd/raspiblitz.conf" >> $logFile
ls /mnt/hdd/raspiblitz.conf >> $logFile
# temp mount the HDD
echo "Temp mounting data drive ($hddCandidate)" >> $logFile
if [ "${hddFormat}" != "btrfs" ]; then
@@ -431,12 +444,12 @@ if [ ${isMounted} -eq 0 ]; then
sudo /home/admin/config.scripts/blitz.datadrive.sh link
# kick-off provision process
sed -i "s/^state=.*/state=recovering/g" ${infoFile}
sed -i "s/^state=.*/state=provision/g" ${infoFile}
sed -i "s/^message=.*/message='Starting Provision'/g" ${infoFile}
#sed -i "s/^chain=.*/chain=${chain}/g" ${infoFile}
#sed -i "s/^network=.*/network=${network}/g" ${infoFile}
echo "Calling Data Migration .." >> $logFile
sudo /home/admin/_bootstrap.migration.sh
sudo /home/admin/_bootstrap.update.sh
echo "Calling Provisioning .." >> $logFile
sudo /home/admin/_bootstrap.provision.sh
sed -i "s/^state=.*/state=reboot/g" ${infoFile}

View File

@@ -10,8 +10,8 @@ infoFile="/home/admin/raspiblitz.info"
configFile="/mnt/hdd/raspiblitz.conf"
# debug info
echo "STARTED Migration/Init --> see logs in ${logFile}"
echo "STARTED Migration/Init" >> ${logFile}
echo "STARTED Update/Init --> see logs in ${logFile}"
echo "STARTED Update/Init" >> ${logFile}
sudo sed -i "s/^message=.*/message='Running Data Migration'/g" ${infoFile}
# HDD BTRFS RAID REPAIR IF NEEDED
@@ -29,19 +29,13 @@ fi
# LOAD DATA & PRECHECK
# check if there is a config file
configExists=$(ls ${configFile} 2>/dev/null | grep -c '.conf')
if [ ${configExists} -eq 0 ]; then
echo "FAIL see ${logFile}"
echo "FAIL: no config file (${configFile}) found to init or upgrade!" >> ${logFile}
exit 1
fi
# load old or init raspiblitz config
source ${configFile}
# check if config files contains basic: hostname
if [ ${#hostname} -eq 0 ]; then
sed -i "s/^state=.*/state=error/g" ${infoFile}
sed -i "s/^message=.*/message='config: missing hostname'/g" ${infoFile}
echo "FAIL see ${logFile}"
echo "FAIL: missing hostname in (${configFile})!" >> ${logFile}
exit 1
@@ -52,6 +46,8 @@ source /home/admin/_version.info
# check if code version was loaded
if [ ${#codeVersion} -eq 0 ]; then
sed -i "s/^state=.*/state=error/g" ${infoFile}
sed -i "s/^message=.*/message='missing /home/admin/_version.info'/g" ${infoFile}
echo "FAIL see ${logFile}"
echo "FAIL: no code version (/home/admin/_version.info) found!" >> ${logFile}
exit 1
@@ -59,34 +55,6 @@ fi
echo "prechecks OK" >> ${logFile}
# DEFAULT VALUES - MISSING data fields on init or upadte
# AUTOPILOT
# autoPilot=off|on
if [ ${#autoPilot} -eq 0 ]; then
echo "autoPilot=off" >> $configFile
fi
# AUTO NAT DISCOVERY
# autoNatDiscovery=off|on
if [ ${#autoNatDiscovery} -eq 0 ]; then
echo "autoNatDiscovery=off" >> $configFile
fi
# TOR
# runBehindTor=off|on
if [ ${#runBehindTor} -eq 0 ]; then
echo "runBehindTor=off" >> $configFile
fi
# RideTheLightning RTL
# rtlWebinterface=off|on
if [ ${#rtlWebinterface} -eq 0 ]; then
echo "rtlWebinterface=off" >> $configFile
fi
echo "default values OK" >> ${logFile}
# MIGRATION - DATA CONVERSION when updating config
# this is the place if on a future version change
# a conversion of config data or app data is needed

View File

@@ -51,13 +51,13 @@ elif [ "${eventID}" == "reboot" ]; then
Shutting down for reboot.
" 5 30
elif [ "${eventID}" == "recovering" ] && [ "${mode}" == "lcd" ]; then
elif [ "${eventID}" == "provision" ] || [ "${eventID}" == "recovering" ]; then
dialog --backtitle "${backtitle}" --cr-wrap --infobox "
Upgrade/Recover/Provision
---> ${contentString}
Please keep running until reboot.
" 6 24
" 7 40
elif [ "${eventID}" == "repair" ] && [ "${mode}" == "lcd" ]; then
@@ -69,7 +69,15 @@ Use your Password A
elif [ "${eventID}" == "waitsetup" ] && [ "${mode}" == "lcd" ]; then
if [ "${setupPhase}" == "setup"] || [ "${setupPhase}" == "update" ] || [ "${setupPhase}" == "migration" ]; then
if [ "${setupPhase}" == "setup"] || [ "${setupPhase}" == "update" ] || [ "${setupPhase}" == "recovery" ] || [ "${setupPhase}" == "migration" ]; then
# custom backtitle for this dialog
backtitle="RaspiBlitz ${codeVersion} / ${setupPhase}"
# display if HDD conatains blockhain or not
if [ "${hddBlocksBitcoin}" == "1" ] || [ "${hddBlocksLitecoin}" == "1" ]; then
backtitle="${backtitle} / (pre-synced)"
fi
# show default login help info
dialog --backtitle "${backtitle}" --cr-wrap --infobox "

View File

@@ -17,49 +17,70 @@ sudo chown admin:admin $SETUPFILE
sudo chmod 777 $SETUPFILE
############################################
# Basic Setup (Blockchain & Lightning Impl)
# (skip if migration was auto-detected)
# QuickOption: Update
if [ "${setupPhase}" == "update" ]; then
# migrationOS is from raspiblitz.info
if [ "${migrationOS}" == "" ]; then
echo "TODO: Update"
exit 1
# on cancel - default to normal setup
if [ "$?" != "0" ]; then
setupPhase="setup"
echo "# you refused update option - defaulting to normal setup"
exit 1
fi
fi
############################################
# QuickOption: Recovery
if [ "${setupPhase}" == "recovery" ]; then
echo "TODO: Update"
exit 1
# on cancel - default to normal setup
if [ "$?" != "0" ]; then
setupPhase="setup"
echo "# you refused recovery option - defaulting to normal setup"
exit 1
fi
fi
############################################
# QuickOption: Migration from other node
if [ "${setupPhase}" == "migration" ]; then
echo "# Starting migration dialog ..."
/home/admin/setup.scripts/dialogMigration.sh ${migrationOS}
# on cancel - default to normal setup
if [ "$?" != "0" ]; then
setupPhase="setup"
echo "# you refused node migration option - defaulting to normal setup"
exit 1
fi
fi
############################################
# DEFAULT: Fresh Setup
# user might default to from quick options
if [ "${setupPhase}" == "setup" ]; then
echo "# Starting basic setup dialog ..."
/home/admin/setup.scripts/dialogBasicSetup.sh
result=$?
echo "result(${result})"
exit 1
# on cancel - let user exit to terminal
if [ "$?" != "0" ]; then
echo "# you selected cancel - sending exit code 1"
exit 1
fi
fi
# source setup state fresh - in case manual migration was choosen
source $SETUPFILE
# migrationOS is from raspiblitz.info but might be overwritten from $SETUPFILE
if [ "${migrationOS}" != "" ]; then
###############################################
# MIGRATION
# other fullnodesOS or RaspiBlitz migration file
echo "# Starting migration dialog ..."
/home/admin/setup.scripts/dialogMigration.sh
# on cancel - shutdown system
if [ "$?" != "0" ]; then
clear
echo "OK .. no changes done to your hard drive. Shutting down."
sudo shutdown now
exit 1
fi
else
###############################################
# FRESH SETUP
############################################
# Setting Name for Node
@@ -91,27 +112,9 @@ else
done
fi
############################################
# Enter Passwords
# for fresh setup & migration
echo "# Starting passwords dialog ..."
/home/admin/setup.scripts/dialogPasswords.sh
############################################
# PROCESS SETUP CHOICES
# TODO: move this part later outside of dialog controller and combine with data from WebUI
if [ "${migrationOS}" == "" ]; then
############################################
# Normal Setup
echo "# CREATING raspiblitz.conf from your setup choices"
# prepate config file
# prepare config file
CONFIGFILE="/mnt/hdd/raspiblitz.conf"
sudo rm $CONFIGFILE 2>/dev/null
sudo chown admin:admin $CONFIGFILE
@@ -132,23 +135,18 @@ if [ "${migrationOS}" == "" ]; then
echo "chain=main" >> $CONFIGFILE
echo "runBehindTor=on" >> $CONFIGFILE
# set flag for bootstrap process to kick-off provision process
sudo sed -i "s/^state=.*/state=waitprovision/g" /home/admin/raspiblitz.info
else
############################################
# Process Migration
# TODO: move this part later outside of dialog controller and combine with data from WebUI
# source the setup state fresh
source $SETUPFILE
echo "TODO: Process Migration"
exit 1
fi
############################################
# Enter Passwords
# for fresh setup & migration
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
clear
echo "# setup dialog done - results in:"
echo "# $SETUPFILE"