dont delete linked directory anymore

This commit is contained in:
rootzoll
2019-02-15 23:19:43 +01:00
parent e95f2647a7
commit 7b163d57a6

View File

@@ -17,28 +17,15 @@ if [ "${setupStep}" = "100" ]; then
sudo systemctl stop bitcoind sudo systemctl stop bitcoind
fi fi
# delete all IN bitcoin directory but not itself if it exists
# so that possibel link to /home/bitcoin/.bitcoin nicht beschädigt wird
sudo rm -rfv /mnt/hdd/bitcoin/* 2>/dev/null
# create bitcoin base directory and link with bitcoin user # make sure /mnt/hdd/bitcoin exists
echo "delete and create new blockchain directory ..." sudo mkdir /mnt/hdd/bitcoin 2>/dev/null
sudo rm -rf /mnt/hdd/bitcoin 2>/dev/null
sudo rm -rf /home/bitcoin/.bitcoin 2>/dev/null
sudo mkdir /mnt/hdd/bitcoin
sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin
sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin
# check setup # allow all users write to it ()
echo "checking setup ..." sudo chmod 777 /mnt/hdd/bitcoin
sudo touch /home/bitcoin/.bitcoin/test.txt
createdCorerct=$(sudo ls /mnt/hdd/bitcoin/test.txt | grep -c 'test.txt')
sudo rm /home/bitcoin/.bitcoin/test.txt
if [ ${createdCorerct} -eq 0 ]; then
sudo rm -rf /mnt/hdd/bitcoin
sudo rm -rf /home/bitcoin/.bitcoin
echo "FAILED: sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin"
echo "Press ENTER to get back to menu ..."
read key
exit 1
fi
clear clear
echo "************************************************************************************" echo "************************************************************************************"
@@ -56,7 +43,7 @@ echo "blockchain data. You should see directories 'blocks', 'chainstate' & 'inde
echo "Make sure the bitcoin client on that computer is stopped." echo "Make sure the bitcoin client on that computer is stopped."
echo "" echo ""
echo "COPY, PASTE & EXECUTE the following command on the blockchain source computer:" echo "COPY, PASTE & EXECUTE the following command on the blockchain source computer:"
echo "sudo scp -r ./chainstate ./indexes ./testnet3 ./blocks bitcoin@${localip}:/home/bitcoin/.bitcoin" echo "sudo scp -r ./chainstate ./indexes ./testnet3 ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
echo "" echo ""
echo "This command may ask you first about the admin password of the other computer (because sudo)." echo "This command may ask you first about the admin password of the other computer (because sudo)."
echo "Then it will ask for your SSH PASSWORD A from this RaspiBlitz." echo "Then it will ask for your SSH PASSWORD A from this RaspiBlitz."
@@ -100,13 +87,46 @@ if [ ${count} -lt 1500 ]; then
quickCheckOK=0 quickCheckOK=0
fi fi
echo "*********************************************"
echo "QUICK CHECK RESULT"
echo "*********************************************"
# just if any data transferred .. # just if any data transferred ..
if [ ${anyDataAtAll} -eq 1 ]; then if [ ${anyDataAtAll} -eq 1 ]; then
# data was invalid - ask user to keep? # data was invalid - ask user to keep?
if [ ${quickCheckOK} -eq 0 ]; then if [ ${quickCheckOK} -eq 0 ]; then
echo "FAIL -> DATA seems incomplete."
else
echo "OK -> DATA LOOKS GOOD :D"
fi
else
echo "CANCEL -> NO DATA was copied."
quickCheckOK=0
fi
echo "*********************************************"
# if started after intial setup - quit here
if [ "${setupStep}" = "100" ]; then
"DONE - reboot is needed: sudo shutdown -r now"
exit 0
fi
# REACT ON QUICK CHECK DURING INITAL SETUP
if [ ${quickCheckOK} -eq 0 ]; then
echo "*********************************************" echo "*********************************************"
echo "There seems to be an invalid transfer." echo "There seems to be an invalid transfer."
echo "Wait 5 secs ..." echo "Wait 5 secs ..."
sleep 5 sleep 5
dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data data?" 8 60 dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data data?" 8 60
@@ -115,27 +135,14 @@ if [ ${anyDataAtAll} -eq 1 ]; then
case $response in case $response in
1) quickCheckOK=1 ;; 1) quickCheckOK=1 ;;
esac esac
fi
if [ ${quickCheckOK} -eq 0 ]; then
echo "Deleting invalid Data ..."
sudo rm -rf /mnt/hdd/bitcoin
sudo rm -rf /home/bitcoin/.bitcoin
sleep 2
fi
else
echo "back to menu ..."
# when no data transferred - just delete bitcoin base dir again
sudo rm -rf /mnt/hdd/bitcoin
sleep 2
fi fi
if [ ${setupStep} -lt 100 ]; then if [ ${quickCheckOK} -eq 0 ]; then
# setup script will decide the next logical step echo "Deleting invalid Data ... "
/home/admin/10setupBlitz.sh sudo rm -rf /mnt/hdd/bitcoin
else sleep 2
"DONE - reboot is needed: sudo shutdown -r now"
fi fi
# setup script will decide the next logical step
/home/admin/10setupBlitz.sh