]> git.proxmox.com Git - pve-manager.git/blob - debian/postinst
vzdump: move remaining guest include logic to single method
[pve-manager.git] / debian / postinst
1 #!/bin/sh
2
3 # Abort if any command returns an error value
4 set -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
11 case "$1" in
12 triggered)
13 # We don't print a status message here, as dpkg already said
14 # "Processing triggers for ...".
15
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;
19 test -e /proxmox_install_mode && exit 0;
20
21 # the ExecStartPre doesn't triggers on service reload, so just in case
22 /usr/bin/pvecm updatecerts --silent || true
23
24 deb-systemd-invoke reload-or-try-restart pvedaemon.service
25 deb-systemd-invoke reload-or-try-restart pvestatd.service
26 deb-systemd-invoke reload-or-try-restart pveproxy.service
27 deb-systemd-invoke reload-or-try-restart spiceproxy.service
28
29 exit 0;;
30
31 configure)
32 # Configure this package. If the package must prompt the user for
33 # information, do it here.
34
35 mkdir /etc/pve 2>/dev/null || true
36
37 if test ! -e /var/lib/pve-manager/apl-info/download.proxmox.com; then
38 mkdir -p /var/lib/pve-manager/apl-info
39 cp /usr/share/doc/pve-manager/aplinfo.dat /var/lib/pve-manager/apl-info/download.proxmox.com
40 pveam update || true
41 fi
42
43 if ! test -f /root/.forward || ! grep -q '|/usr/bin/pvemailforward' /root/.forward; then
44 echo '|/usr/bin/pvemailforward' >>/root/.forward
45 fi
46
47 systemctl --system daemon-reload >/dev/null || true
48
49 # same as dh_systemd_enable (code copied)
50
51 UNITS="pvedaemon.service pveproxy.service spiceproxy.service pvestatd.service pvebanner.service pvesr.timer pve-daily-update.timer"
52 NO_RESTART_UNITS="pvenetcommit.service pve-guests.service"
53
54 for unit in ${UNITS} ${NO_RESTART_UNITS}; do
55 deb-systemd-helper unmask "$unit" >/dev/null || true
56
57 # was-enabled defaults to true, so new installations run enable.
58 if deb-systemd-helper --quiet was-enabled "$unit"; then
59 # Enables the unit on first installation, creates new
60 # symlinks on upgrades if the unit file has changed.
61 deb-systemd-helper enable "$unit" >/dev/null || true
62 else
63 # Update the statefile to add new symlinks (if any), which need to be
64 # cleaned up on purge. Also remove old symlinks.
65 deb-systemd-helper update-state "$unit" >/dev/null || true
66 fi
67 done
68
69 if test ! -e /proxmox_install_mode; then
70 # modeled after code generated by dh_start
71 for unit in ${UNITS}; do
72 if test -n "$2"; then
73 dh_action="reload-or-try-restart";
74 else
75 dh_action="start"
76 fi
77 if systemctl -q is-enabled "$unit"; then
78 deb-systemd-invoke $dh_action "$unit"
79 fi
80 done
81 fi
82
83 # TODO: remove once PVE 7.0 is released
84 if test -n "$2"; then
85 if dpkg --compare-versions "$2" 'lt' '6.0-11'; then
86 newaliases || true
87 fi
88 fi
89 ;;
90
91 abort-upgrade|abort-remove|abort-deconfigure)
92 ;;
93
94 *) echo "$0: didn't understand being called with \`$1'" 1>&2
95 exit 0;;
96 esac
97
98 # FIXME: remove in 7.0
99 dpkg-maintscript-helper rm_conffile /etc/apt/apt.conf.d/75pveconf 6.0-0\+3 pve-manager -- "$@"
100
101 exit 0