]> git.proxmox.com Git - pmg-api.git/blob - debian/postinst
restart postfix after first installing pmg-api
[pmg-api.git] / debian / postinst
1 #!/bin/sh
2
3 set -e
4
5
6 case "$1" in
7 triggered)
8
9 test -e /proxmox_install_mode && exit 0;
10
11 # Note: reload-or-try-restart fails if service is not active
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
17
18 exit 0
19 ;;
20
21 configure)
22
23 if test ! -e /proxmox_install_mode ; then
24
25 pmgconfig init
26 pmgdb init
27
28 if [ -n "$2" ]; then
29 pmgconfig sync
30 else
31 if systemctl --quiet is-active pmgpolicy.service ; then
32 deb-systemd-invoke reload-or-try-restart postgresql.service
33 fi
34 pmgconfig sync --restart
35 deb-systemd-invoke restart postfix.service
36 fi
37
38 pmgdb update >/dev/null 2>&1 &
39
40 update-mime-database /usr/share/mime
41 else
42 # rewrite banner
43 pmgbanner || true
44 fi
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 ;;
54 esac
55
56 # dh_installdeb will replace this with shell code automatically
57 # generated by other debhelper scripts.
58
59 #DEBHELPER#
60
61 if 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
72 fi
73
74 exit 0