mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 14:51:03 +01:00
add migration export gui
This commit is contained in:
parent
11a19ba375
commit
4098e71a43
3 changed files with 99 additions and 10 deletions
|
@ -78,7 +78,7 @@ case $CHOICE in
|
|||
/home/admin/00mainMenu.sh
|
||||
;;
|
||||
BACKUP-HDD)
|
||||
sudo /home/admin/config.scripts/blitz.migration.sh "export"
|
||||
sudo /home/admin/config.scripts/blitz.migration.sh "export-gui"
|
||||
echo "Press ENTER to return to main menu."
|
||||
read key
|
||||
/home/admin/00mainMenu.sh
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "# managing the RaspiBlitz data - import, export, backup."
|
||||
echo "# blitz.migration.sh [status|export|import]"
|
||||
echo "# blitz.migration.sh [status|export|import|export-gui|import-gui]"
|
||||
echo "error='missing parameters'"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -110,8 +110,7 @@ if [ "$1" = "export" ]; then
|
|||
name="raspiblitz${blitzname}${datestamp}-${md5checksum}.tar.gz"
|
||||
echo "exportpath='${defaultZipPath}'"
|
||||
echo "filename='${name}'"
|
||||
sudo ${defaultZipPath}/raspiblitz-export-temp.tar.gz
|
||||
mv ${defaultZipPath}/raspiblitz-export-temp.tar.gz ${defaultZipPath}/${name}
|
||||
sudo mv ${defaultZipPath}/raspiblitz-export-temp.tar.gz ${defaultZipPath}/${name}
|
||||
sudo chown bitcoin:bitcoin ${defaultZipPath}/${name}
|
||||
|
||||
# delete temp files
|
||||
|
@ -123,6 +122,39 @@ if [ "$1" = "export" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "export-gui" ]; then
|
||||
|
||||
# cleaning old migration files from blitz
|
||||
sudo rm ${defaultZipPath}/*.tar.gz
|
||||
|
||||
# create new migration file
|
||||
clear
|
||||
echo "--> creating blitz migration file ... (please wait)"
|
||||
source <(sudo /home/admin/config.scripts/blitz.migration.sh "export")
|
||||
if [ ${#filename} -eq 0 ]; then
|
||||
echo "# FAIL: was not able to create migration file"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# show info for migration
|
||||
echo
|
||||
echo "*******************************"
|
||||
echo "* DOWNLOAD THE MIGRATION FILE *"
|
||||
echo "*******************************"
|
||||
echo
|
||||
echo "ON YOUR LAPTOP - RUN IN NEW TERMINAL:"
|
||||
echo "${scpDownload}"
|
||||
echo ""
|
||||
echo "Use password A to authenticate file transfere."
|
||||
echo
|
||||
echo "BEWARE: Your Lightning node is now stopped. So its safe to backup the data and restore it"
|
||||
echo "later on - for example on a fresh RaspiBlitz. But once this Lightning node gets started"
|
||||
echo "again by 'sudo systemctl start lnd' or a reboot its not adviced to restore the backup file"
|
||||
echo "anymore because it cointains outdated channel data and can lead to loss of channel funds."
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#########################
|
||||
# IMPORT RaspiBlitz Data
|
||||
#########################
|
||||
|
@ -213,5 +245,62 @@ if [ "$1" = "import" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "import-gui" ]; then
|
||||
|
||||
# cleaning old migration files from blitz
|
||||
sudo rm ${defaultZipPath}/*.tar.gz
|
||||
|
||||
# make sure that temp directory exists and can be written by admin
|
||||
sudo mkdir -p ${defaultZipPath}
|
||||
chmod 777 -R ${defaultZipPath}
|
||||
|
||||
echo "**************************"
|
||||
echo "* UPLOAD THE RESCUE FILE *"
|
||||
echo "**************************"
|
||||
echo "If you have a lnd-rescue backup file on your laptop you can now"
|
||||
echo "upload it and restore the your latest LND state."
|
||||
echo
|
||||
echo "ON YOUR LAPTOP open a new terminal and change into"
|
||||
echo "the directory where your migration file is and"
|
||||
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
|
||||
echo "scp -r ./raspiblitz-*.tar.gz admin@${localip}:${defaultZipPath}"
|
||||
echo ""
|
||||
echo "Use password A to authenticate file transfere."
|
||||
echo "PRESS ENTER when upload is done."
|
||||
read key
|
||||
|
||||
countZips=$(sudo ls ${defaultZipPath}/raspiblitz-*.tar.gz 2>/dev/null | grep -c 'raspiblitz-')
|
||||
|
||||
# in case no upload found
|
||||
if [ ${countZips} -eq 0 ]; then
|
||||
echo
|
||||
echo "FAIL: Was not able to detect uploaded file in ${defaultZipPath}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# in case of multiple files
|
||||
if [ ${countZips} -gt 1 ]; then
|
||||
echo
|
||||
echo "FAIL: Multiple possible files detected in ${defaultZipPath}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# restore upload
|
||||
echo
|
||||
echo "OK: Upload found in ${defaultZipPath} - restoring data ... (please wait)"
|
||||
source <(sudo /home/admin/config.scripts/blitz.migration.sh "import")
|
||||
|
||||
# check result
|
||||
echo
|
||||
if [ ${#error} -gt 0 ]; then
|
||||
echo "FAIL: Was not able to restore data --> ${error}"
|
||||
else
|
||||
echo "OK: Migration data was imported"
|
||||
echo "You may need to redownload/validate/build blockchain data & indexes."
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "error='unkown command'"
|
||||
exit 1
|
|
@ -54,11 +54,11 @@ if [ ${mode} = "backup" ]; then
|
|||
# offer SCP for download
|
||||
clear
|
||||
echo
|
||||
echo "****************************"
|
||||
echo "* DOWNLOAD THE BACKUP FILE *"
|
||||
echo "****************************"
|
||||
echo "*****************************"
|
||||
echo "* DOWNLOAD THE REASCUE FILE *"
|
||||
echo "*****************************"
|
||||
echo
|
||||
echo "RUN THE FOLLOWING COMMAND ON YOUR LAPTOP IN NEW TERMINAL:"
|
||||
echo "ON YOUR LAPTOP - RUN IN NEW TERMINAL:"
|
||||
echo "scp -r 'admin@${localip}:/home/admin/lnd-rescue-*.tar.gz' ./"
|
||||
echo ""
|
||||
echo "Use password A to authenticate file transfere."
|
||||
|
@ -86,7 +86,7 @@ elif [ ${mode} = "restore" ]; then
|
|||
countZips=$(sudo ls /home/admin/lnd-rescue-*.tar.gz 2>/dev/null | grep -c 'lnd-rescue')
|
||||
if [ ${countZips} -lt 1 ]; then
|
||||
echo "**************************"
|
||||
echo "* UPLOAD THE BACKUP FILE *"
|
||||
echo "* UPLOAD THE RESCUE FILE *"
|
||||
echo "**************************"
|
||||
echo "If you have a lnd-rescue backup file on your laptop you can now"
|
||||
echo "upload it and restore the your latest LND state."
|
||||
|
@ -99,7 +99,7 @@ elif [ ${mode} = "restore" ]; then
|
|||
echo "scp -r ./lnd-rescue-*.tar.gz admin@${localip}:/home/admin/"
|
||||
echo ""
|
||||
echo "Use password A to authenticate file transfere."
|
||||
echo "PRESS ENTER when upload is done. Enter x & ENTER to cancel."
|
||||
echo "PRESS ENTER when upload is done."
|
||||
fi
|
||||
if [ ${countZips} -gt 1 ]; then
|
||||
echo "!! WARNING !!"
|
||||
|
|
Loading…
Add table
Reference in a new issue