mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 22:58:43 +01:00
commit
aaed704014
3 changed files with 27 additions and 19 deletions
|
@ -155,9 +155,9 @@ waitUntilChainNetworkIsReady()
|
|||
minSize=20000000000
|
||||
fi
|
||||
blockchainsize=$(sudo du -shbc /mnt/hdd/${network} | head -n1 | awk '{print $1;}')
|
||||
echo "blockchainsize(${blockchainsize})"
|
||||
if [ ${#blockchainsize} -gt 0 ]; then
|
||||
if [ ${blockchainsize} -lt ${minSize} ]; then
|
||||
echo "blockchainsize(${blockchainsize})"
|
||||
echo "Missing Blockchain Data (<${minSize}) ..."
|
||||
clienterror="missing blockchain"
|
||||
sleep 3
|
||||
|
|
|
@ -20,15 +20,6 @@ case $CHOICE in
|
|||
*) exit 1;;
|
||||
esac
|
||||
|
||||
if [ -d "/mnt/hdd/bitcoin" ]; then
|
||||
dialog --title "Prepare Copy" --yesno "Do you want to delete the old/local blockchain data now?" 8 60
|
||||
response=$?
|
||||
echo "response(${response})"
|
||||
case $response in
|
||||
1) exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# additional prep if this is used to replace corrupted blockchain
|
||||
if [ "${setupStep}" = "100" ]; then
|
||||
# make sure services are not running
|
||||
|
@ -38,12 +29,24 @@ if [ "${setupStep}" = "100" ]; then
|
|||
sudo cp -f /mnt/hdd/bitcoin/bitcoin.conf /home/admin/assets/bitcoin.conf
|
||||
fi
|
||||
|
||||
# delete all IN bitcoin directory but not itself if it exists
|
||||
# so that possibel link to /home/bitcoin/.bitcoin nicht beschädigt wird
|
||||
# also keep debug logs for repair script
|
||||
sudo mv /mnt/hdd/bitcoin/debug.log /home/admin/debug.log 2>/dev/null
|
||||
sudo rm -rfv /mnt/hdd/bitcoin/* 2>/dev/null
|
||||
sudo mv /home/admin/debug.log /mnt/hdd/bitcoin/debug.log 2>/dev/null
|
||||
if [ -d "/mnt/hdd/bitcoin" ]; then
|
||||
dialog --title "Fresh or Repair" --yesno "Do you want to delete the old/local blockchain data now?" 8 60
|
||||
response=$?
|
||||
echo "response(${response})"
|
||||
if [ "${response}" = "1" ]; then
|
||||
echo "OK - keep old blockchain - just try to repair by copying over it"
|
||||
sleep 3
|
||||
else
|
||||
echo "OK - delete old blockchain"
|
||||
# delete all IN bitcoin directory but not itself if it exists
|
||||
# so that possibel link to /home/bitcoin/.bitcoin nicht beschädigt wird
|
||||
# also keep debug logs for repair script
|
||||
sudo mv /mnt/hdd/bitcoin/debug.log /home/admin/debug.log 2>/dev/null
|
||||
sudo rm -rfv /mnt/hdd/bitcoin/* 2>/dev/null
|
||||
sudo mv /home/admin/debug.log /mnt/hdd/bitcoin/debug.log 2>/dev/null
|
||||
sleep 3
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure /mnt/hdd/bitcoin exists
|
||||
sudo mkdir /mnt/hdd/bitcoin 2>/dev/null
|
||||
|
@ -143,15 +146,17 @@ echo "*********************************************"
|
|||
# if started after intial setup - quit here
|
||||
if [ "${setupStep}" = "100" ]; then
|
||||
sudo cp /home/admin/assets/bitcoin.conf /mnt/hdd/bitcoin/bitcoin.conf
|
||||
rpcpass=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep 'bitcoind.rpcpass' | cut -d "=" -f2)
|
||||
sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin/bitcoin.conf
|
||||
sudo sed -i "s/^rpcpassword=.*/rpcpassword=${rpcpass}/g" /mnt/hdd/bitcoin/bitcoin.conf 2>/dev/null
|
||||
sudo systemctl enable bitcoind
|
||||
echo "DONE - reboot is needed: sudo shutdown -r now"
|
||||
echo "DONE - rebooting: sudo shutdown -r now"
|
||||
sudo shutdown -r now
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# REACT ON QUICK CHECK DURING INITAL SETUP
|
||||
|
||||
|
||||
if [ ${quickCheckOK} -eq 0 ]; then
|
||||
|
||||
echo "*********************************************"
|
||||
|
|
|
@ -288,9 +288,12 @@ date +%s
|
|||
|
||||
if [ "${setupStep}" = "100" ]; then
|
||||
sudo cp /home/admin/assets/${network}.conf /mnt/hdd/${network}/${network}.conf
|
||||
rpcpass=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "${network}d.rpcpass" | cut -d "=" -f2)
|
||||
sudo sed -i "s/^rpcpassword=.*/rpcpassword=${rpcpass}/g" /mnt/hdd/${network}/${network}.conf 2>/dev/null
|
||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/${network}/
|
||||
sudo systemctl enable ${network}d
|
||||
echo "DONE - reboot needed: sudo shutdown -r now"
|
||||
echo "DONE - rebooting: sudo shutdown -r now"
|
||||
sudo shutdown -r now
|
||||
else
|
||||
# set SetupState
|
||||
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
|
||||
|
|
Loading…
Add table
Reference in a new issue