]>
Commit | Line | Data |
---|---|---|
7aa2bc3b | 1 | #!/bin/bash |
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 | ||
11 | # The following idempotent stuff doesn't generally need protecting | |
12 | # against being run in the abort-* cases. | |
13 | ||
14 | # Use debconf. (installs templates) | |
15 | . /usr/share/debconf/confmodule | |
16 | # all done with debconf here. | |
17 | db_stop | |
18 | ||
19 | case "$1" in | |
20 | triggered) | |
21 | # We don't print a status message here, as dpkg already said | |
22 | # "Processing triggers for ...". | |
23 | ||
099e5477 DM |
24 | # test if /etc/pve is mounted; else simple exit to avoid |
25 | # error during updates | |
26 | test -f /etc/pve/local/pve-ssl.pem || exit 0; | |
6675a064 DM |
27 | test -e /proxmox_install_mode && exit 0; |
28 | ||
32607384 DM |
29 | deb-systemd-invoke reload pvedaemon.service |
30 | deb-systemd-invoke reload pvestatd.service | |
31 | deb-systemd-invoke reload pveproxy.service | |
32 | deb-systemd-invoke reload spiceproxy.service | |
aff192e6 DM |
33 | |
34 | exit 0;; | |
35 | ||
36 | configure) | |
37 | # Configure this package. If the package must prompt the user for | |
38 | # information, do it here. | |
39 | ||
40 | mkdir /etc/pve 2>/dev/null || true | |
41 | ||
c9164975 DM |
42 | # remove old APL dir |
43 | rm -rf /var/lib/pve-manager/apl-available | |
782bc232 | 44 | |
75a6a7f5 DM |
45 | if test ! -e /var/lib/pve-manager/apl-info/download.proxmox.com; then |
46 | mkdir -p /var/lib/pve-manager/apl-info | |
47 | cp /usr/share/doc/pve-manager/aplinfo.dat /var/lib/pve-manager/apl-info/download.proxmox.com | |
48 | pveam update || true | |
49 | fi | |
50 | ||
782bc232 DM |
51 | if test -f /root/.forward; then |
52 | if ! grep -q '|/usr/bin/pvemailforward' /root/.forward; then | |
341e4b0b | 53 | echo -e "|/usr/bin/pvemailforward\n$(cat /root/.forward)" >/root/.forward.tmp |
782bc232 DM |
54 | mv /root/.forward.tmp /root/.forward |
55 | fi | |
56 | else | |
57 | echo '|/usr/bin/pvemailforward' >/root/.forward | |
58 | fi | |
d0e55a85 DM |
59 | |
60 | # disable fancy init messages (bad with bootlogd) | |
6675a064 DM |
61 | test -f /etc/lsb-base-logging.sh || echo "FANCYTTY=0" >/etc/lsb-base-logging.sh |
62 | ||
63 | ||
64 | systemctl --system daemon-reload >/dev/null || true | |
65 | ||
66 | # same as dh_systemd_enable (code copied) | |
67 | ||
68 | for service in pvedaemon pveproxy spiceproxy pvestatd pvebanner pvenetcommit pve-manager; do | |
69 | deb-systemd-helper unmask $service.service >/dev/null || true | |
70 | ||
71 | # was-enabled defaults to true, so new installations run enable. | |
72 | if deb-systemd-helper --quiet was-enabled $service.service; then | |
73 | # Enables the unit on first installation, creates new | |
74 | # symlinks on upgrades if the unit file has changed. | |
75 | deb-systemd-helper enable $service.service >/dev/null || true | |
76 | else | |
77 | # Update the statefile to add new symlinks (if any), which need to be | |
78 | # cleaned up on purge. Also remove old symlinks. | |
79 | deb-systemd-helper update-state $service.service >/dev/null || true | |
80 | fi | |
81 | done | |
82 | ||
83 | if test ! -e /proxmox_install_mode; then | |
84 | ||
85 | for service in pvedaemon pveproxy spiceproxy pvestatd; do | |
32607384 | 86 | deb-systemd-invoke reload $service |
6675a064 DM |
87 | done |
88 | fi | |
ad2c9763 DM |
89 | |
90 | # rewrite banner | |
6675a064 | 91 | test -e /proxmox_install_mode || pvebanner || true |
aff192e6 | 92 | |
0c308a03 | 93 | #a2ensite pve.conf >/dev/null 2>&1 |
aff192e6 DM |
94 | |
95 | # There are three sub-cases: | |
96 | if test "${2+set}" != set; then | |
97 | # We're being installed by an ancient dpkg which doesn't remember | |
98 | # which version was most recently configured, or even whether | |
99 | # there is a most recently configured version. | |
100 | : | |
101 | ||
102 | elif test -z "$2" -o "$2" = "<unknown>"; then | |
103 | # The package has not ever been configured on this system, or was | |
104 | # purged since it was last configured. | |
105 | : | |
106 | ||
107 | else | |
108 | # Version $2 is the most recently configured version of this | |
109 | # package. | |
110 | : | |
111 | ||
112 | fi ;; | |
113 | abort-upgrade) | |
114 | # Back out of an attempt to upgrade this package FROM THIS VERSION | |
115 | # to version $2. Undo the effects of "prerm upgrade $2". | |
116 | : | |
117 | ||
118 | ;; | |
119 | abort-remove) | |
120 | if test "$2" != in-favour; then | |
121 | echo "$0: undocumented call to \`postinst $*'" 1>&2 | |
122 | exit 0 | |
123 | fi | |
124 | # Back out of an attempt to remove this package, which was due to | |
125 | # a conflict with package $3 (version $4). Undo the effects of | |
126 | # "prerm remove in-favour $3 $4". | |
127 | : | |
128 | ||
129 | ;; | |
130 | abort-deconfigure) | |
131 | if test "$2" != in-favour -o "$5" != removing; then | |
132 | echo "$0: undocumented call to \`postinst $*'" 1>&2 | |
133 | exit 0 | |
134 | fi | |
135 | # Back out of an attempt to deconfigure this package, which was | |
136 | # due to package $6 (version $7) which we depend on being removed | |
137 | # to make way for package $3 (version $4). Undo the effects of | |
138 | # "prerm deconfigure in-favour $3 $4 removing $6 $7". | |
139 | : | |
140 | ||
141 | ;; | |
142 | *) echo "$0: didn't understand being called with \`$1'" 1>&2 | |
143 | exit 0;; | |
144 | esac | |
145 | ||
146 | exit 0 |