mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-12 05:39:22 +02:00
simplyfied scripts
This commit is contained in:
parent
843042b8f7
commit
0baf27416c
@ -6,20 +6,9 @@
|
||||
# in case it got interrupted
|
||||
echo "checking setup script"
|
||||
|
||||
# CONFIGFILE on HDD - configuration of RaspiBlitz
|
||||
configFile="/mnt/hdd/raspiblitz.conf"
|
||||
|
||||
# INFOFILE on SD - state data from bootstrap & setup
|
||||
infoFile="/home/admin/raspiblitz.info"
|
||||
|
||||
# try to load raspi config from HDD and
|
||||
# if not available yet (because HDD not mounted yet)
|
||||
# then try load info file from sd card
|
||||
source ${configFile} 2>/dev/null
|
||||
if [ ${#network} -eq 0 ]; then
|
||||
echo "HDD config not found - try SD info file"
|
||||
source ${infoFile} 2>/dev/null
|
||||
fi
|
||||
source ${infoFile}
|
||||
|
||||
# if no setup step in info file init with 0
|
||||
if [ ${#setupStep} -eq 0 ];then
|
||||
@ -132,7 +121,7 @@ if [ ${mountOK} -eq 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# HDD is empty - ask how to get Blockchain
|
||||
# HDD is empty - get Blockchain
|
||||
|
||||
#Bitcoin
|
||||
if [ ${network} = "bitcoin" ]; then
|
||||
@ -194,13 +183,6 @@ if [ ${setupStep} -eq 0 ]; then
|
||||
# set SetupState
|
||||
sudo sed -i "s/^setupStep=.*/setupStep=20/g" ${infoFile}
|
||||
|
||||
# update system
|
||||
echo ""
|
||||
echo "*** Update System ***"
|
||||
sudo apt-mark hold raspberrypi-bootloader
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -f -y --allow-change-held-packages
|
||||
echo "OK - System is now up to date"
|
||||
fi
|
||||
|
||||
# the HDD is already ext4 formated and called blockchain
|
||||
|
@ -78,6 +78,14 @@ echo "enable lazy firewall"
|
||||
sudo ufw --force enable
|
||||
echo ""
|
||||
|
||||
# update system
|
||||
echo ""
|
||||
echo "*** Update System ***"
|
||||
sudo apt-mark hold raspberrypi-bootloader
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -f -y --allow-change-held-packages
|
||||
echo "OK - System is now up to date"
|
||||
|
||||
# mark setup is done
|
||||
sudo sed -i "s/^setupStep=.*/setupStep=90/g" /home/admin/raspiblitz.info
|
||||
|
||||
|
@ -120,7 +120,6 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
# display will ask user to run setup
|
||||
echo "state=waitsetup" > $infoFile
|
||||
echo "message='HDD needs SetUp (1)'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -133,7 +132,6 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
echo "FAIL - not able to temp-mount HDD" >> $logFile
|
||||
echo "state=waitsetup" > $infoFile
|
||||
echo "message='HDD failed Mounting'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
# no need to unmount the HDD, it failed mounting
|
||||
exit 1
|
||||
else
|
||||
@ -148,7 +146,6 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
echo "Found existing configuration - TODO migration and recover!" >> $logFile
|
||||
echo "state=recovering" > $infoFile
|
||||
echo "message='TODO: migration and recover'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
# unmountig the HDD at the end of the process
|
||||
sudo umount -l /mnt/hdd
|
||||
exit 1
|
||||
@ -163,22 +160,23 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
echo "Found existing LND data - old RaspiBlitz?" >> $logFile
|
||||
echo "state=olddata" > $infoFile
|
||||
echo "message='No Auto-Update possible'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
# keep HDD mounted if user wants to copy data
|
||||
exit 1
|
||||
else
|
||||
echo "OK - No LND data found" >> $logFile
|
||||
fi
|
||||
|
||||
# check if HDD contains pre-loaded blockchain data (just bitcoin for now)
|
||||
# check if HDD contains pre-loaded blockchain data
|
||||
echo "Check if HDD contains pre-loaded blockchain data .." >> $logFile
|
||||
blockchainDataExists=$(ls /mnt/hdd/bitcoin/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
|
||||
if [ ${blockchainDataExists} -eq 1 ]; then
|
||||
litecoinDataExists=$(ls /mnt/hdd/litecoin/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
|
||||
bitcoinDataExists=$(ls /mnt/hdd/bitcoin/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
|
||||
|
||||
# check if node can go into presync (only for bitcoin)
|
||||
if [ ${bitcoinDataExists} -eq 1 ]; then
|
||||
|
||||
# update info file
|
||||
echo "state=presync" > $infoFile
|
||||
echo "message='starting pre-sync'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
|
||||
# activating presync
|
||||
# so that on a hackathon you can just connect a RaspiBlitz
|
||||
@ -197,15 +195,13 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
exit 1
|
||||
|
||||
else
|
||||
ls /mnt/hdd/bitcoin/blocks/blk00000.dat >> $logFile
|
||||
echo "OK - No blockchain data found" >> $logFile
|
||||
echo "OK - No bitcoin blockchain data found" >> $logFile
|
||||
fi
|
||||
|
||||
# if it got until here: HDD is empty ext4
|
||||
echo "Waiting for SetUp." >> $logFile
|
||||
echo "state=waitsetup" > $infoFile
|
||||
echo "message='HDD needs SetUp (2)'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
# unmount HDD to be ready for auto-mount during setup
|
||||
sudo umount -l /mnt/hdd
|
||||
exit 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user