From cd92aa3e7c942896f1cc254cddd27586bddb7157 Mon Sep 17 00:00:00 2001 From: admin666 Date: Wed, 22 Nov 2023 08:25:35 +0100 Subject: [PATCH] Check if dest already exist --- restore.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/restore.sh b/restore.sh index 948b9ff..aa7a4b4 100755 --- a/restore.sh +++ b/restore.sh @@ -75,9 +75,11 @@ mkdir -p /mnt/${vm} mkdir -p /mnt/${vm}-remote mkdir -p $(dirname ${dest}) -# Creating new disk -echo "Creating new disk..." -cp --reflink ${generic_image} ${dest} +# Creating new disk if necessary +if [ ! -e ${dest} ]; then + echo "Creating new disk..." + cp --reflink ${generic_image} ${dest} +fi # Mounting echo "Mounting devices..."