upload migration file

This commit is contained in:
rootzoll 2021-05-02 01:35:28 +02:00
parent c4ca800723
commit d7813ff86f
2 changed files with 52 additions and 46 deletions

View file

@ -49,54 +49,60 @@ if [ "${migrationOS}" == "raspiblitz" ]; then
echo "migrationVersion='${migrationVersion}'" >> $SETUPFILE echo "migrationVersion='${migrationVersion}'" >> $SETUPFILE
# get defaultUploadPath, localIP, etc # get defaultUploadPath, localIP, etc
source <(sudo /home/admin/config.scripts/blitz.migration.sh status) source <(sudo /home/admin/config.scripts/blitz.upload.sh prepare-upload)
# make sure that temp directory exists, is clear and can be written by user bitcoin filename=""
sudo mkdir -p ${defaultUploadPath} 2>/dev/null while [ "${filename}" == "" ]
sudo rm /mnt/hdd/temp/migration/* 2>/dev/null do
sudo chown -R bitcoin:bitcoin ${defaultUploadPath} 2>/dev/null
# scp upload info clear
clear echo "*****************************"
echo echo "* UPLOAD THE MIGRATION FILE *"
echo "*****************************" echo "*****************************"
echo "* UPLOAD THE MIGRATION FILE *" echo "If you have a migration file on your laptop you can now"
echo "*****************************" echo "upload it and restore on the new HDD/SSD."
echo "If you have a migration file on your laptop you can now" echo
echo "upload it and restore on the new HDD/SSD." echo "ON YOUR LAPTOP open a new terminal and change into"
echo echo "the directory where your migration file is and"
echo "ON YOUR LAPTOP open a new terminal and change into" echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
echo "the directory where your migration file is and" echo "scp -r ./raspiblitz-*.tar.gz ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:" echo ""
echo "scp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultUploadPath}" echo "Use password 'raspiblitz' to authenticate file transfer."
echo "" echo "PRESS ENTER when upload is done."
echo "Use password 'raspiblitz' to authenticate file transfer." read key
echo "PRESS ENTER when upload is done."
read key
countZips=$(sudo ls ${defaultUploadPath}/raspiblitz-*.tar.gz 2>/dev/null | grep -c 'raspiblitz-') # check upload (will return filename or error)
source <(sudo /home/admin/config.scripts/blitz.upload.sh check-upload migration)
# in case no upload found if [ "${filename}" != "" ]; then
if [ ${countZips} -eq 0 ]; then echo "OK - File found: ${filename}"
echo "FAIL: Was not able to detect uploaded file in ${defaultUploadPath}" echo "PRESS ENTER to continue."
echo "Shutting down ... please make a fresh sd card & try again." read key
sleep 3 elif [ "${error}" == "not-found" ]; then
echo "shutdown=1" >> $SETUPFILE echo "!! WARNING !!"
exit 1 echo "There was no upload found in ${defaultUploadPath}"
fi echo "Make sure you upload only one tar.gz-file and start again."
echo "PRESS ENTER to continue & retry"
# in case of multiple files read key
if [ ${countZips} -gt 1 ]; then elif [ "${error}" == "multiple" ]; then
echo "# FAIL: Multiple possible files detected in ${defaultUploadPath}" echo "!! WARNING !!"
echo "Shutting down ... please make a fresh sd card & try again." echo "There are multiple lnd-rescue files in directory ${defaultUploadPath}"
sleep 3 echo "Make sure you upload only one tar.gz-file and start again."
echo "shutdown=1" >> $SETUPFILE echo "PRESS ENTER to continue & retry"
exit 1 read key
fi elif [ "${error}" == "invalid" ]; then
echo "!! WARNING !!"
echo "The file uploaded is not a valid (complete upload failed or not correct file)."
echo "PRESS ENTER to continue & retry"
read key
else
echo "!! WARNING !! Unknown State (report to devs)"
exit 1
fi
done
# further checks and unpacking will be done when migration is processed (not part of dialog) # further checks and unpacking will be done when migration is processed (not part of dialog)
echo "OK: Migration data was imported - will process after password reset" echo "OK: Migration data was imported - will process after password reset"
echo "migrationFile='${defaultUploadPath}'" >> $SETUPFILE echo "migrationFile='${filename}'" >> $SETUPFILE
sleep 4 sleep 4
# user needs to reset password A # user needs to reset password A

View file

@ -231,7 +231,7 @@ password=$(sudo cat $_temp)
echo "passwordC='${password}'" >> $SETUPFILE echo "passwordC='${password}'" >> $SETUPFILE
dialog --backtitle "RaspiBlitz - Setup" --msgbox "\n Password C set" 7 20 dialog --backtitle "RaspiBlitz - Setup" --msgbox "\n Password C set" 7 20
echo "TODO: continue with further "
exit 1
clear clear
echo "# setup dialog done - results in:"
echo "# $CONFIGFILE"
echo "# $SETUPFILE"