mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-25 07:07:46 +01:00
prepare final setup dialogs
This commit is contained in:
parent
53047d03fd
commit
acfc43546f
3 changed files with 121 additions and 49 deletions
|
@ -75,6 +75,16 @@ do
|
||||||
if [ "${exitMenuLoop}" != "0" ]; then break; fi
|
if [ "${exitMenuLoop}" != "0" ]; then break; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# SETUP DONE DIALOGS
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# when is needed & bootstrap process signals that it waits for user dialog
|
||||||
|
if [ "${setupPhase}" != "done" ] && [ "${state}" == "waitfinal" ]; then
|
||||||
|
# push to final setup gui dialogs
|
||||||
|
/home/admin/setup.scripts/finalDialogControl.sh
|
||||||
|
fi
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# MAIN MENU
|
# MAIN MENU
|
||||||
#####################################
|
#####################################
|
||||||
|
|
|
@ -514,11 +514,22 @@ if [ ${isMounted} -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
# WAIT LOOP: AFTER FRESH SETUP, MIFGRATION OR ERROR
|
# WAIT LOOP: AFTER FRESH SETUP, MIGRATION
|
||||||
# successfull update & recover can skip this
|
# successfull update & recover can skip this
|
||||||
###################################################
|
###################################################
|
||||||
|
|
||||||
until [ "${state}" != "ready" ]
|
if [ "${setupPhase}" == "setup" ] || [ "${setupPhase}" == "migration" ]; then
|
||||||
|
echo "# Go into WAIT LOOP for final setup dialog ..." >> $logFile
|
||||||
|
sed -i "s/^state=.*/state=waitfinal/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='Setup Done'/g" ${infoFile}
|
||||||
|
else
|
||||||
|
echo "# Skip WAIT LOOP boot directly into main menu ..." >> $logFile
|
||||||
|
sed -i "s/^state=.*/state=finalready/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='Setup Done'/g" ${infoFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
source ${infoFile}
|
||||||
|
until [ "${state}" == "finalready" ]
|
||||||
do
|
do
|
||||||
|
|
||||||
# TODO: DETECT WHEN USER SETUP IS DONE
|
# TODO: DETECT WHEN USER SETUP IS DONE
|
||||||
|
@ -544,30 +555,70 @@ if [ ${isMounted} -eq 0 ]; then
|
||||||
########################################
|
########################################
|
||||||
# AFTER FINAL SETUP TASKS
|
# AFTER FINAL SETUP TASKS
|
||||||
|
|
||||||
|
# make sure for future starts that blockchain service gets started after boostrap
|
||||||
|
sed -i "s/^Wants=.*/Wants=bootstrap.service/g" /etc/systemd/system/${network}d.service
|
||||||
|
sed -i "s/^After=.*/After=network.target/g" /etc/systemd/system/${network}d.service
|
||||||
|
|
||||||
# delete provision in progress flag
|
# delete provision in progress flag
|
||||||
sudo rm /home/admin/provision.flag
|
sudo rm /home/admin/provision.flag
|
||||||
|
|
||||||
# TODO:
|
# signal that setup phas is over
|
||||||
echo "TODO: add wants/after to systemd if blockchain service at the end" >> $logFile
|
sed -i "s/^setupPhase=.*/setupPhase='done'/g" ${infoFile}
|
||||||
exit 1
|
|
||||||
|
|
||||||
exit 0
|
#echo "rebooting" >> $logFile
|
||||||
|
#echo "state=recovered" >> /home/admin/recover.flag
|
||||||
echo "rebooting" >> $logFile
|
#echo "shutdown in 1min" >> $logFile
|
||||||
echo "state=recovered" >> /home/admin/recover.flag
|
|
||||||
echo "shutdown in 1min" >> $logFile
|
|
||||||
# save log file for inspection before reboot
|
# save log file for inspection before reboot
|
||||||
sudo cp ${logFile} ${logFile}.recover
|
#sudo cp ${logFile} ${logFile}.recover
|
||||||
sync
|
#sync
|
||||||
sudo shutdown -r -F -t 60
|
#sudo shutdown -r -F -t 60
|
||||||
exit 0
|
#exit 0
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
############################
|
||||||
|
############################
|
||||||
|
# NORMAL START BOOTSTRAP (not executed after setup)
|
||||||
|
# Blockchain & Lightning not running
|
||||||
|
############################
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# MAKE SURE LND RPC/REST ports are standard & open to all connections
|
||||||
|
######################################################################
|
||||||
|
sudo sed -i "s/^rpclisten=.*/rpclisten=0.0.0.0:10009/g" /mnt/hdd/lnd/lnd.conf
|
||||||
|
sudo sed -i "s/^restlisten=.*/restlisten=0.0.0.0:8080/g" /mnt/hdd/lnd/lnd.conf
|
||||||
|
|
||||||
|
#################################
|
||||||
|
# FIX BLOCKCHAINDATA OWNER (just in case)
|
||||||
|
# https://github.com/rootzoll/raspiblitz/issues/239#issuecomment-450887567
|
||||||
|
#################################
|
||||||
|
sudo chown bitcoin:bitcoin -R /mnt/hdd/bitcoin 2>/dev/null
|
||||||
|
|
||||||
|
#################################
|
||||||
|
# FIX BLOCKING FILES (just in case)
|
||||||
|
# https://github.com/rootzoll/raspiblitz/issues/1901#issue-774279088
|
||||||
|
# https://github.com/rootzoll/raspiblitz/issues/1836#issue-755342375
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/bitcoind.pid 2>/dev/null
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/.lock 2>/dev/null
|
||||||
|
|
||||||
|
################################
|
||||||
|
# DELETE LOG & LOCK FILES
|
||||||
|
################################
|
||||||
|
# LND and Blockchain Errors will be still in systemd journals
|
||||||
|
|
||||||
|
# /mnt/hdd/bitcoin/debug.log
|
||||||
|
sudo rm /mnt/hdd/${network}/debug.log 2>/dev/null
|
||||||
|
# /mnt/hdd/lnd/logs/bitcoin/mainnet/lnd.log
|
||||||
|
sudo rm /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null
|
||||||
|
# https://github.com/rootzoll/raspiblitz/issues/1700
|
||||||
|
sudo rm /mnt/storage/app-storage/electrs/db/mainnet/LOCK 2>/dev/null
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
############################
|
##############################
|
||||||
############################
|
##############################
|
||||||
# NORMAL START BOOTSTRAP
|
# BOOSTRAP IN EVERY SITUATION
|
||||||
############################
|
##############################
|
||||||
|
|
||||||
sed -i "s/^setupPhase=.*/setupPhase='starting'/g" ${infoFile}
|
sed -i "s/^setupPhase=.*/setupPhase='starting'/g" ${infoFile}
|
||||||
|
|
||||||
|
@ -599,25 +650,6 @@ source ${configFile}
|
||||||
# update public IP on boot - set to domain if available
|
# update public IP on boot - set to domain if available
|
||||||
/home/admin/config.scripts/internet.sh update-publicip ${lndAddress}
|
/home/admin/config.scripts/internet.sh update-publicip ${lndAddress}
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# MAKE SURE LND RPC/REST ports are standard & open to all connections
|
|
||||||
######################################################################
|
|
||||||
sudo sed -i "s/^rpclisten=.*/rpclisten=0.0.0.0:10009/g" /mnt/hdd/lnd/lnd.conf
|
|
||||||
sudo sed -i "s/^restlisten=.*/restlisten=0.0.0.0:8080/g" /mnt/hdd/lnd/lnd.conf
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# FIX BLOCKCHAINDATA OWNER (just in case)
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/239#issuecomment-450887567
|
|
||||||
#################################
|
|
||||||
sudo chown bitcoin:bitcoin -R /mnt/hdd/bitcoin 2>/dev/null
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# FIX BLOCKING FILES (just in case)
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/1901#issue-774279088
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/1836#issue-755342375
|
|
||||||
sudo rm -f /mnt/hdd/bitcoin/bitcoind.pid 2>/dev/null
|
|
||||||
sudo rm -f /mnt/hdd/bitcoin/.lock 2>/dev/null
|
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
# MAKE SURE USERS HAVE LATEST LND CREDENTIALS
|
# MAKE SURE USERS HAVE LATEST LND CREDENTIALS
|
||||||
#################################
|
#################################
|
||||||
|
@ -653,18 +685,6 @@ fi
|
||||||
sed -i "s/^state=.*/state=ready/g" ${infoFile}
|
sed -i "s/^state=.*/state=ready/g" ${infoFile}
|
||||||
sed -i "s/^message=.*/message='waiting login'/g" ${infoFile}
|
sed -i "s/^message=.*/message='waiting login'/g" ${infoFile}
|
||||||
|
|
||||||
################################
|
|
||||||
# DELETE LOG & LOCK FILES
|
|
||||||
################################
|
|
||||||
# LND and Blockchain Errors will be still in systemd journals
|
|
||||||
|
|
||||||
# /mnt/hdd/bitcoin/debug.log
|
|
||||||
sudo rm /mnt/hdd/${network}/debug.log 2>/dev/null
|
|
||||||
# /mnt/hdd/lnd/logs/bitcoin/mainnet/lnd.log
|
|
||||||
sudo rm /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/1700
|
|
||||||
sudo rm /mnt/storage/app-storage/electrs/db/mainnet/LOCK 2>/dev/null
|
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# CLEAN HDD TEMP
|
# CLEAN HDD TEMP
|
||||||
#####################################
|
#####################################
|
||||||
|
|
42
home.admin/setup.scripts/finalDialogControl.sh
Executable file
42
home.admin/setup.scripts/finalDialogControl.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# get basic system information
|
||||||
|
# these are the same set of infos the WebGUI dialog/controler has
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
|
||||||
|
# SETUPFILE
|
||||||
|
# this key/value file contains the state during the setup process
|
||||||
|
SETUPFILE="/var/cache/raspiblitz/temp/raspiblitz.setup"
|
||||||
|
source ${SETUPFILE}
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# SHOW SEED WORDS AFTER SETUP
|
||||||
|
if [ "${setupPhase}" == "setup" ]; then
|
||||||
|
|
||||||
|
echo "Write down your seedwords: ${seedwords6x4NEW}"
|
||||||
|
echo "PRESS ENTER"
|
||||||
|
readkey
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# SETUP DONE CONFIRMATION (Konfetti Moment)
|
||||||
|
|
||||||
|
# when coming from fresh setup
|
||||||
|
if [ "${setupPhase}" == "setup" ];
|
||||||
|
|
||||||
|
echo "Hooray :) Everything is Setup!"
|
||||||
|
echo "PRESS ENTER"
|
||||||
|
readkey
|
||||||
|
|
||||||
|
elif [ "${setupPhase}" == "migration" ]; then
|
||||||
|
|
||||||
|
echo "Hooray :) Your Migration to RaspiBlitz is Done!"
|
||||||
|
echo "PRESS ENTER"
|
||||||
|
readkey
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Missing Final Done Dialog for: ${setupPhase}"
|
||||||
|
echo "PRESS ENTER"
|
||||||
|
readkey
|
||||||
|
fi
|
Loading…
Add table
Reference in a new issue