setup dialog edit

This commit is contained in:
rootzoll
2025-01-17 21:20:42 +01:00
parent 703767c630
commit d4f74c878e
3 changed files with 62 additions and 42 deletions

View File

@@ -698,7 +698,7 @@ if [ "${scenario}" != "ready" ] ; then
source ${setupFile}
# when user agreed to system copy to bootable drive (flag from setupFile)
if [ "${copySystem}" = "1" ]; then
if [ "${systemCopy}" = "1" ]; then
#####################################
# SYSTEM COPY OF FRESH SYSTEM
@@ -758,7 +758,6 @@ if [ "${scenario}" != "ready" ] ; then
# TODO: disable old system boot
# TODO: REMOVE AFTER DEBUG
echo "DEBUG EXIT 1" >> ${logFile}
exit 0

View File

@@ -64,18 +64,15 @@ fi
# QuickOption: Migration from other node
if [ "${setupPhase}" == "migration" ]; then
source <(/home/admin/_cache.sh get hddGotMigrationData migrationMode)
if [ "${migrationMode}" == "" ]; then
migrationMode="normal"
fi
source <(/home/admin/_cache.sh get system_setup_storageMigration)
# show recovery dialog
echo "# Starting migration dialog (${hddGotMigrationData}) (${migrationMode})..."
echo "# Starting migration dialog (${system_setup_storageMigration}) ..."
/home/admin/setup.scripts/dialogMigration.sh ${hddGotMigrationData} ${migrationMode}
/home/admin/setup.scripts/dialogMigration.sh ${system_setup_storageMigration} "normal"
if [ "$?" == "0" ]; then
# mark migration to happen on provision
echo "migrationOS='${hddGotMigrationData}'" >> $SETUPFILE
echo "migrationOS='${system_setup_storageMigration}'" >> $SETUPFILE
# user needs to reset password A, B & C
echo "setPasswordA=1" >> $SETUPFILE
echo "setPasswordB=1" >> $SETUPFILE
@@ -139,12 +136,25 @@ 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)
source <(/home/admin/_cache.sh get system_setup_askSystemCopy system_setup_bootFromStorage system_setup_combinedDataStorage)
if [ "${system_setup_askSystemCopy}" == "1" ]; then
# ask user about system copy
/home/admin/setup.scripts/dialogSystemCopy.sh
userChoice=$?
if [ "${userChoice}" == "1" ]; then
echo "systemCopy=1" >> $SETUPFILE
else
echo "systemCopy=0" >> $SETUPFILE
fi
fi
source <(/home/admin/_cache.sh get system_setup_storageMigration system_setup_storageBlockchainGB)
# 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=""
if [ "${hddBlocksBitcoin}" == "1" ] || [ "${hddGotMigrationData}" != "" ]; then
if [ "${system_setup_storageBlockchainGB}" == "1" ] || [ "${system_setup_storageMigration}" != "" ]; then
existingBlockchain="BITCOIN"
fi
@@ -153,32 +163,11 @@ if [ "${setupPhase}" = "setup" ]; then
userChoice=$?
if [ "${userChoice}" == "1" ]; then
# FORMAT DATA DRIVE
filesystem="ext4"
# check if there is a flag set on sd card boot section to format as btrfs (experimental)
flagBTRFS=$(sudo ls /boot/firmware/btrfs* 2>/dev/null | grep -c btrfs)
if [ "${flagBTRFS}" != "0" ]; then
echo "Found BTRFS flag ---> formatting with experimental BTRFS filesystem"
filesystem="btrfs"
sleep 5
fi
# run formatting
echo "Running Format: (${filesystem}) (${hddCandidate})"
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh format ${filesystem} ${hddCandidate})
if [ "${error}" != "" ]; then
echo "FAIL ON FORMATTING THE DRIVE:"
echo "${error}"
echo "Please report as issue on the raspiblitz github."
exit 1
fi
echo "deleteData='all'" >> $SETUPFILE
elif [ "${userChoice}" == "2" ]; then
# KEEP BLOCKCHAIN + DELETE ALL THE REST
# will be done by bootstrap later triggered by setup file entry
echo "cleanHDD=1" >> $SETUPFILE
echo "deleteData='keepBlockchain'" >> $SETUPFILE
else
@@ -192,14 +181,16 @@ if [ "${setupPhase}" = "setup" ]; then
############################################
# UPLOAD MIGRATION
if [ "${menuresult}" == "1" ]; then
/home/admin/setup.scripts/dialogMigration.sh raspiblitz
if [ "$?" == "1" ]; then
# upload did not worked .. exit with 0 to restart process from outside loop
echo "Upload failed ... return to menu"
sleep 2
exit 0
fi
# user needs to reset password A
#/home/admin/setup.scripts/dialogMigration.sh raspiblitz
#if [ "$?" == "1" ]; then
# # upload did not worked .. exit with 0 to restart process from outside loop
# echo "Upload failed ... return to menu"
# sleep 2
# exit 0
#fi
echo "uploadMigration=1" >> $SETUPFILE
echo "setPasswordA=1" >> $SETUPFILE
fi

View File

@@ -0,0 +1,30 @@
#!/bin/bash
source <(/home/admin/_cache.sh get system_setup_storageDevice system_setup_storageDeviceName system_setup_storageSizeGB system_setup_storageWarning)
source <(/home/admin/_cache.sh get system_setup_systemDevice system_setup_systemDeviceName system_setup_systemSizeGB system_setup_systemWarning)
source <(/home/admin/_cache.sh get system_setup_dataDevice system_setup_dataDeviceName system_setup_dataSizeGB system_setup_dataWarning)
driveInfo=""
if [ "${system_setup_systemDevice}" != "" ]; then
driveInfo+="SYSTEM: ${system_setup_systemDevice} ${system_setup_systemSizeGB}GB\n"
fi
if [ "${system_setup_storageDevice}" != "" ]; then
driveInfo+="STORAGE: ${system_setup_storageDevice} ${system_setup_storageSizeGB}GB\n"
fi
if [ "${system_setup_dataDevice}" != "" ]; then
driveInfo+="DATA: ${system_setup_dataDevice} ${system_setup_systemSizeGB}GB\n"
fi
whiptail --title " BOOT FROM SSD/NVME " --yes-button "YES - BOOT SSD/NVME" --no-button "NO" --yesno "Your system allows to BOOT FROM SSD/NVME - which allows for better stability & performance and is recommended.
${driveInfo}
Do you want to copy RaspiBlitz system to SSD/NVME and boot from it?" 16 65
if [ "$?" == "0" ]; then
echo "# 0 --> Yes"
exit 1
else
echo "# 1 --> No"
exit 0
fi