proxmox-backup/debian/postinst
Thomas Lamprecht 6ca2162074 d/postinst: fix setting up pbs-test repo for beta
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-07-24 15:30:52 +02:00

68 lines
2.3 KiB
Bash

#!/bin/sh
set -e
#DEBHELPER#
case "$1" in
configure)
# need to have user backup in the tape group
usermod -a -G tape backup
# FIXME: remove after beta is over and add hunk to actively remove the repo
BETA_SOURCES="/etc/apt/sources.list.d/pbs-test-for-beta.sources"
if test -e /proxmox_install_mode && ! test -f "$BETA_SOURCES"; then
echo "Adding pbs-test repo to '$BETA_SOURCES' to enable updates during Proxmox Backup Server 4.0 BETA"
printf 'Types: deb\nURIs: http://download.proxmox.com/debian/pbs\nSuites: trixie\nComponents: pbs-test\nSigned-By: /usr/share/keyrings/proxmox-archive-keyring.gpg\n' \
| tee "$BETA_SOURCES"
fi
# modeled after dh_systemd_start output
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=try-reload-or-restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action proxmox-backup.service proxmox-backup-proxy.service >/dev/null || true
if test -n "$2"; then
# FIXME: Remove in future version once we're sure no broken entries remain in anyone's files
if grep -q -e ':termproxy::[^@]\+: ' /var/log/proxmox-backup/tasks/active; then
echo "Fixing up termproxy user id in task log..."
flock -w 30 /var/log/proxmox-backup/tasks/active.lock sed -i 's/:termproxy::\([^@]\+\): /:termproxy::\1@pam: /' /var/log/proxmox-backup/tasks/active || true
fi
# TODO: remove with 4.1+, this was just exposed on internal testing.
if dpkg --compare-versions "$2" 'lt' '4.0.5~'; then
if [ -e /etc/proxmox-backup/s3.cfg ]; then
sed -i 's/^s3client:/s3-endpoint:/' /etc/proxmox-backup/s3.cfg \
|| echo "Failed to rename 's3client' config section-type to 's3-endpoint' in /etc/proxmox-backup/s3.cfg."
fi
fi
# TODO: remove with PBS 5+
if dpkg --compare-versions "$2" 'lt' '4.0.2~'; then
proxmox-backup-manager migrate-config default-notification-mode \
|| echo "Failed migrate tape-job/datastore notification mode, please check manually"
fi
if dpkg --compare-versions "$2" 'lt' '3.3.5~'; then
# ensure old locking is used by the daemon until a reboot happened
touch "/run/proxmox-backup/old-locking"
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0