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 if ! test -f /root
/.forward ||
! grep -q '|/usr/bin/pvemailforward' /root
/.forward
; then
130 echo '|/usr/bin/pvemailforward' >>/root
/.forward
133 systemctl
--system daemon-reload
>/dev
/null || true
135 # same as dh_systemd_enable (code copied)
137 UNITS
="pvedaemon.service pveproxy.service spiceproxy.service pvestatd.service pvebanner.service pvescheduler.service pve-daily-update.timer"
138 NO_RESTART_UNITS
="pvenetcommit.service pve-guests.service"
140 for unit
in ${UNITS} ${NO_RESTART_UNITS}; do
141 deb-systemd-helper unmask
"$unit" >/dev
/null || true
143 # was-enabled defaults to true, so new installations run enable.
144 if deb-systemd-helper
--quiet was-enabled
"$unit"; then
145 # Enables the unit on first installation, creates new
146 # symlinks on upgrades if the unit file has changed.
147 deb-systemd-helper
enable "$unit" >/dev
/null || true
149 # Update the statefile to add new symlinks (if any), which need to be
150 # cleaned up on purge. Also remove old symlinks.
151 deb-systemd-helper update-state
"$unit" >/dev
/null || true
155 # FIXME: remove after beta is over and add hunk to actively remove the repo
156 BETA_SOURCES
="/etc/apt/sources.list.d/pvetest-for-beta.list"
157 if test -f "$BETA_SOURCES" && dpkg
--compare-versions "$2" 'lt' '7.0-9~' && dpkg
--compare-versions "$2" 'gt' '7.0~'; then
158 echo "Removing the during beta added pvetest repository file again"
159 rm -v "$BETA_SOURCES" || true
162 # FIXME: remove in PVE 8.0
163 if test ! -e /proxmox_install_mode
&& test -n "$2" && dpkg
--compare-versions "$2" 'lt' '7.0-6~'; then
164 # PVE 4.0 beta to 5.4 ISO had a bug and did not generated a unique machine-id. below is a
165 # very relaxed machine-id list from all ISOs (released, tests & internal) possibly affected
167 -e a0ee88c29b764c46a579dd89c86c2d84 \
168 -e ecbf104295bd4f8b90bb82dc2fa5e9e5 \
169 -e c8fa51cd0c254ea08b0e37c1e37afbb9 \
170 -e 2ec24eda629a4c8d8c1f8dac50a9ee5f \
171 -e ef8db290720047159b426bd322839d70 \
172 -e bd94244c0da6419a82a383e62dc03b51 \
173 -e 45d4e7046c3d4c26af8acd589f358ac6 \
174 -e 8c445f96b3064ff79f825ea78a3eefde \
175 -e 6f9fae0f0a794fd4b89b3abecfd7f182 \
176 -e 6f9fae0f0a794fd4b89b3abecfd7f182 \
177 -e 285de85759894b3f9ad9844a89045af6 \
178 -e 89971dede7b04c98b2b0bc8845f53320 \
179 -e 4e3b6e9550f24d638bc26211a7b37df5 \
180 -e bc2f684e31ee4daf95e45c62410a95b1 \
181 -e 8cc7bc883fd048b78a4af7433c48e341 \
182 -e 9b46d99712854566bb02a656a3ff9191 \
183 -e e7fc055af47048ee884dcb88a7474336 \
184 -e 13d879f75e6447a69ed85179bd93759a \
185 -e 5b59e448c3e74029af2ac91f572d68a7 \
186 -e 5a2bd0d11a6c41f9a33fd527751224ea \
187 -e 516afc72013c4b9da85b309aad987df2 \
188 -e b0ce8d24684845e8ac337c588a7715cb \
189 -e e0af064c16e9463e9fa980eac66427c1 \
190 -e 6e925d11b497446e8e7f2ff38e7cf891 \
191 -e eec280213051474d8bfe7e089a86744a \
192 -e 708ded6ee82a46c08b77fecda2284c6c \
193 -e 615cb2b78b2240289fef74da610c146f \
194 -e b965b329a7e246d5be66a8d367f5760d \
195 -e 5472a49c6436426fbebd7881f7b7f13b \
198 echo "found static machine-id bug from Proxmox VE ISO installer <= 5.4, regenerating machine-id"
199 systemd-id128 new |
tee /etc
/machine-id.new
/var
/lib
/dbus
/machine-id.new
201 mv /etc
/machine-id.new
/etc
/machine-id
202 mv /var
/lib
/dbus
/machine-id.new
/var
/lib
/dbus
/machine-id
203 echo "new machine-id generated, a reboot is recommended"
205 echo "machine-id check OK"
211 if test ! -e /proxmox_install_mode
; then
212 # modeled after code generated by dh_start
213 for unit
in ${UNITS}; do
214 if test -n "$2"; then
215 dh_action
="reload-or-restart";
219 if systemctl
-q is-enabled
"$unit"; then
220 deb-systemd-invoke
$dh_action "$unit"
225 if test ! -e /proxmox_install_mode
&& test -n "$2" && dpkg
--compare-versions "$2" 'lt' '7.2.11~'; then
226 if test -e /etc
/apt
/auth.conf
; then
227 migrate_apt_auth_conf
232 abort-upgrade|abort-remove|abort-deconfigure
)
235 *) echo "$0: didn't understand being called with \`$1'" 1>&2