From a5876486dd7ea1b06d0f6f5abe8122c74c15a0ba Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Mon, 16 Feb 2026 18:29:04 +0100 Subject: [PATCH] backupscript: improve detection of invalid configuration.json files Signed-off-by: Simon L. --- Containers/borgbackup/backupscript.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Containers/borgbackup/backupscript.sh b/Containers/borgbackup/backupscript.sh index b7b96147..e0c7ae8a 100644 --- a/Containers/borgbackup/backupscript.sh +++ b/Containers/borgbackup/backupscript.sh @@ -77,6 +77,10 @@ if [ "$BORG_MODE" = backup ]; then if ! [ -f "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json" ]; then echo "configuration.json not present. Cannot perform the backup!" exit 1 + elif ! grep -q '"domain"' "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json" \ + || ! grep -q '"wasStartButtonClicked"' "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json"; then + echo "It seems like the configuration.json setup was not done correctly. Something is wrong! (Most likely the provided configuration.json is invalid)" + exit 1 elif ! [ -f "/nextcloud_aio_volumes/nextcloud_aio_nextcloud/config/config.php" ]; then echo "config.php is missing. Cannot perform backup!" exit 1 @@ -514,6 +518,10 @@ if [ "$BORG_MODE" = restore ]; then if [ "$RESTORE_FAILED" = 1 ]; then exit 1 + elif ! grep -q '"domain"' "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json" \ + || ! grep -q '"wasStartButtonClicked"' "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json"; then + echo "It seems like the restore of the configuration.json was not done correctly. Something is wrong! (Most likely is the restore archive already incorrect)!" + exit 1 fi # Inform user