]> git.proxmox.com Git - pve-manager.git/blame - debian/postinst
node config: check if plugin is valid for acmedomain
[pve-manager.git] / debian / postinst
CommitLineData
28e6daaa 1#!/bin/sh
aff192e6
DM
2
3# Abort if any command returns an error value
4set -e
5
6# This script is called as the last step of the installation of the
7# package. All the package's files are in place, dpkg has already
8# done its automatic conffile handling, and all the packages we depend
9# of are already fully installed and configured.
10
aff192e6
DM
11case "$1" in
12 triggered)
13 # We don't print a status message here, as dpkg already said
14 # "Processing triggers for ...".
15
099e5477
DM
16 # test if /etc/pve is mounted; else simple exit to avoid
17 # error during updates
18 test -f /etc/pve/local/pve-ssl.pem || exit 0;
6675a064 19 test -e /proxmox_install_mode && exit 0;
81019d9d 20
15c72102
FG
21 deb-systemd-invoke reload-or-try-restart pvedaemon.service
22 deb-systemd-invoke reload-or-try-restart pvestatd.service
23 deb-systemd-invoke reload-or-try-restart pveproxy.service
24 deb-systemd-invoke reload-or-try-restart spiceproxy.service
aff192e6
DM
25
26 exit 0;;
27
28 configure)
29 # Configure this package. If the package must prompt the user for
30 # information, do it here.
31
32 mkdir /etc/pve 2>/dev/null || true
33
75a6a7f5
DM
34 if test ! -e /var/lib/pve-manager/apl-info/download.proxmox.com; then
35 mkdir -p /var/lib/pve-manager/apl-info
36 cp /usr/share/doc/pve-manager/aplinfo.dat /var/lib/pve-manager/apl-info/download.proxmox.com
37 pveam update || true
38 fi
39
544221fa
TL
40 if ! test -f /root/.forward || ! grep -q '|/usr/bin/pvemailforward' /root/.forward; then
41 echo '|/usr/bin/pvemailforward' >>/root/.forward
782bc232 42 fi
d0e55a85 43
6675a064
DM
44 systemctl --system daemon-reload >/dev/null || true
45
46 # same as dh_systemd_enable (code copied)
47
aad80361
FG
48 UNITS="pvedaemon.service pveproxy.service spiceproxy.service pvestatd.service pvebanner.service pvesr.timer pve-daily-update.timer"
49 NO_RESTART_UNITS="pvenetcommit.service pve-guests.service"
0dfd4a94 50
aad80361
FG
51 for unit in ${UNITS} ${NO_RESTART_UNITS}; do
52 deb-systemd-helper unmask "$unit" >/dev/null || true
6675a064
DM
53
54 # was-enabled defaults to true, so new installations run enable.
aad80361 55 if deb-systemd-helper --quiet was-enabled "$unit"; then
6675a064
DM
56 # Enables the unit on first installation, creates new
57 # symlinks on upgrades if the unit file has changed.
aad80361 58 deb-systemd-helper enable "$unit" >/dev/null || true
6675a064
DM
59 else
60 # Update the statefile to add new symlinks (if any), which need to be
61 # cleaned up on purge. Also remove old symlinks.
aad80361 62 deb-systemd-helper update-state "$unit" >/dev/null || true
6675a064
DM
63 fi
64 done
65
66 if test ! -e /proxmox_install_mode; then
de01cff0 67 # modeled after code generated by dh_start
aad80361 68 for unit in ${UNITS}; do
de01cff0
FG
69 if test -n "$2"; then
70 dh_action="reload-or-try-restart";
71 else
72 dh_action="start"
73 fi
aee71a6c
TL
74 if systemctl -q is-enabled "$unit"; then
75 deb-systemd-invoke $dh_action "$unit"
76 fi
6675a064
DM
77 done
78 fi
4e435ad1
SI
79
80 # TODO: remove once PVE 7.0 is released
81 if test -n "$2"; then
82 if dpkg --compare-versions "$2" 'lt' '6.0-11'; then
83 newaliases || true
84 fi
85 fi
01fe34e0 86 ;;
aff192e6 87
e3ffd2c0 88 abort-upgrade|abort-remove|abort-deconfigure)
aff192e6 89 ;;
aff192e6 90
aff192e6
DM
91 *) echo "$0: didn't understand being called with \`$1'" 1>&2
92 exit 0;;
93esac
94
70bf844a
TL
95# FIXME: remove in 7.0
96dpkg-maintscript-helper rm_conffile /etc/apt/apt.conf.d/75pveconf 6.0-0\+3 pve-manager -- "$@"
97
aff192e6 98exit 0