5 ucf_register_templates
() {
6 for template
in /etc
/pmg
/templates
/*; do
7 [ -e "$template" ] ||
continue;
8 template_base
=$
(basename "${template}")
9 if echo "${template_base}" |
grep -q '\.ucf-'; then
12 if [ -e "/var/lib/pmg/templates/${template_base}" ]; then
13 ucf
"/var/lib/pmg/templates/${template_base}" "${template}"
14 ucfr pmg-api
"${template}"
16 echo "template '${template}' not shipped by pmg-api."
21 migrate_apt_auth_conf
() {
27 if echo "$l" |
grep -q "^machine enterprise.proxmox.com/debian/pmg"; then
29 elif echo "$l" |
grep -q "machine"; then
33 if test "$match" = "1"; then
34 removed
="$removed\n$l"
38 done < /etc
/apt
/auth.conf
40 if test -n "$removed"; then
41 if test ! -e /etc
/apt
/auth.conf.d
/pmg.conf
; then
42 echo "Migrating APT auth config for enterprise.proxmox.com to /etc/apt/auth.conf.d/pmg.conf .."
43 echo "$removed" > /etc
/apt
/auth.conf.d
/pmg.conf
45 echo "Removing stale APT auth config from /etc/apt/auth.conf"
47 echo "$output" > /etc
/apt
/auth.conf
54 test -e /proxmox_install_mode
&& exit 0;
56 # Note: reload-or-try-restart fails if service is not active
57 for service
in pmgdaemon pmgproxy pmg-smtp-filter pmgpolicy pmgtunnel pmgmirror
; do
58 if systemctl
--quiet is-active
$service.service
; then
59 deb-systemd-invoke reload-or-try-restart
$service.service
>/dev
/null || true
67 # FIXME: remove in PMG 8.0
68 if test ! -e /proxmox_install_mode
&& test -n "$2" && dpkg
--compare-versions "$2" 'lt' '7.0-2~'; then
69 # PMG 5 ISOs had a bug and did not generated a unique machine-id. below is a list of
70 # all machine-ids from all ISOs (released, tests & internal) possibly affected
72 -e e378bde63ac54872a85af23a8e4dac73 \
73 -e 932b668d1fad4709b4976d54152d223c \
74 -e 931a8410cd034202a26b0e19d56e157a \
75 -e 9a1f3c5284e1423c9b0e0ee5819db6c9 \
76 -e 5472a49c6436426fbebd7881f7b7f13b \
79 echo "found static machine-id bug from Proxmox Mail Gateway ISO installer <= 5.4, regenerating machine-id"
80 systemd-id128 new |
tee /etc
/machine-id.new
/var
/lib
/dbus
/machine-id.new
82 mv /etc
/machine-id.new
/etc
/machine-id
83 mv /var
/lib
/dbus
/machine-id.new
/var
/lib
/dbus
/machine-id
84 echo "new machine-id generated, a reboot is recommended"
86 echo "machine-id check OK"
90 if test ! -e /proxmox_install_mode
; then
95 ucf_register_templates
96 pmgconfig sync
--restart
99 if systemctl
--quiet is-active pmgpolicy.service
; then
100 deb-systemd-invoke reload-or-try-restart postgresql.service
>/dev
/null || true
102 deb-systemd-invoke restart postfix.service
>/dev
/null || true
105 pmgdb update
>/dev
/null
2>&1 &
107 update-mime-database
/usr
/share
/mime
114 if test ! -e /proxmox_install_mode
&& test -n "$2" && dpkg
--compare-versions "$2" 'lt' '7.1-7~'; then
115 if test -e /etc
/apt
/auth.conf
; then
116 migrate_apt_auth_conf
122 ucf_register_templates
125 abort-remove|abort-deconfigure
)
129 echo "postinst called with unknown argument \`$1'" >&2
134 # dh_installdeb will replace this with shell code automatically
135 # generated by other debhelper scripts.
139 if test ! -e /proxmox_install_mode
; then
140 for service
in pmgdaemon pmgproxy
; do
142 # Note: reload-or-try-restart fails if service is not active
143 if systemctl
--quiet is-active
$service.service
; then
144 deb-systemd-invoke reload-or-try-restart
$service.service
>/dev
/null || true
147 deb-systemd-invoke start
$service.service
> /dev
/null || true