]>
Commit | Line | Data |
---|---|---|
28e6daaa | 1 | #!/bin/sh |
aff192e6 DM |
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 | ||
aff192e6 DM |
11 | case "$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 | |
ea067f42 TL |
21 | # the ExecStartPre doesn't triggers on service reload, so just in case |
22 | /usr/bin/pvecm updatecerts --silent || true | |
23 | ||
15c72102 FG |
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 | |
aff192e6 DM |
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 | ||
75a6a7f5 DM |
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 | ||
544221fa TL |
43 | if ! test -f /root/.forward || ! grep -q '|/usr/bin/pvemailforward' /root/.forward; then |
44 | echo '|/usr/bin/pvemailforward' >>/root/.forward | |
782bc232 | 45 | fi |
d0e55a85 | 46 | |
6675a064 DM |
47 | systemctl --system daemon-reload >/dev/null || true |
48 | ||
49 | # same as dh_systemd_enable (code copied) | |
50 | ||
aad80361 FG |
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" | |
0dfd4a94 | 53 | |
aad80361 FG |
54 | for unit in ${UNITS} ${NO_RESTART_UNITS}; do |
55 | deb-systemd-helper unmask "$unit" >/dev/null || true | |
6675a064 DM |
56 | |
57 | # was-enabled defaults to true, so new installations run enable. | |
aad80361 | 58 | if deb-systemd-helper --quiet was-enabled "$unit"; then |
6675a064 DM |
59 | # Enables the unit on first installation, creates new |
60 | # symlinks on upgrades if the unit file has changed. | |
aad80361 | 61 | deb-systemd-helper enable "$unit" >/dev/null || true |
6675a064 DM |
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. | |
aad80361 | 65 | deb-systemd-helper update-state "$unit" >/dev/null || true |
6675a064 DM |
66 | fi |
67 | done | |
68 | ||
891ea8e8 | 69 | # FIXME: remove in PVE 8.0 |
5fb7a28a TL |
70 | if test ! -e /proxmox_install_mode && test -n "$2" && dpkg --compare-versions "$2" 'lt' '7~'; then |
71 | # PVE 4.0 beta to 5.4 ISO had a bug and did not generated a unique machine-id. below is a | |
72 | # very relaxed machine-id list from all ISOs (released, tests & internal) possibly affected | |
73 | if grep -q \ | |
74 | -e 2ec24eda629a4c8d8c1f8dac50a9ee5f \ | |
75 | -e bd94244c0da6419a82a383e62dc03b51 \ | |
76 | -e 45d4e7046c3d4c26af8acd589f358ac6 \ | |
77 | -e 8c445f96b3064ff79f825ea78a3eefde \ | |
78 | -e 6f9fae0f0a794fd4b89b3abecfd7f182 \ | |
79 | -e 6f9fae0f0a794fd4b89b3abecfd7f182 \ | |
80 | -e 285de85759894b3f9ad9844a89045af6 \ | |
81 | -e 89971dede7b04c98b2b0bc8845f53320 \ | |
82 | -e 4e3b6e9550f24d638bc26211a7b37df5 \ | |
83 | -e bc2f684e31ee4daf95e45c62410a95b1 \ | |
84 | -e 8cc7bc883fd048b78a4af7433c48e341 \ | |
85 | -e 9b46d99712854566bb02a656a3ff9191 \ | |
86 | -e e7fc055af47048ee884dcb88a7474336 \ | |
87 | -e 13d879f75e6447a69ed85179bd93759a \ | |
88 | -e 5b59e448c3e74029af2ac91f572d68a7 \ | |
89 | -e 5a2bd0d11a6c41f9a33fd527751224ea \ | |
90 | -e 516afc72013c4b9da85b309aad987df2 \ | |
91 | -e b0ce8d24684845e8ac337c588a7715cb \ | |
92 | -e e0af064c16e9463e9fa980eac66427c1 \ | |
93 | -e 6e925d11b497446e8e7f2ff38e7cf891 \ | |
94 | -e eec280213051474d8bfe7e089a86744a \ | |
95 | -e 708ded6ee82a46c08b77fecda2284c6c \ | |
96 | -e 615cb2b78b2240289fef74da610c146f \ | |
97 | -e b965b329a7e246d5be66a8d367f5760d \ | |
98 | -e 5472a49c6436426fbebd7881f7b7f13b \ | |
99 | /etc/machine-id | |
100 | then | |
101 | echo "found static machine-id bug from Proxmox VE ISO installer <= 5.4, regenerating machine-id" | |
102 | systemd-id128 new | tee /etc/machine-id.new /var/lib/dbus/machine-id.new | |
103 | # atomically replace | |
104 | mv /etc/machine-id.new /etc/machine-id | |
105 | mv /var/lib/dbus/machine-id.new /var/lib/dbus/machine-id | |
106 | echo "new machine-id generated, a reboot is recommended" | |
107 | else | |
108 | echo "machine-id check OK" | |
109 | fi | |
110 | fi | |
111 | ||
6675a064 | 112 | if test ! -e /proxmox_install_mode; then |
de01cff0 | 113 | # modeled after code generated by dh_start |
aad80361 | 114 | for unit in ${UNITS}; do |
de01cff0 FG |
115 | if test -n "$2"; then |
116 | dh_action="reload-or-try-restart"; | |
117 | else | |
118 | dh_action="start" | |
119 | fi | |
aee71a6c TL |
120 | if systemctl -q is-enabled "$unit"; then |
121 | deb-systemd-invoke $dh_action "$unit" | |
122 | fi | |
6675a064 DM |
123 | done |
124 | fi | |
01fe34e0 | 125 | ;; |
aff192e6 | 126 | |
e3ffd2c0 | 127 | abort-upgrade|abort-remove|abort-deconfigure) |
aff192e6 | 128 | ;; |
aff192e6 | 129 | |
aff192e6 DM |
130 | *) echo "$0: didn't understand being called with \`$1'" 1>&2 |
131 | exit 0;; | |
132 | esac | |
133 | ||
134 | exit 0 |