]> git.proxmox.com Git - pmg-api.git/blame - debian/postinst
restart postfix after first installing pmg-api
[pmg-api.git] / debian / postinst
CommitLineData
0854fb22
DM
1#!/bin/sh
2
3set -e
4
5
6case "$1" in
3cf7a549
DM
7 triggered)
8
9 test -e /proxmox_install_mode && exit 0;
10
11 # Note: reload-or-try-restart fails if service is not active
b970485e
DM
12 for service in pmgdaemon pmgproxy pmg-smtp-filter pmgpolicy pmgtunnel pmgmirror; do
13 if systemctl --quiet is-active $service.service ; then
14 deb-systemd-invoke reload-or-try-restart $service.service
15 fi
16 done
07f15aa3 17
3cf7a549
DM
18 exit 0
19 ;;
20
0854fb22 21 configure)
ebe7f62b 22
7aa01a97 23 if test ! -e /proxmox_install_mode ; then
cf521b5d 24
5e374987
DM
25 pmgconfig init
26 pmgdb init
ef23c01a 27
5e374987
DM
28 if [ -n "$2" ]; then
29 pmgconfig sync
30 else
31 if systemctl --quiet is-active pmgpolicy.service ; then
b4610a89 32 deb-systemd-invoke reload-or-try-restart postgresql.service
5e374987
DM
33 fi
34 pmgconfig sync --restart
fe7a2114 35 deb-systemd-invoke restart postfix.service
ef23c01a 36 fi
ef23c01a 37
5e374987 38 pmgdb update >/dev/null 2>&1 &
cf521b5d 39
5e374987 40 update-mime-database /usr/share/mime
07959366
DM
41 else
42 # rewrite banner
43 pmgbanner || true
5e374987 44 fi
0854fb22
DM
45 ;;
46
47 abort-upgrade|abort-remove|abort-deconfigure)
48 ;;
49
50 *)
51 echo "postinst called with unknown argument \`$1'" >&2
52 exit 1
53 ;;
54esac
55
56# dh_installdeb will replace this with shell code automatically
57# generated by other debhelper scripts.
58
59#DEBHELPER#
60
2305fb86
DM
61if test ! -e /proxmox_install_mode ; then
62 for service in pmgdaemon pmgproxy; do
63 if [ -n "$2" ]; then
64 # Note: reload-or-try-restart fails if service is not active
65 if systemctl --quiet is-active $service.service ; then
66 deb-systemd-invoke reload-or-try-restart $service.service
67 fi
68 else
69 deb-systemd-invoke start $service.service
70 fi
71 done
72fi
73
0854fb22 74exit 0