Added a check not to backup the root directory

This commit is contained in:
2025-07-06 13:07:31 +02:00
parent be38f711b7
commit 83240a5bc4

View File

@@ -3,7 +3,10 @@
# Backup one directory
function backup_dir {
# Check if the dir to backup is mounted as a subdirectory of /root inside this container
if [ -d "/root_fs$1" ]; then
if [ "$1" = "" ]; then
echo "[ERROR] Cannot backup the root directory. Have you correctly configured the volumes to backup for this container ?"
return -1
elif [ -d "/root_fs$1" ]; then
restic backup $RESTIC_BACKUP_FLAGS /root_fs$1
return $?
else