]> git.proxmox.com Git - pmg-api.git/blobdiff - debian/postinst
restart postfix after first installing pmg-api
[pmg-api.git] / debian / postinst
index 758357982f5608668191d9f447042a132332f1da..8f84fc645f3634961b1f62b277ac81d13b32b066 100644 (file)
@@ -9,52 +9,39 @@ case "$1" in
        test -e /proxmox_install_mode && exit 0;
 
        # Note: reload-or-try-restart fails if service is not active
-       if systemctl --quiet is-active pmgdaemon.service ; then
-           deb-systemd-invoke reload-or-try-restart pmgdaemon.service
-       fi
-
-       if systemctl --quiet is-active pmgproxy.service ; then
-           deb-systemd-invoke reload-or-try-restart pmgproxy.service
-       fi
-
-       if systemctl --quiet is-active pmg-smtp-filter.service ; then
-           deb-systemd-invoke reload-or-try-restart pmg-smtp-filter.service
-       fi
-
-       if systemctl --quiet is-active pmgpolicy.service ; then
-           deb-systemd-invoke reload-or-try-restart pmgpolicy.service
-       fi
-
-       if systemctl --quiet is-active pmgtunnel.service ; then
-           deb-systemd-invoke reload-or-try-restart pmgtunnel.service
-       fi
-
-       if systemctl --quiet is-active pmgmirror.service ; then
-           deb-systemd-invoke reload-or-try-restart pmgmirror.service
-       fi
+       for service in pmgdaemon pmgproxy pmg-smtp-filter pmgpolicy pmgtunnel pmgmirror; do
+           if systemctl --quiet is-active $service.service ; then
+               deb-systemd-invoke reload-or-try-restart $service.service
+           fi
+       done
 
        exit 0
     ;;
 
     configure)
 
-       test -e /proxmox_install_mode && exit 0;
+       if test ! -e /proxmox_install_mode ; then
 
-       pmgconfig init
+           pmgconfig init
+           pmgdb init
 
-       if [ -n "$2" ]; then
-           pmgconfig sync
-       else
-           if systemctl --quiet is-active pmgpolicy.service ; then
-               deb-systemd-invoke reload-or-try-restart postgres.service
+           if [ -n "$2" ]; then
+               pmgconfig sync
+           else
+               if systemctl --quiet is-active pmgpolicy.service ; then
+                   deb-systemd-invoke reload-or-try-restart postgresql.service
+               fi
+               pmgconfig sync --restart
+               deb-systemd-invoke restart postfix.service
            fi
-           pmgconfig sync --restart
-       fi
 
-       pmgdb init
-       pmgdb update  >/dev/null 2>&1 &
+           pmgdb update  >/dev/null 2>&1 &
 
-       update-mime-database /usr/share/mime
+           update-mime-database /usr/share/mime
+       else
+           # rewrite banner
+           pmgbanner || true
+       fi
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
@@ -71,4 +58,17 @@ esac
 
 #DEBHELPER#
 
+if test ! -e /proxmox_install_mode ; then
+    for service in pmgdaemon pmgproxy; do
+       if [ -n "$2" ]; then
+           # Note: reload-or-try-restart fails if service is not active
+           if systemctl --quiet is-active $service.service ; then
+               deb-systemd-invoke reload-or-try-restart $service.service
+           fi
+       else
+           deb-systemd-invoke start $service.service
+       fi
+    done
+fi
+
 exit 0