From b9da9c74c4639fd6c5d0e2ae6f61344aa6df8812 Mon Sep 17 00:00:00 2001 From: redxef Date: Tue, 30 Aug 2022 22:44:12 +0200 Subject: [PATCH] Add possibility to create volumes implicitly. --- dvbackup.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dvbackup.sh b/dvbackup.sh index 7d70dac..5551ed1 100755 --- a/dvbackup.sh +++ b/dvbackup.sh @@ -67,8 +67,12 @@ restore_all() { volume_name="${tarball%.tar}" echo "$volume_name -> $volume" if ! "$DOCKER" volume inspect "$volume_name" 1>&2 2>/dev/null; then - echo "Error: no such volume $volume_name" >&2 - exit 4 + if echo "$DVB_CREATE_VOLUME" | grep -Eiq 't|true|1|y|yes'; then + "$DOCKER" volume create "$volume_name" + else + echo "Error: no such volume $volume_name" >&2 + exit 4 + fi fi restore "$tarball" "$volume_name" done