From dbb54b6f81e459871017ff35215c547fbf7a9c15 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sun, 17 Aug 2025 09:01:24 -0700 Subject: [PATCH] Do not continue if the git repo does not exist. --- Config/HugoExample/files/main.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Config/HugoExample/files/main.sh b/Config/HugoExample/files/main.sh index 75bad27..7a78f39 100644 --- a/Config/HugoExample/files/main.sh +++ b/Config/HugoExample/files/main.sh @@ -13,6 +13,14 @@ echo "DEV=$DEV" echo "*** Creating Git Repo ***" sudo -u hugo git clone --recurse-submodules $REPO /var/www/hugo/site +status="$?" + +echo "*** Validating Git Repo ***" +if [[ $status != 0 || ! -d /var/www/hugo/site/.git ]]; then + echo "ERROR: Hugo project may not have cloned correctly. status='$status'" + echo "Aborting." + exit 1 +fi echo "*** Copying Static Files to NGINX ***" sudo -u hugo /var/www/hugo/cronjob.sh