Browse Source

Add pre and post update hook (#4099)

* Add pre and post update hook

* Update update.sh

Co-authored-by: André Peters <andre.peters@debinux.de>
Alexander Holzapfel 4 years ago
parent
commit
497950f4e4
1 changed files with 12 additions and 0 deletions
  1. 12 0
      update.sh

+ 12 - 0
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 "