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,16 +49,13 @@ 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 "*****************************"
echo "* UPLOAD THE MIGRATION FILE *" echo "* UPLOAD THE MIGRATION FILE *"
echo "*****************************" echo "*****************************"
@ -68,35 +65,44 @@ if [ "${migrationOS}" == "raspiblitz" ]; then
echo "ON YOUR LAPTOP open a new terminal and change into" echo "ON YOUR LAPTOP open a new terminal and change into"
echo "the directory where your migration file is and" echo "the directory where your migration file is and"
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:" echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
echo "scp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultUploadPath}" echo "scp -r ./raspiblitz-*.tar.gz ${defaultUploadUser}@${localip}:${defaultUploadPath}/"
echo "" echo ""
echo "Use password 'raspiblitz' to authenticate file transfer." echo "Use password 'raspiblitz' to authenticate file transfer."
echo "PRESS ENTER when upload is done." echo "PRESS ENTER when upload is done."
read key 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"
read key
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 exit 1
fi 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"