Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print error and exit if file can't be opened during import #20

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions vackup
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down