2020-06-22 07:39:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
#DEBHELPER#
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
configure)
|
2021-03-10 14:22:50 +00:00
|
|
|
# need to have user backup in the tape group
|
2021-01-30 10:48:49 +00:00
|
|
|
usermod -a -G tape backup
|
|
|
|
|
2020-06-22 07:39:37 +00:00
|
|
|
# modeled after dh_systemd_start output
|
|
|
|
systemctl --system daemon-reload >/dev/null || true
|
|
|
|
if [ -n "$2" ]; then
|
2021-03-11 07:17:21 +00:00
|
|
|
if dpkg --compare-versions "$2" 'lt' '1.0.7-1'; then
|
|
|
|
# there was an issue with reloading and systemd being confused in older daemon versions
|
|
|
|
# so restart instead of reload if upgrading from there, see commit 0ec79339f7aebf9
|
|
|
|
# FIXME: remove with PBS 2.1
|
2021-03-11 12:39:27 +00:00
|
|
|
echo "Upgrading from older proxmox-backup-server: restart (not reload) daemons"
|
2021-03-11 07:17:21 +00:00
|
|
|
_dh_action=try-restart
|
|
|
|
else
|
|
|
|
_dh_action=try-reload-or-restart
|
|
|
|
fi
|
2020-06-22 07:39:37 +00:00
|
|
|
else
|
|
|
|
_dh_action=start
|
|
|
|
fi
|
2020-06-22 08:44:26 +00:00
|
|
|
deb-systemd-invoke $_dh_action proxmox-backup.service proxmox-backup-proxy.service >/dev/null || true
|
2020-08-18 16:41:30 +00:00
|
|
|
|
2020-10-29 18:58:41 +00:00
|
|
|
# FIXME: Remove with 1.1
|
|
|
|
if test -n "$2"; then
|
|
|
|
if dpkg --compare-versions "$2" 'lt' '0.9.4-1'; then
|
2020-10-29 19:25:28 +00:00
|
|
|
if grep -s -q -P -e '^\s+verify-schedule ' /etc/proxmox-backup/datastore.cfg; then
|
2020-10-29 18:58:41 +00:00
|
|
|
echo "NOTE: drop all verify schedules from datastore config."
|
|
|
|
echo "You can now add more flexible verify jobs"
|
|
|
|
flock -w 30 /etc/proxmox-backup/.datastore.lck \
|
|
|
|
sed -i '/^\s\+verify-schedule /d' /etc/proxmox-backup/datastore.cfg || true
|
|
|
|
fi
|
|
|
|
fi
|
2020-11-04 15:12:13 +00:00
|
|
|
if dpkg --compare-versions "$2" 'le' '0.9.5-1'; then
|
|
|
|
chown --quiet backup:backup /var/log/proxmox-backup/api/auth.log || true
|
|
|
|
fi
|
2020-11-10 13:35:37 +00:00
|
|
|
if dpkg --compare-versions "$2" 'le' '0.9.7-1'; then
|
2020-11-05 11:12:25 +00:00
|
|
|
if [ -e /etc/proxmox-backup/remote.cfg ]; then
|
|
|
|
echo "NOTE: Switching over remote.cfg to new field names.."
|
|
|
|
flock -w 30 /etc/proxmox-backup/.remote.lck \
|
|
|
|
sed -i \
|
|
|
|
-e 's/^\s\+userid /\tauth-id /g' \
|
|
|
|
/etc/proxmox-backup/remote.cfg || true
|
|
|
|
fi
|
|
|
|
fi
|
2021-03-11 09:18:39 +00:00
|
|
|
# FIXME: remove with 2.0
|
|
|
|
if [ -d "/var/lib/proxmox-backup/tape" ] &&
|
|
|
|
[ "$(stat --printf '%a' '/var/lib/proxmox-backup/tape')" != "750" ]; then
|
|
|
|
chmod 0750 /var/lib/proxmox-backup/tape || true
|
|
|
|
fi
|
2021-03-11 09:07:23 +00:00
|
|
|
# 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
|
2020-08-18 16:41:30 +00:00
|
|
|
fi
|
2020-06-22 07:39:37 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|