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
82 if [ -f /etc
/systemd
/system
/ceph.service
]; then
83 md5
=$
(md5sum /etc
/systemd
/system
/ceph.service
)
84 if [[ "$md5" == "21b2e7a7c4ffcf92ad0ec2c905e88e5b /etc/systemd/system/ceph.service" ]]; then
85 echo "Updating PVE ceph.service to correct install target.."
86 cp /usr
/share
/doc
/pve-manager
/examples
/ceph.service
/etc
/systemd
/system
/ceph.service
87 systemctl
--system daemon-reload
>/dev
/null || true
88 systemctl
--system disable ceph.service
89 systemctl
--system enable ceph.service
94 systemctl
--system daemon-reload
>/dev
/null || true
96 # same as dh_systemd_enable (code copied)
98 for timer
in pvesr
; do
99 deb-systemd-helper unmask
$timer.timer
>/dev
/null || true
101 # was-enabled defaults to true, so new installations run enable.
102 if deb-systemd-helper
--quiet was-enabled
$timer.timer
; then
103 # Enables the unit on first installation, creates new
104 # symlinks on upgrades if the unit file has changed.
105 deb-systemd-helper
enable $timer.timer
>/dev
/null || true
107 # Update the statefile to add new symlinks (if any), which need to be
108 # cleaned up on purge. Also remove old symlinks.
109 deb-systemd-helper update-state
$timer.timer
>/dev
/null || true
113 for service
in pvedaemon pveproxy spiceproxy pvestatd pvebanner pvenetcommit pve-manager
; do
114 deb-systemd-helper unmask
$service.service
>/dev
/null || true
116 # was-enabled defaults to true, so new installations run enable.
117 if deb-systemd-helper
--quiet was-enabled
$service.service
; then
118 # Enables the unit on first installation, creates new
119 # symlinks on upgrades if the unit file has changed.
120 deb-systemd-helper
enable $service.service
>/dev
/null || true
122 # Update the statefile to add new symlinks (if any), which need to be
123 # cleaned up on purge. Also remove old symlinks.
124 deb-systemd-helper update-state
$service.service
>/dev
/null || true
128 if test ! -e /proxmox_install_mode
; then
130 for service
in pvedaemon pveproxy spiceproxy pvestatd
; do
131 deb-systemd-invoke reload-or-restart
$service
134 deb-systemd-invoke start pvesr.timer
>/dev
/null || true
137 # enable startcom-ca2.crt for enterprise repository
138 update-ca-certificates
>/dev
/null
2>&1
141 test -e /proxmox_install_mode || pvebanner || true
143 #a2ensite pve.conf >/dev/null 2>&1
145 # There are three sub-cases:
146 if test "${2+set}" != set; then
147 # We're being installed by an ancient dpkg which doesn't remember
148 # which version was most recently configured, or even whether
149 # there is a most recently configured version.
152 elif test -z "$2" -o "$2" = "<unknown>"; then
153 # The package has not ever been configured on this system, or was
154 # purged since it was last configured.
158 # Version $2 is the most recently configured version of this
164 # Back out of an attempt to upgrade this package FROM THIS VERSION
165 # to version $2. Undo the effects of "prerm upgrade $2".
170 if test "$2" != in-favour
; then
171 echo "$0: undocumented call to \`postinst $*'" 1>&2
174 # Back out of an attempt to remove this package, which was due to
175 # a conflict with package $3 (version $4). Undo the effects of
176 # "prerm remove in-favour $3 $4".
181 if test "$2" != in-favour
-o "$5" != removing
; then
182 echo "$0: undocumented call to \`postinst $*'" 1>&2
185 # Back out of an attempt to deconfigure this package, which was
186 # due to package $6 (version $7) which we depend on being removed
187 # to make way for package $3 (version $4). Undo the effects of
188 # "prerm deconfigure in-favour $3 $4 removing $6 $7".
192 *) echo "$0: didn't understand being called with \`$1'" 1>&2