3 # Abort if any command returns an error value
6 # This script is called as the last step of the installation of the package.
7 # All the package's files are in place, dpkg has already done its automatic
8 # conffile handling, and all the packages we depend of are already fully
9 # installed and configured.
12 LVM_CONF_MARKER
="# added by pve-manager to avoid scanning"
14 # keep user changes afterwards provided marker is still there..
15 if grep -qLF "$LVM_CONF_MARKER" /etc
/lvm
/lvm.conf
; then
16 return 0 # only do these changes once
19 OLD_VALUE
="$(lvmconfig --typeconfig full devices/global_filter)"
20 NEW_VALUE
='global_filter=["r|/dev/zd.*|"]'
22 export LVM_SUPPRESS_FD_WARNINGS
=1
25 # keep previous setting from our custom packaging if it is still there
26 if echo "$OLD_VALUE" |
grep -qvF 'r|/dev/zd.*|'; then
30 # should be the default since bullseye
31 if lvmconfig
--typeconfig full devices
/scan_lvs |
grep -qv 'scan_lvs=0'; then
35 if test -n "$BACKUP"; then
36 echo "Backing up lvm.conf before setting pve-manager specific settings.."
37 cp -vb /etc
/lvm
/lvm.conf
/etc
/lvm
/lvm.conf.bak
39 if test -n "$SET_FILTER"; then
40 echo "Setting 'global_filter' in /etc/lvm/lvm.conf to prevent zvols from being scanned:"
41 echo "$OLD_VALUE => $NEW_VALUE"
42 # comment out existing setting
43 sed -i -e 's/^\([[:space:]]*global_filter[[:space:]]*=\)/#\1/' /etc
/lvm
/lvm.conf
44 # add new section with our setting
45 cat >> /etc
/lvm
/lvm.conf
<<EOF
47 $LVM_CONF_MARKER ZFS zvols
52 if test -n "$SET_SCAN_LVS"; then
53 echo "Adding scan_lvs=0 setting to /etc/lvm/lvm.conf to prevent LVs from being scanned."
54 # comment out existing setting
55 sed -i -e 's/^\([[:space:]]*scan_lvs[[:space:]]*=\)/#\1/' /etc
/lvm
/lvm.conf
56 # add new section with our setting
57 cat >> /etc
/lvm
/lvm.conf
<<EOF
59 $LVM_CONF_MARKER LVM volumes
66 migrate_apt_auth_conf
() {
72 if echo "$l" |
grep -q "^machine enterprise.proxmox.com/debian/pve"; then
74 elif echo "$l" |
grep -q "machine"; then
78 if test "$match" = "1"; then
79 removed
="$removed\n$l"
83 done < /etc
/apt
/auth.conf
85 if test -n "$removed"; then
86 if test ! -e /etc
/apt
/auth.conf.d
/pve.conf
; then
87 echo "Migrating APT auth config for enterprise.proxmox.com to /etc/apt/auth.conf.d/pve.conf .."
88 echo "$removed" > /etc
/apt
/auth.conf.d
/pve.conf
90 echo "Removing stale APT auth config from /etc/apt/auth.conf"
92 echo "$output" > /etc
/apt
/auth.conf
98 # We don't print a status message here, as dpkg already said
99 # "Processing triggers for ...".
101 # test if /etc/pve is mounted; else simple exit to avoid
102 # error during updates
103 test -f /etc
/pve
/local
/pve-ssl.pem ||
exit 0;
104 test -e /proxmox_install_mode
&& exit 0;
106 # the ExecStartPre doesn't triggers on service reload, so just in case
107 pvecm updatecerts
--silent || true
109 deb-systemd-invoke reload-or-try-restart pvedaemon.service
110 deb-systemd-invoke reload-or-try-restart pvestatd.service
111 deb-systemd-invoke reload-or-try-restart pveproxy.service
112 deb-systemd-invoke reload-or-try-restart spiceproxy.service
113 deb-systemd-invoke reload-or-try-restart pvescheduler.service
118 # Configure this package. If the package must prompt the user for
119 # information, do it here.
121 mkdir
/etc
/pve
2>/dev
/null || true
123 if test ! -e /var
/lib
/pve-manager
/apl-info
/download.proxmox.com
; then
124 mkdir
-p /var
/lib
/pve-manager
/apl-info
125 cp /usr
/share
/doc
/pve-manager
/aplinfo.dat
/var
/lib
/pve-manager
/apl-info
/download.proxmox.com
129 # Always try to clean old entry, even when proxmox-mail-forward entry is already present.
130 # This ensures it will still be cleaned after an upgrade following a downgrade.
131 if test -f /root
/.forward
; then
132 sed -i '\!|/usr/bin/pvemailforward!d' /root
/.forward
135 if ! test -f /root
/.forward ||
! grep -q '|/usr/bin/proxmox-mail-forward' /root
/.forward
; then
136 echo '|/usr/bin/proxmox-mail-forward' >>/root
/.forward
139 systemctl
--system daemon-reload
>/dev
/null || true
141 # same as dh_systemd_enable (code copied)
143 UNITS
="pvedaemon.service pveproxy.service spiceproxy.service pvestatd.service pvebanner.service pvescheduler.service pve-daily-update.timer"
144 NO_RESTART_UNITS
="pvenetcommit.service pve-guests.service"
146 for unit
in ${UNITS} ${NO_RESTART_UNITS}; do
147 deb-systemd-helper unmask
"$unit" >/dev
/null || true
149 # was-enabled defaults to true, so new installations run enable.
150 if deb-systemd-helper
--quiet was-enabled
"$unit"; then
151 # Enables the unit on first installation, creates new
152 # symlinks on upgrades if the unit file has changed.
153 deb-systemd-helper
enable "$unit" >/dev
/null || true
155 # Update the statefile to add new symlinks (if any), which need to be
156 # cleaned up on purge. Also remove old symlinks.
157 deb-systemd-helper update-state
"$unit" >/dev
/null || true
161 # FIXME: remove after beta is over and add hunk to actively remove the repo
162 BETA_SOURCES
="/etc/apt/sources.list.d/pvetest-for-beta.list"
163 if ! test -f "$BETA_SOURCES"; then
164 echo "Adding pvetest repo to '$BETA_SOURCES' to enable updates during Proxmox VE 8.0 BETA"
165 echo "deb http://download.proxmox.com/debian/pve bookworm pvetest" |
tee "$BETA_SOURCES"
170 if test ! -e /proxmox_install_mode
; then
171 # modeled after code generated by dh_start
172 for unit
in ${UNITS}; do
173 if test -n "$2"; then
174 dh_action
="reload-or-restart";
178 if systemctl
-q is-enabled
"$unit"; then
179 deb-systemd-invoke
$dh_action "$unit"
184 if test ! -e /proxmox_install_mode
&& test -n "$2" && dpkg
--compare-versions "$2" 'lt' '7.2-11~'; then
185 if test -e /etc
/apt
/auth.conf
; then
186 migrate_apt_auth_conf
191 abort-upgrade|abort-remove|abort-deconfigure
)
194 *) echo "$0: didn't understand being called with \`$1'" 1>&2