Skip to content

Commit 6b8a06f

Browse files
authored
Merge pull request #38 from Guiorgy/continue-on-chown-fail
Don't error out if chown fails and avoid manually escaping quotes
2 parents 4c5298e + 1d64d3e commit 6b8a06f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

vackup

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,12 @@ cmd_export() {
174174
FILE_NAME=$(basename "$FILE_NAME")
175175

176176
if ! docker run --rm \
177+
-e FILE_NAME="$FILE_NAME" \
178+
-e OWNER="${OWNER:-"$(id -u):$(id -g)"}" \
177179
-v "$VOLUME_NAME":/volume-data \
178180
-v "$DIRECTORY":/mount-volume \
179181
busybox \
180-
/bin/sh -c 'tar -cvzf /mount-volume/'"'$FILE_NAME'"' -C /volume-data . && chown '"'${OWNER:-"$(id -u):$(id -g)"}'"' /mount-volume/'"'$FILE_NAME'";
182+
/bin/sh -c 'tar -cvzf /mount-volume/"$FILE_NAME" -C /volume-data . && (chown "$OWNER" /mount-volume/"$FILE_NAME" || echo 1>&2 "Warning: Failed to change ownership of the $FILE_NAME file")';
181183
then
182184
error 'Failed to start busybox backup container'
183185
fi

0 commit comments

Comments
 (0)