From e20a24a9caa84caca82ac51156bf404ae0daa19d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 9 Jun 2018 10:10:01 +0100 Subject: [PATCH] Try to prevent any collisions between upgrades and letsencrypt certificate updates --- src/freedombone-utils-git | 3 +++ src/freedombone-utils-web | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/freedombone-utils-git b/src/freedombone-utils-git index 558066ee..398d2e78 100755 --- a/src/freedombone-utils-git +++ b/src/freedombone-utils-git @@ -50,6 +50,9 @@ function git_pull { git branch -D "$2" # check out the new branch if ! git checkout "$2" -b "$2"; then + if [ -f /tmp/.upgrading ]; then + rm /tmp/.upgrading + fi echo $"Unable to checkout $1 $2" exit 72357 fi diff --git a/src/freedombone-utils-web b/src/freedombone-utils-web index 20a4b875..ac45b0b8 100755 --- a/src/freedombone-utils-web +++ b/src/freedombone-utils-web @@ -364,6 +364,10 @@ function letsencrypt_renewals { # a secondary script keeps trying to renew after a failure { echo '#!/bin/bash'; + echo ''; + echo 'if [ -f /tmp/.upgrading ]; then'; + echo ' exit 0'; + echo 'fi'; echo ''; echo "PROJECT_NAME='${PROJECT_NAME}'"; echo "COMPLETION_FILE=\$HOME/\${PROJECT_NAME}-completed.txt"; @@ -377,6 +381,11 @@ function letsencrypt_renewals { echo "}')"; echo " ADMIN_EMAIL_ADDRESS=\$ADMIN_USERNAME@\$HOSTNAME"; echo ' for d in /etc/letsencrypt/live/*/ ; do'; + echo ''; + echo ' if [ -f /tmp/.upgrading ]; then'; + echo ' exit 0'; + echo ' fi'; + echo ''; echo -n " LETSENCRYPT_DOMAIN=\$(echo \"\$d\" | "; echo -n "awk -F '/' '{print "; echo -n "\$5";