From 497950f4e453487e08e1332fc4ada7ea019ceddd Mon Sep 17 00:00:00 2001 From: Alexander Holzapfel Date: Sat, 31 Jul 2021 00:21:15 +0200 Subject: [PATCH] Add pre and post update hook (#4099) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add pre and post update hook * Update update.sh Co-authored-by: André Peters --- update.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/update.sh b/update.sh index db47ceca..863fb248 100755 --- a/update.sh +++ b/update.sh @@ -6,6 +6,13 @@ if [ "$(id -u)" -ne "0" ]; then exit 1 fi +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Run pre-update-hook +if [ -f "${SCRIPT_DIR}/pre_update_hook.sh" ]; then + bash "${SCRIPT_DIR}/pre_update_hook.sh" +fi + if [[ "$(uname -r)" =~ ^4\.15\.0-60 ]]; then echo "DO NOT RUN mailcow ON THIS UBUNTU KERNEL!"; echo "Please update to 5.x or use another distribution." @@ -691,6 +698,11 @@ fi echo -e "\e[32mCollecting garbage...\e[0m" docker_garbage +# Run post-update-hook +if [ -f "${SCRIPT_DIR}/post_update_hook.sh" ]; then + bash "${SCRIPT_DIR}/post_update_hook.sh" +fi + #echo "In case you encounter any problem, hard-reset to a state before updating mailcow:" #echo #git reflog --color=always | grep "Before update on "