hugo, don't delete the site until the clone has been validated.

This commit is contained in:
me
2026-08-14 11:35:03 -07:00
parent 5d716d8a0d
commit bbef8e2915
+9 -5
View File
@@ -18,22 +18,26 @@ typeset -u DEV
echo "DEV='$DEV'"
SITE="/var/www/hugo/site"
CLONE="/var/www/hugo/site-new"
echo "*** Creating Git Repo ***"
if [[ -d $SITE ]]; then
rm -rfv $SITE
fi
sudo -u www-data git clone --recurse-submodules $BRANCH $REPO $SITE
sudo -u www-data git clone --recurse-submodules $BRANCH $REPO $CLONE
status="$?"
echo "*** Validating Git Repo ***"
if [[ $status != 0 || ! -d $SITE/.git ]]; then
if [[ $status != 0 || ! -d $CLONE/.git ]]; then
echo "ERROR: Hugo project may not have cloned correctly. status='$status'"
echo "Aborting."
exit 1
fi
echo "* Site exists!"
echo "*** Copying Git Repo ***"
if [[ -d $SITE ]]; then
rm -rfv $SITE
fi
mv -v $CLONE $SITE
echo "*** Copying Static Files to NGINX ***"
rm -rfv /var/www/html/*
sudo -u www-data /var/www/hugo/cronjob.sh