raspiblitz/home.admin/00raspiblitz.sh

591 lines
21 KiB
Bash
Raw Normal View History

2019-04-16 18:55:25 +01:00
#!/bin/bash
2021-05-20 21:13:35 -05:00
#######################################
# SSH USER INTERFACE
# gets called when user logins per SSH
# or calls 'raspiblitz' on the terminal
#######################################
2021-05-05 01:01:11 +02:00
echo "Starting SSH user interface ..."
2019-04-16 18:55:25 +01:00
# CONFIGFILE - configuration of RaspiBlitz
configFile="/mnt/hdd/raspiblitz.conf"
# INFOFILE - state data from bootstrap
infoFile="/home/admin/raspiblitz.info"
2021-05-05 01:01:11 +02:00
# check if raspiblitz.info exists
systemInfoExists=$(ls ${infoFile} | grep -c "${infoFile}")
if [ "${systemInfoExists}" != "1" ]; then
echo "systemInfoExists(${systemInfoExists})"
echo "FAIL: ${infoFile} does not exist .. which it should at this point."
echo "Check logs & bootstrap.service for errors and report to devs."
2019-12-14 16:06:28 +01:00
exit 1
fi
2021-05-05 01:01:11 +02:00
# get system state information raspiblitz.info
source ${infoFile}
# check that basic system phase/state information is available
if [ "${setupPhase}" == "" ] || [ "${state}" == "" ]; then
echo "setupPhase(${setupPhase}) state(${state})"
echo "FAIL: ${infoFile} does not contain important state information."
echo "Check logs & bootstrap.service for errors and report to devs."
exit 1
fi
# prepare status file
# TODO: this is to be replaced and unified together with raspiblitz.info
# when we move to a background monitoring thread & redis for WebUI with v1.8
sudo touch /var/cache/raspiblitz/raspiblitz.status
sudo chown admin:admin /var/cache/raspiblitz/raspiblitz.status
sudo chmod 740 /var/cache/raspiblitz/raspiblitz.status
2021-05-20 21:13:35 -05:00
#####################################
# SSH MENU LOOP
# this loop runs until user exits or
# an error drops user to terminal
#####################################
2021-05-05 01:01:11 +02:00
exitMenuLoop=0
while [ ${exitMenuLoop} -eq 0 ]
do
#####################################
2021-05-20 21:13:35 -05:00
# Access fresh system info on every loop
# refresh system state information
source ${infoFile}
# gather fresh status scan and store results in memory
# TODO: move this into background loop and unify with redis data storage later
sudo /home/admin/config.scripts/blitz.statusscan.sh > /var/cache/raspiblitz/raspiblitz.status
source /var/cache/raspiblitz/raspiblitz.status
2021-05-25 18:44:35 -05:00
#####################################
# ALWAYS: Handle System States
#####################################
############################
# LND Wallet Unlock
if [ "${walletLocked}" == "1" ]; then
/home/admin/config.scripts/lnd.unlock.sh
fi
2021-05-20 21:13:35 -05:00
#####################################
# SETUP MENU
2021-05-05 01:01:11 +02:00
#####################################
2021-05-20 21:13:35 -05:00
# when is needed & bootstrap process signals that it waits for user dialog
2021-05-05 01:18:32 +02:00
if [ "${setupPhase}" != "done" ] && [ "${state}" == "waitsetup" ]; then
2021-05-05 01:01:11 +02:00
# push user to main menu
2021-05-05 01:18:32 +02:00
/home/admin/setup.scripts/setupDialogControl.sh
# use the exit code from setup menu as signal if menu loop should exited
2021-05-05 01:10:41 +02:00
# 0 = continue loop / everything else = break loop and exit to terminal
exitMenuLoop=$?
if [ "${exitMenuLoop}" != "0" ]; then break; fi
fi
2021-05-25 17:29:57 -05:00
#####################################
# 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
2021-05-25 18:00:52 -05:00
state="starting"
2021-05-25 17:29:57 -05:00
fi
2021-05-05 01:10:41 +02:00
#####################################
2021-05-25 19:30:29 -05:00
# MAIN MENU or BLOCKCHAIN SYNC
2021-05-05 01:10:41 +02:00
#####################################
2021-05-20 21:13:35 -05:00
# when setup is done & state is ready .. jump to main menu
2021-05-05 01:18:32 +02:00
if [ "${setupPhase}" == "done" ] && [ "${state}" == "ready" ]; then
2021-05-25 19:30:29 -05:00
# TODO: move data gathering into background and get thru raspiblitz.info/redis
source <(sudo /home/admin/config.scripts/blitz.statusscan.sh)
if [ "${initialSync}" == "1" ] && [ "${syncedToChain}" == "0" ]; then
# BLOCKCHAIN SYNC SCREEN
echo "Sync: ${syncProgress}"
sleep 4
else
# MAIN MENU
/home/admin/00mainMenu.sh
# use the exit code from main menu as signal if menu loop should exited
# 0 = continue loop / everything else = break loop and exit to terminal
exitMenuLoop=$?
if [ "${exitMenuLoop}" != "0" ]; then break; fi
fi
2021-05-05 01:01:11 +02:00
fi
#####################################
# DURING SETUP: Handle System States
#####################################
if [ "${setupPhase}" != "done" ]; then
2021-05-06 00:12:09 +02:00
echo "# DURING SETUP: Handle System State (${state})"
2021-05-06 02:23:02 +02:00
# when no HDD on Vagrant - just print info & exit (admin info & exit)
2021-05-06 00:12:09 +02:00
if [ "${state}" == "noHDD" ] && [ ${vagrant} -gt 0 ]; then
2021-05-06 00:13:18 +02:00
echo "***********************************************************"
echo "VAGRANT INFO"
echo "***********************************************************"
echo "To connect a HDD data disk to your VagrantVM:"
echo "- shutdown VM with command: off"
echo "- open your VirtualBox GUI and select RaspiBlitzVM"
echo "- change the 'mass storage' settings"
echo "- add a second 'Primary Slave' drive to the already existing controller"
echo "- close VirtualBox GUI and run: vagrant up & vagrant ssh"
echo "***********************************************************"
echo "You can either create a new dynamic VDI with around 900GB or download"
echo "a VDI with a presynced blockchain to speed up setup. If you dont have 900GB"
echo "space on your laptop you can store the VDI file on an external drive."
echo "***********************************************************"
exit 1
2021-05-18 18:43:59 -05:00
fi
2021-05-06 02:23:02 +02:00
# for all critical errors (admin info & exit)
if [ "${state}" == "errorHDD" ]; then
echo "***********************************************************"
echo "SETUP ERROR - please report to development team"
echo "***********************************************************"
echo "state(${state}) message(${message})"
if [ "${state}" == "errorHDD" ]; then
# print some debug detail info on HDD/SSD error
sudo /home/admin/config.scripts/blitz.datadrive.sh status
fi
echo "command to shutdown --> off"
exit 1
2021-05-06 00:13:18 +02:00
else
2021-05-06 00:12:09 +02:00
# every other state just push as event to SSH frontend
2021-05-06 00:40:33 +02:00
/home/admin/setup.scripts/eventInfoWait.sh "${state}" "${message}"
2020-10-14 01:31:27 +02:00
fi
2021-05-05 01:01:11 +02:00
fi
#####################################
# AFTER SETUP: Handle System States
#####################################
if [ "${setupPhase}" == "done" ]; then
echo "# AFTER SETUP: Handle System States "
fi
# debug wait
sleep 3
done
2021-05-18 18:43:59 -05:00
2021-05-05 01:30:39 +02:00
echo "# menu loop received exit code ${exitMenuLoop} --> exit to terminal"
2021-05-05 01:16:46 +02:00
echo "***********************************"
echo "* RaspiBlitz Commandline"
echo "* Here be dragons .. have fun :)"
echo "***********************************"
2021-05-05 01:17:23 +02:00
if [ "${setupPhase}" == "done" ]; then
2021-05-05 01:16:46 +02:00
echo "Bitcoin command line options: bitcoin-cli help"
echo "LND command line options: lncli -h"
2021-05-05 01:21:43 +02:00
else
echo "Your setup is not finished."
2021-05-05 01:33:34 +02:00
echo "For setup logs: cat raspiblitz.log"
2021-05-05 01:21:43 +02:00
echo "or call the command 'debug' to see bigger report."
2021-05-05 01:16:46 +02:00
fi
echo "Back to menus use command: raspiblitz"
echo
2021-05-05 01:10:41 +02:00
exit 0
2021-05-05 01:01:11 +02:00
2021-05-05 01:10:41 +02:00
################# TODO: MOVE PARTS BELOW TO APROPIATE NEW PLACE
2019-12-14 16:06:28 +01:00
2021-04-05 13:14:56 +02:00
# check if HDD is from another fullnode OS and offer migration
if [ "${hddGotMigrationData}" != "" ] && [ "${hddGotMigrationData}" != "none" ]; then
nodenameUpperCase=$(echo "${hddGotMigrationData}" | tr "[a-z]" "[A-Z]")
whiptail --title " ${nodenameUpperCase} --> RASPIBLITZ " --yes-button "Start Migration" --no-button "Ignore" --yesno "RaspiBlitz found data from ${nodenameUpperCase}
You can migrate your blockchain & LND data (funds & channels) over to RaspiBlitz.
Please make sure to have your ${nodenameUpperCase} seed words & static channel backup file (just in case). Also any data of additional apps you had installed on ${nodenameUpperCase} might get lost.
Do you want to start migration to RaspiBlitz now?
" 16 58
if [ $? -eq 0 ]; then
err=""
echo "**************************************************"
echo "MIGRATION FROM ${nodenameUpperCase} TO RASPIBLITZ"
echo "**************************************************"
echo "- started ..."
source <(sudo /home/admin/config.scripts/blitz.migration.sh migration-${hddGotMigrationData})
if [ "${err}" != "" ]; then
echo "MIGRATION FAILED: ${err}"
echo "Format data disk on laptop & recover funds with fresh sd card using seed words + static channel backup."
exit 1
fi
# if free space is lower than 100GB (100000000) delete backup files
if [ "${hddDataFreeKB}" != "" ] && [ ${hddDataFreeKB} -lt 407051412 ]; then
echo "- free space of data disk is low ... deleting 'backup_migration'"
sudo rm -R /mnt/hdd/backup_migration
else
echo "- old data of ${nodenameUpperCase} can be found in '/mnt/hdd/backup_migration'"
fi
sleep 3
# kick into reboot
echo "******************************************************"
echo "OK MIGRATION --> will now reboot and update/recover"
echo "******************************************************"
sudo shutdown -h -r now
sleep 100
2021-04-05 13:14:56 +02:00
exit 0
else
echo "******************************************************"
echo "MIGRATION SKIPPED ... starting fresh RaspiBlitz Setup"
echo "******************************************************"
sleep 6
fi
fi
2019-04-16 18:55:25 +01:00
# check data from _bootstrap.sh that was running on device setup
bootstrapInfoExists=$(ls $infoFile | grep -c '.info')
if [ ${bootstrapInfoExists} -eq 0 ]; then
echo "***********************************************************"
echo "WARNING: NO raspiblitz.info FOUND -> bootstrap not running?"
echo "***********************************************************"
exit
fi
# load the data from the info file (will get produced on every startup)
source ${infoFile}
if [ "${state}" = "recovering" ]; then
echo "***********************************************************"
echo "WARNING: bootstrap still updating - close SSH, login later"
echo "To monitor progress --> tail -n1000 -f raspiblitz.log"
echo "***********************************************************"
exit
fi
2020-09-29 12:35:22 +02:00
if [ "${state}" = "copysource" ]; then
echo "***********************************************************"
echo "INFO: You lost connection during copying the blockchain"
echo "You have the following options:"
echo "a) continue/check progress with command: sourcemode"
echo "b) return to normal mode with command: restart"
echo "***********************************************************"
exit
fi
2020-11-10 23:40:54 +01:00
# check if copy blockchain over LAN to this RaspiBlitz was running
source <(/home/admin/config.scripts/blitz.copyblockchain.sh status)
if [ "${copyInProgress}" = "1" ]; then
echo "Detected interrupted COPY blochain process ..."
/home/admin/50copyHDD.sh
exit
fi
2019-04-16 18:55:25 +01:00
# signal that after bootstrap recover user dialog is needed
recoveredInfoExists=$(sudo ls /home/admin/recover.flag 2>/dev/null | grep -c '.flag')
2019-05-02 14:38:03 +02:00
if [ ${recoveredInfoExists} -gt 0 ]; then
2019-04-16 18:55:25 +01:00
echo "System recovered - needs final user settings"
/home/admin/20recoverDialog.sh
exit 1
fi
# signal that a reindex was triggered
if [ "${state}" = "reindex" ]; then
echo "Re-Index in progress ... start monitoring:"
/home/admin/config.scripts/network.reindex.sh
exit 1
fi
2019-05-18 23:43:29 +02:00
# singal that copstation is running
if [ "${state}" = "copystation" ]; then
echo "Copy Station is Runnning ..."
echo "reboot to return to normal"
2019-05-19 02:20:32 +02:00
sudo /home/admin/XXcopyStation.sh
2019-05-18 23:43:29 +02:00
exit
fi
2019-04-16 18:55:25 +01:00
# if state=ready -> setup is done or started
if [ "${state}" = "ready" ]; then
configExists=$(ls ${configFile} | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then
echo "loading config data"
source ${configFile}
else
echo "setup still in progress - setupStep(${setupStep})"
fi
fi
## default menu settings
# to fit the main menu without scrolling:
HEIGHT=13
WIDTH=64
CHOICE_HEIGHT=6
BACKTITLE="RaspiBlitz"
TITLE=""
MENU="Choose one of the following options:"
OPTIONS=()
# check if RTL web interface is installed
runningRTL=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
# function to use later
waitUntilChainNetworkIsReady()
{
2019-04-25 15:59:22 +02:00
source ${configFile}
2019-04-16 18:55:25 +01:00
echo "checking ${network}d - please wait .."
echo "can take longer if device was off or first time"
2021-04-05 13:14:56 +02:00
# check for error on network
sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp
clienterror=`cat error.tmp`
rm error.tmp
# check for missing blockchain data
if [ "${network}" = "bitcoin" ]; then
if [ "${chain}" = "main" ]; then
2020-01-03 12:04:00 +00:00
minSize=210000000000
2021-04-05 13:14:56 +02:00
else
2020-01-03 12:04:00 +00:00
minSize=27000000000
2021-04-05 13:14:56 +02:00
fi
elif [ "${network}" = "litecoin" ]; then
if [ "${chain}" = "main" ]; then
2020-01-03 12:04:00 +00:00
minSize=20000000000
else
2021-04-05 13:14:56 +02:00
minSize=27000000000
2019-04-16 18:55:25 +01:00
fi
2021-04-05 13:14:56 +02:00
else
minSize=210000000000000
fi
isSyncing=$(sudo ls -la /mnt/hdd/${network}/blocks/.selfsync 2>/dev/null | grep -c '.selfsync')
blockchainsize=$(sudo du -shbc /mnt/hdd/${network}/ 2>/dev/null | head -n1 | awk '{print $1;}')
if [ ${#blockchainsize} -gt 0 ]; then
2019-04-16 18:55:25 +01:00
if [ ${blockchainsize} -lt ${minSize} ]; then
2019-07-01 00:24:36 +02:00
if [ ${isSyncing} -eq 0 ]; then
2019-06-30 21:15:16 +02:00
echo "blockchainsize(${blockchainsize})"
echo "Missing Blockchain Data (<${minSize}) ..."
clienterror="missing blockchain"
sleep 3
fi
2019-04-16 18:55:25 +01:00
fi
2021-04-05 13:14:56 +02:00
fi
2019-04-16 18:55:25 +01:00
2021-04-05 13:14:56 +02:00
if [ ${#clienterror} -gt 0 ]; then
2019-07-01 01:52:17 +02:00
#echo "clienterror(${clienterror})"
2019-04-16 18:55:25 +01:00
# analyse LOGS for possible reindex
2019-05-09 20:06:43 +02:00
reindex=$(sudo cat /mnt/hdd/${network}/debug.log 2>/dev/null | grep -c 'Please restart with -reindex or -reindex-chainstate to recover')
if [ ${reindex} -gt 0 ]; then
# dismiss if its just a date thing
2019-05-09 20:06:43 +02:00
futureBlock=$(sudo tail /mnt/hdd/${network}/debug.log 2>/dev/null | grep "Please restart with -reindex or -reindex-chainstate to recover" | grep -c "block database contains a block which appears to be from the future")
if [ ${futureBlock} -gt 0 ]; then
blockchainBroken=0
echo "-> Ignore reindex - its just a future block"
fi
2019-07-01 01:50:49 +02:00
if [ ${isSyncing} -gt 0 ]; then
reindex=0
fi
2019-05-01 03:15:48 +02:00
fi
2019-04-16 18:55:25 +01:00
if [ ${reindex} -gt 0 ] || [ "${clienterror}" = "missing blockchain" ]; then
2019-06-18 00:37:38 +02:00
2021-04-05 13:14:56 +02:00
if [ ${reindex} -gt 0 ]; then
echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options."
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
sleep 3
fi
whiptail --title "Blockchain not Complete" --yes-button "DELETE+REPAIR" --no-button "Continue Sync" --yesno "Your blockchain data is not complete (yet).
2019-04-16 18:55:25 +01:00
2021-04-05 13:14:56 +02:00
You can try to sync the chain further but if your stuck
this can be due to power problems or a failing HDD.
2020-05-29 23:59:48 +02:00
For more info see: https://raspiblitz.org -> FAQ
2019-04-16 18:55:25 +01:00
2021-04-05 13:14:56 +02:00
If you choose to DELETE+REPAIR the old blockchain gets
deleted but your Lightning funds & channel not be touched.
2019-04-16 18:55:25 +01:00
2019-06-30 21:15:16 +02:00
How do you want to continue?
2021-04-05 13:14:56 +02:00
" 15 65
2019-06-30 21:15:16 +02:00
if [ $? -eq 0 ]; then
#delete+repair
clear
2021-04-05 13:14:56 +02:00
echo "***********************************************************"
echo "DELETE+REPAIR blockchain ..."
echo "***********************************************************"
2019-06-30 21:15:16 +02:00
/home/admin/XXcleanHDD.sh -blockchain -force
/home/admin/98repairBlockchain.sh
/home/admin/00raspiblitz.sh
exit
else
# ignore - just delete blockchain logfile
clear
2021-04-05 13:14:56 +02:00
echo "***********************************************************"
echo "CONTINUE SYNC blockchain ..."
echo "***********************************************************"
2019-06-30 21:15:16 +02:00
fi
2019-04-16 18:55:25 +01:00
fi
2019-04-16 23:38:59 +01:00
# let 80scanLND script to the info to use
/home/admin/80scanLND.sh
if [ $? -gt 0 ]; then
2019-04-17 00:03:36 +01:00
echo "${network} error: ${clienterror}"
2019-04-16 23:38:59 +01:00
exit 0
2019-04-16 18:55:25 +01:00
fi
2021-04-05 13:14:56 +02:00
fi
2019-04-16 23:38:59 +01:00
2021-04-05 13:14:56 +02:00
while :
do
locked=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net getinfo 2>&1 | grep -c unlock)
if [ ${locked} -gt 0 ]; then
2019-04-17 00:41:58 +01:00
uptime=$(awk '{printf("%d\n",$1 + 0.5)}' /proc/uptime)
2019-04-17 00:48:26 +01:00
if [ "${autoUnlock}" == "on" ] && [ ${uptime} -lt 300 ]; then
# give autounlock 5 min after startup to react
2019-04-17 00:41:58 +01:00
sleep 1
else
2019-04-25 03:16:55 +02:00
# check how many times LND was restarted
source <(sudo /home/admin/config.scripts/blitz.statusscan.sh)
2019-05-01 12:00:22 +02:00
if [ ${startcountLightning} -lt 4 ]; then
2020-05-28 03:33:34 +02:00
/home/admin/config.scripts/lnd.unlock.sh
2019-04-25 03:16:55 +02:00
echo "Starting up Wallet ... (10sec)"
2019-04-25 03:34:54 +02:00
sleep 5
sleep 5
2019-04-25 03:16:55 +02:00
echo "please wait ... update to next screen can be slow"
else
2019-04-25 03:17:46 +02:00
/home/admin/80scanLND.sh lightning-error
2020-11-30 21:27:51 +01:00
sudo rm /home/admin/systemd.lightning.log
2019-04-25 03:36:04 +02:00
echo "(exit after too much restarts/unlocks - restart to try again)"
2019-04-25 03:16:55 +02:00
exit 0
fi
2019-04-17 00:41:58 +01:00
fi
2021-04-05 13:14:56 +02:00
fi
lndSynced=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
if [ ${lndSynced} -eq 0 ]; then
2019-04-16 18:55:25 +01:00
/home/admin/80scanLND.sh
2019-04-16 23:02:21 +01:00
if [ $? -gt 0 ]; then
exit 0
fi
2021-04-05 13:14:56 +02:00
else
2019-04-16 18:55:25 +01:00
# everything is ready - return from loop
return
fi
sleep 5
done
}
if [ ${#setupStep} -eq 0 ]; then
echo "WARN: no setup step found in raspiblitz.info"
setupStep=0
fi
if [ ${setupStep} -eq 0 ]; then
2021-04-17 21:52:26 +02:00
# start setup
BACKTITLE="RaspiBlitz - Setup"
TITLE="âš¡ Welcome to your RaspiBlitz âš¡"
MENU="\nChoose how you want to setup your RaspiBlitz: \n "
OPTIONS+=(BITCOIN "Setup BITCOIN and Lightning (DEFAULT)" \
LITECOIN "Setup LITECOIN and Lightning (EXPERIMENTAL)" \
MIGRATION "Upload a Migration File from old RaspiBlitz" )
HEIGHT=12
2019-04-16 18:55:25 +01:00
elif [ ${setupStep} -lt 100 ]; then
2021-04-17 21:52:26 +02:00
# continue setup
BACKTITLE="${hostname} / ${network} / ${chain}"
TITLE="âš¡ Welcome to your RaspiBlitz âš¡"
MENU="\nThe setup process is not finished yet: \n "
OPTIONS+=(CONTINUE "Continue Setup of your RaspiBlitz")
HEIGHT=10
2019-04-16 18:55:25 +01:00
else
2019-04-16 19:00:12 +01:00
2019-04-25 15:37:21 +02:00
# check if LND needs re-setup
source <(sudo /home/admin/config.scripts/lnd.check.sh basic-setup)
2020-08-02 22:42:33 +02:00
if [ "${wallet}" == "0" ] || [ "${macaroon}" == "0" ] || [ "${config}" == "0" ] || [ "${tls}" == "0" ]; then
2019-04-25 15:37:21 +02:00
echo "WARN: LND needs re-setup"
/home/admin/70initLND.sh
exit 0
fi
# wait all is synced and ready
2019-04-16 19:00:12 +01:00
waitUntilChainNetworkIsReady
# check if DNS is working (if not it will trigger dialog)
sudo /home/admin/config.scripts/internet.dns.sh test
#forward to main menu
2019-04-16 18:55:25 +01:00
/home/admin/00mainMenu.sh
exit 0
2019-04-16 19:02:10 +01:00
fi
2019-04-16 19:00:12 +01:00
2019-04-16 18:55:25 +01:00
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
CLOSE)
exit 1;
;;
BITCOIN)
2019-08-08 17:41:58 +02:00
# set network info
2019-04-16 18:55:25 +01:00
sed -i "s/^network=.*/network=bitcoin/g" ${infoFile}
sed -i "s/^chain=.*/chain=main/g" ${infoFile}
2019-08-08 17:41:58 +02:00
###### OPTIMIZE IF RAM >1GB
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >1GB --> optimizing ${network}.conf"
2019-08-08 20:31:43 +02:00
sudo sed -i "s/^dbcache=.*/dbcache=512/g" /home/admin/assets/bitcoin.conf
2019-08-08 17:41:58 +02:00
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /home/admin/assets/bitcoin.conf
fi
2019-04-16 18:55:25 +01:00
/home/admin/10setupBlitz.sh
exit 1;
;;
LITECOIN)
/home/admin/config.scripts/blitz.litecoin.sh on
2019-04-16 18:55:25 +01:00
/home/admin/10setupBlitz.sh
exit 1;
;;
MANUAL)
echo "************************************************************************************"
echo "PLEASE go to RaspiBlitz FAQ:"
echo "https://github.com/rootzoll/raspiblitz"
echo "And check: How can I recover my coins from a failing RaspiBlitz?"
echo "************************************************************************************"
exit 0
2020-04-18 00:53:11 +02:00
;;
2020-02-14 15:00:43 +01:00
MIGRATION)
sudo /home/admin/config.scripts/blitz.migration.sh "import-gui"
2020-11-30 14:14:49 +01:00
# on error clean & repeat
if [ "$?" = "1" ]; then
echo
echo "# clean and unmount for next try"
sudo umount /mnt/hdd 2>/dev/null
sudo umount /mnt/storage 2>/dev/null
sudo umount /mnt/temp 2>/dev/null
sleep 2
/home/admin/00raspiblitz.sh
fi
2020-02-14 15:00:43 +01:00
exit 0
2020-02-14 23:14:00 +01:00
;;
2020-04-18 00:53:11 +02:00
CONTINUE)
/home/admin/10setupBlitz.sh
exit 1;
2019-04-16 18:55:25 +01:00
;;
esac