Skip to content

Commit d6b0c71

Browse files
committed
import now checks if file exists
1 parent d129222 commit d6b0c71

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

vackup

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,16 @@ cmd_import() {
9898
docker volume create "$VOLUME_NAME"
9999
fi
100100

101-
# TODO: check if file exists on host, if it does
102-
# create a option for overwrite and check if that's set
101+
if [ ! -r "$FILE_NAME" ]; then
102+
echo "Error: Could not find or open tar file $FILE_NAME"
103+
exit 1
104+
fi
105+
106+
if [ -d "$FILE_NAME" ]; then
107+
echo "Error: $FILE_NAME is a directory"
108+
exit 1
109+
fi
110+
103111
# TODO: if FILE_NAME starts with / we need to error out
104112
# unless we can translate full file paths
105113

0 commit comments

Comments
 (0)