3 # Abort if any command returns an error value
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.
13 # We don't print a status message here, as dpkg already said
14 # "Processing triggers for ...".
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;
21 # Note: reload-or-try-restart fails if service is not active
22 systemctl
--quiet is-active pvedaemon.service
&& deb-systemd-invoke reload-or-try-restart pvedaemon.service
23 systemctl
--quiet is-active pvestatd.service
&& deb-systemd-invoke reload-or-try-restart pvestatd.service
24 systemctl
--quiet is-active pveproxy.service
&& deb-systemd-invoke reload-or-try-restart pveproxy.service
25 systemctl
--quiet is-active spiceproxy.service
&& deb-systemd-invoke reload-or-try-restart spiceproxy.service
30 # Configure this package. If the package must prompt the user for
31 # information, do it here.
33 mkdir
/etc
/pve
2>/dev
/null || true
35 # remove old cron.daily update job to randomize it
36 if test -e /etc
/cron.daily
/pve
; then
37 echo "Remove old update script from cron.daily"
38 rm /etc
/cron.daily
/pve
41 if dpkg
--compare-versions "$2" '<=' '5.1-47'; then
42 # remove old/unused init.d files
43 OLD_INITD_FILES
="pvebanner pvenetcommit pve-manager pvedaemon pveproxy pvestatd spiceproxy"
44 for f
in ${OLD_INITD_FILES}; do rm -f "/etc/init.d/$f"; done
47 # create new daily randomize update cronjob if not exist
48 MIN
="$(shuf -i 0-59 -n 1)"
49 HOUR
="$(shuf -i 2-5 -n 1)"
50 cat <<EOF >/etc/cron.d/pveupdate
51 # automatically generated - do not edit
52 ${MIN} ${HOUR} * * * root /usr/bin/pveupdate
55 if test ! -e /var
/lib
/pve-manager
/apl-info
/download.proxmox.com
; then
56 mkdir
-p /var
/lib
/pve-manager
/apl-info
57 cp /usr
/share
/doc
/pve-manager
/aplinfo.dat
/var
/lib
/pve-manager
/apl-info
/download.proxmox.com
61 if test -f /root
/.forward
; then
62 if ! grep -q '|/usr/bin/pvemailforward' /root
/.forward
; then
63 echo -e "|/usr/bin/pvemailforward\n$(cat /root/.forward)" >/root
/.forward.tmp
64 mv /root
/.forward.tmp
/root
/.forward
67 echo '|/usr/bin/pvemailforward' >/root
/.forward
70 # disable fancy init messages (bad with bootlogd)
71 test -f /etc
/lsb-base-logging.sh ||
echo "FANCYTTY=0" >/etc
/lsb-base-logging.sh
73 if [ -f /etc
/systemd
/system
/ceph.service
]; then
74 md5
=$
(md5sum /etc
/systemd
/system
/ceph.service
)
75 if [[ "$md5" == "21b2e7a7c4ffcf92ad0ec2c905e88e5b /etc/systemd/system/ceph.service" ]]; then
76 echo "Updating PVE ceph.service to correct install target.."
77 cp /usr
/share
/doc
/pve-manager
/examples
/ceph.service
/etc
/systemd
/system
/ceph.service
78 systemctl
--system daemon-reload
>/dev
/null || true
79 systemctl
--system disable ceph.service
80 systemctl
--system enable ceph.service
85 systemctl
--system daemon-reload
>/dev
/null || true
87 # same as dh_systemd_enable (code copied)
89 for timer
in pvesr
; do
90 deb-systemd-helper unmask
$timer.timer
>/dev
/null || true
92 # was-enabled defaults to true, so new installations run enable.
93 if deb-systemd-helper
--quiet was-enabled
$timer.timer
; then
94 # Enables the unit on first installation, creates new
95 # symlinks on upgrades if the unit file has changed.
96 deb-systemd-helper
enable $timer.timer
>/dev
/null || true
98 # Update the statefile to add new symlinks (if any), which need to be
99 # cleaned up on purge. Also remove old symlinks.
100 deb-systemd-helper update-state
$timer.timer
>/dev
/null || true
104 for service
in pvedaemon pveproxy spiceproxy pvestatd pvebanner pvenetcommit pve-guests
; do
105 deb-systemd-helper unmask
$service.service
>/dev
/null || true
107 # was-enabled defaults to true, so new installations run enable.
108 if deb-systemd-helper
--quiet was-enabled
$service.service
; then
109 # Enables the unit on first installation, creates new
110 # symlinks on upgrades if the unit file has changed.
111 deb-systemd-helper
enable $service.service
>/dev
/null || true
113 # Update the statefile to add new symlinks (if any), which need to be
114 # cleaned up on purge. Also remove old symlinks.
115 deb-systemd-helper update-state
$service.service
>/dev
/null || true
119 if test ! -e /proxmox_install_mode
; then
121 for service
in pvedaemon pveproxy spiceproxy pvestatd
; do
122 deb-systemd-invoke reload-or-restart
$service
125 deb-systemd-invoke start pvesr.timer
>/dev
/null || true
129 test -e /proxmox_install_mode || pvebanner || true
131 #a2ensite pve.conf >/dev/null 2>&1
133 # There are three sub-cases:
134 if test "${2+set}" != set; then
135 # We're being installed by an ancient dpkg which doesn't remember
136 # which version was most recently configured, or even whether
137 # there is a most recently configured version.
140 elif test -z "$2" -o "$2" = "<unknown>"; then
141 # The package has not ever been configured on this system, or was
142 # purged since it was last configured.
146 # Version $2 is the most recently configured version of this
148 if dpkg
--compare-versions "$2" '<=' '5.0-23'; then
149 # 5.0-23 temporarily reverted the removal of the startcom CA in
150 # ca-certificates; we've since switched to let's encrypt
151 update-ca-certificates
>/dev
/null
2>&1
156 # Back out of an attempt to upgrade this package FROM THIS VERSION
157 # to version $2. Undo the effects of "prerm upgrade $2".
162 if test "$2" != in-favour
; then
163 echo "$0: undocumented call to \`postinst $*'" 1>&2
166 # Back out of an attempt to remove this package, which was due to
167 # a conflict with package $3 (version $4). Undo the effects of
168 # "prerm remove in-favour $3 $4".
173 if test "$2" != in-favour
-o "$5" != removing
; then
174 echo "$0: undocumented call to \`postinst $*'" 1>&2
177 # Back out of an attempt to deconfigure this package, which was
178 # due to package $6 (version $7) which we depend on being removed
179 # to make way for package $3 (version $4). Undo the effects of
180 # "prerm deconfigure in-favour $3 $4 removing $6 $7".
184 *) echo "$0: didn't understand being called with \`$1'" 1>&2