#902 blockchain data after migration import

This commit is contained in:
rootzoll 2020-02-15 23:29:07 +01:00
parent f103f3fc5b
commit cd1519f95c
2 changed files with 47 additions and 4 deletions

View File

@ -134,6 +134,17 @@ else
fi
echo "*********************************************"
# if started with parameter "stop-after-script" - quit here
if [ "$1" == "stop-after-script" ]; then
if [ ${quickCheckOK} -eq 0 ]; then
echo "cleaning up .."
sudo rm -rf /mnt/hdd/bitcoin/blocks
sudo rm -rf /mnt/hdd/bitcoin/chainstate
fi
echo "DONE Copy"
exit 0
fi
# if started after intial setup - quit here
if [ "${setupStep}" = "100" ]; then
sudo cp /home/admin/assets/bitcoin.conf /mnt/hdd/bitcoin/bitcoin.conf

View File

@ -350,13 +350,45 @@ if [ "$1" = "import-gui" ]; then
echo
echo "FAIL: Was not able to restore data --> ${error}"
exit 1
else
fi
# check & load config
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
echo
echo "OK: Migration data was imported"
echo "--> Now rebooting and kicking your node in to recovery/update mode ..."
sudo shutdown -r now
echo "FAIL: No raspiblitz.conf found afer migration restore"
exit 1
fi
echo
echo "OK: Migration data was imported"
# Copy from other computer is only option for Bitcoin
if [ "${network}" == "bitcoin" ]; then
OPTIONS=(SYNC "Re-Sync & Validate Blockchain" \
COPY "Copy over LAN from other Computer"
)
CHOICE=$(whiptail --clear --title "How to get Blockchain?" --menu "" 9 52 2 "${OPTIONS[@]}" 2>&1 >/dev/tty)
clear
case $CHOICE in
COPY)
echo "Copy Blockchain Data -->"
/home/admin/50copyHDD.sh stop-after-script
;;
esac
fi
# if there is no blockchain yet - fallback to syncing
if [ $(sudo ls /mnt/hdd/bitcoin/ | grep -c blocks) -eq 0 ]; then
echo "Sync Blockchain Data -->"
sudo mkdir /mnt/hdd/${network} 2>/dev/null
sudo -u bitcoin mkdir /mnt/hdd/${network}/blocks 2>/dev/null
sudo -u bitcoin mkdir /mnt/hdd/${network}/chainstate 2>/dev/null
sudo touch /mnt/hdd/${network}/blocks/.selfsync
fi
echo "--> Now rebooting and kicking your node in to recovery/update mode ..."
sudo shutdown -r now
exit 0
fi