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

allow passing only volume name to export/import #19

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
15 changes: 12 additions & 3 deletions vackup
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ cmd_export() {
VOLUME_NAME="$2"
FILE_NAME="$3"

if [ -z "$VOLUME_NAME" ] || [ -z "$FILE_NAME" ]; then
if [ -z "$VOLUME_NAME" ] ; then
echo "Error: Not enough arguments"
usage
exit 1
fi


if [ -z "$FILE_NAME" ]; then
FILE_NAME="$VOLUME_NAME.tar.gz"
fi

if ! docker volume inspect --format '{{.Name}}' "$VOLUME_NAME";
then
echo "Error: Volume $VOLUME_NAME does not exist"
Expand Down Expand Up @@ -86,12 +90,17 @@ cmd_import() {
FILE_NAME="$2"
VOLUME_NAME="$3"

if [ -z "$VOLUME_NAME" ] || [ -z "$FILE_NAME" ]; then
if [ -z "$FILE_NAME" ]; then
echo "Error: Not enough arguments"
usage
exit 1
fi

if [ -z "$VOLUME_NAME" ]; then
VOLUME_NAME="$FILE_NAME"
FILE_NAME="$VOLUME_NAME.tar.gz"
fi

if ! docker volume inspect --format '{{.Name}}' "$VOLUME_NAME";
then
echo "Error: Volume $VOLUME_NAME does not exist"
Expand Down