Update restore.sh

Improved CHECK_INPUT_PARAM function a bit.
pull/29/head
rcoemans 2020-08-21 15:23:24 +02:00 committed by GitHub
parent 8633b49886
commit 6885244529
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -59,17 +59,17 @@ PUSHOVER_DEVICE="{your-device}" # Multiple devices may be separated by a comma
# **************************************************************************************************** # ****************************************************************************************************
function CHECK_INPUT_PARAM() { function CHECK_INPUT_PARAM() {
if [ "$1" == "" ]; then if [ $# -lt 1 ]; then
echo "Please specify the backup.zip file to be restored (e.g. "bash ./restore.sh /tmp/1-20200101-SharkJack-backup.zip")." echo "Please specify the backup.zip file to be restored (e.g. "bash $0 /tmp/1-20200101-SharkJack-backup.zip")."
exit exit
elif [ ! -f "$1" ]; then elif [ ! -f "$1" ]; then
echo "$1 is not an existing file, please specify a backup.zip file to be restored (e.g. "bash ./restore.sh /tmp/1-20200101-SharkJack-backup.zip")." echo "$1 is not an existing file, please specify a backup.zip file to be restored (e.g. "bash $0 /tmp/1-20200101-SharkJack-backup.zip")."
exit exit
elif [ "${1##*.}" == "zip" ]; then elif [ "${1##*.}" == "zip" ]; then
BACKUP_FILENAME=$(basename $1) BACKUP_FILENAME=$(basename $1)
BACKUP_FILENAME=${BACKUP_FILENAME%.*} BACKUP_FILENAME=${BACKUP_FILENAME%.*}
else else
echo "$1 is not an zip file, please specify a backup.zip file to be restored (e.g. "bash ./restore.sh /tmp/1-20200101-SharkJack-backup.zip")." echo "$1 is not an zip file, please specify a backup.zip file to be restored (e.g. "bash $0 /tmp/1-20200101-SharkJack-backup.zip")."
exit exit
fi fi
return return