diff --git a/vackup b/vackup old mode 100755 new mode 100644 index 168a963..2e17404 --- a/vackup +++ b/vackup @@ -91,15 +91,23 @@ cmd_import() { usage exit 1 fi - + + if [ ! -r "$FILE_NAME" ]; then + echo "Error: Could not find or open tar file $FILE_NAME" + exit 1 + fi + + if [ -d "$FILE_NAME" ]; then + echo "Error: $FILE_NAME is a directory" + exit 1 + fi + if ! docker volume inspect --format '{{.Name}}' "$VOLUME_NAME"; then echo "Error: Volume $VOLUME_NAME does not exist" docker volume create "$VOLUME_NAME" fi -# TODO: check if file exists on host, if it does -# create a option for overwrite and check if that's set # TODO: if FILE_NAME starts with / we need to error out # unless we can translate full file paths