#!/bin/sh set -e #DEBHELPER# update_sync_job() { job="$1" echo "Updating sync job '$job' to make old 'remove-vanished' default explicit.." proxmox-backup-manager sync-job update "$job" --remove-vanished true \ || echo "Failed, please check sync.cfg manually!" } case "$1" in configure) # need to have user backup in the tape group usermod -a -G tape backup # modeled after dh_systemd_start output systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then 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 echo "Upgrading from older proxmox-backup-server: restart (not reload) daemons" _dh_action=try-restart else _dh_action=try-reload-or-restart fi 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 if dpkg --compare-versions "$2" 'lt' '2.2.2~'; then echo "moving prune schedule from datacenter config to new prune job config" proxmox-backup-manager update-to-prune-jobs-config \ || echo "Failed to move prune jobs, please check manually" 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="" # read from HERE doc because POSIX sh limitations while read -r key value; do if test "$key" = "sync:"; then if test -n "$prev_job"; then # previous job doesn't have an explicit value update_sync_job "$prev_job" fi prev_job=$value else prev_job="" fi done <&2 exit 1 ;; esac exit 0