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.
11 # The following idempotent stuff doesn't generally need protecting
12 # against being run in the abort-* cases.
14 # Use debconf. (installs templates)
15 .
/usr
/share
/debconf
/confmodule
16 # all done with debconf here.
21 # We don't print a status message here, as dpkg already said
22 # "Processing triggers for ...".
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;
27 test -e /proxmox_install_mode
&& exit 0;
29 # Note: reload-or-try-restart fails if service is not active
30 systemctl
--quiet is-active pvedaemon.service
&& deb-systemd-invoke reload-or-try-restart pvedaemon.service
31 systemctl
--quiet is-active pvestatd.service
&& deb-systemd-invoke reload-or-try-restart pvestatd.service
32 systemctl
--quiet is-active pveproxy.service
&& deb-systemd-invoke reload-or-try-restart pveproxy.service
33 systemctl
--quiet is-active spiceproxy.service
&& deb-systemd-invoke reload-or-try-restart spiceproxy.service
38 # Configure this package. If the package must prompt the user for
39 # information, do it here.
41 mkdir
/etc
/pve
2>/dev
/null || true
44 rm -rf /var
/lib
/pve-manager
/apl-available
46 # remove old cron.daily update job to randomize it
47 if test -e /etc
/cron.daily
/pve
; then
48 echo "Remove old update script from cron.daily"
49 rm /etc
/cron.daily
/pve
52 # remove old/usused init.d files
53 rm -f /etc
/init.d
/pvebanner
54 rm -f /etc
/init.d
/pvenetcommit
56 # create new daily randomize update cronjob if not exist
57 MIN
="$(shuf -i 0-59 -n 1)"
58 HOUR
="$(shuf -i 2-5 -n 1)"
59 cat <<EOF >/etc/cron.d/pveupdate
60 # automatically generated - do not edit
61 ${MIN} ${HOUR} * * * root /usr/bin/pveupdate
64 if test ! -e /var
/lib
/pve-manager
/apl-info
/download.proxmox.com
; then
65 mkdir
-p /var
/lib
/pve-manager
/apl-info
66 cp /usr
/share
/doc
/pve-manager
/aplinfo.dat
/var
/lib
/pve-manager
/apl-info
/download.proxmox.com
70 if test -f /root
/.forward
; then
71 if ! grep -q '|/usr/bin/pvemailforward' /root
/.forward
; then
72 echo -e "|/usr/bin/pvemailforward\n$(cat /root/.forward)" >/root
/.forward.tmp
73 mv /root
/.forward.tmp
/root
/.forward
76 echo '|/usr/bin/pvemailforward' >/root
/.forward
79 # disable fancy init messages (bad with bootlogd)
80 test -f /etc
/lsb-base-logging.sh ||
echo "FANCYTTY=0" >/etc
/lsb-base-logging.sh
83 systemctl
--system daemon-reload
>/dev
/null || true
85 # same as dh_systemd_enable (code copied)
87 for service
in pvedaemon pveproxy spiceproxy pvestatd pvebanner pvenetcommit pve-manager
; do
88 deb-systemd-helper unmask
$service.service
>/dev
/null || true
90 # was-enabled defaults to true, so new installations run enable.
91 if deb-systemd-helper
--quiet was-enabled
$service.service
; then
92 # Enables the unit on first installation, creates new
93 # symlinks on upgrades if the unit file has changed.
94 deb-systemd-helper
enable $service.service
>/dev
/null || true
96 # Update the statefile to add new symlinks (if any), which need to be
97 # cleaned up on purge. Also remove old symlinks.
98 deb-systemd-helper update-state
$service.service
>/dev
/null || true
102 if test ! -e /proxmox_install_mode
; then
104 for service
in pvedaemon pveproxy spiceproxy pvestatd
; do
105 deb-systemd-invoke reload-or-restart
$service
110 test -e /proxmox_install_mode || pvebanner || true
112 #a2ensite pve.conf >/dev/null 2>&1
114 # There are three sub-cases:
115 if test "${2+set}" != set; then
116 # We're being installed by an ancient dpkg which doesn't remember
117 # which version was most recently configured, or even whether
118 # there is a most recently configured version.
121 elif test -z "$2" -o "$2" = "<unknown>"; then
122 # The package has not ever been configured on this system, or was
123 # purged since it was last configured.
127 # Version $2 is the most recently configured version of this
133 # Back out of an attempt to upgrade this package FROM THIS VERSION
134 # to version $2. Undo the effects of "prerm upgrade $2".
139 if test "$2" != in-favour
; then
140 echo "$0: undocumented call to \`postinst $*'" 1>&2
143 # Back out of an attempt to remove this package, which was due to
144 # a conflict with package $3 (version $4). Undo the effects of
145 # "prerm remove in-favour $3 $4".
150 if test "$2" != in-favour
-o "$5" != removing
; then
151 echo "$0: undocumented call to \`postinst $*'" 1>&2
154 # Back out of an attempt to deconfigure this package, which was
155 # due to package $6 (version $7) which we depend on being removed
156 # to make way for package $3 (version $4). Undo the effects of
157 # "prerm deconfigure in-favour $3 $4 removing $6 $7".
161 *) echo "$0: didn't understand being called with \`$1'" 1>&2