5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-05 09:17:59 +03:00

d/postinst: try to fixup installations with wrong .datastore.lck owner

Must be a rather ancient installation in that case as we create
new lockfiles with backup:backup since a while.

Note that this wasn't all to relevant until recently when we fixed a
TOCTOU for maintenance mode check by locking on datastore create,
which happens in the unpriv. proxy daemon too, e.g., for the
datastore status call.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-11-28 17:03:39 +01:00
parent 551890c8a0
commit b287a702b7

10
debian/postinst vendored
View File

@ -48,6 +48,16 @@ case "$1" in
true
fi
if dpkg --compare-versions "$2" 'lt' '2.3.1~'; then
lock_user="$(stat --format '%U' /etc/proxmox-backup/.datastore.lck)"
if [ "${lock_user}" != "backup" ]; then
echo "updating /etc/proxmox-backup/.datastore.lck from wrong user '${lock_user}' to 'backup'"
chown backup:backup /etc/proxmox-backup/.datastore.lck \
|| printf "Failed to fix datastore.lck user, please retry manually with:\n\n\t%s\n\n" \
"chown backup:backup /etc/proxmox-backup/.datastore.lck"
fi
fi
if dpkg --compare-versions "$2" 'lt' '2.1.3~' && test -e /etc/proxmox-backup/sync.cfg; then
prev_job=""