]> git.proxmox.com Git - proxmox-backup.git/blame - debian/postinst
d/postinst: restart when updating from older version
[proxmox-backup.git] / debian / postinst
CommitLineData
b28253d6
DM
1#!/bin/sh
2
3set -e
4
5#DEBHELPER#
6
7case "$1" in
8 configure)
227f3649 9 # need to have user backup in the tape group
a57ce270
DM
10 usermod -a -G tape backup
11
b28253d6
DM
12 # modeled after dh_systemd_start output
13 systemctl --system daemon-reload >/dev/null || true
b28253d6 14 if [ -n "$2" ]; then
e056966b
TL
15 if dpkg --compare-versions "$2" 'lt' '1.0.7-1'; then
16 # there was an issue with reloading and systemd being confused in older daemon versions
17 # so restart instead of reload if upgrading from there, see commit 0ec79339f7aebf9
18 # FIXME: remove with PBS 2.1
19 _dh_action=try-restart
20 else
21 _dh_action=try-reload-or-restart
22 fi
b28253d6
DM
23 else
24 _dh_action=start
25 fi
d7992679 26 deb-systemd-invoke $_dh_action proxmox-backup.service proxmox-backup-proxy.service >/dev/null || true
aafe8609 27
83b039af
TL
28 # FIXME: Remove with 1.1
29 if test -n "$2"; then
30 if dpkg --compare-versions "$2" 'lt' '0.9.4-1'; then
603a6bd1 31 if grep -s -q -P -e '^\s+verify-schedule ' /etc/proxmox-backup/datastore.cfg; then
83b039af
TL
32 echo "NOTE: drop all verify schedules from datastore config."
33 echo "You can now add more flexible verify jobs"
34 flock -w 30 /etc/proxmox-backup/.datastore.lck \
35 sed -i '/^\s\+verify-schedule /d' /etc/proxmox-backup/datastore.cfg || true
36 fi
37 fi
4fdf13f9
TL
38 if dpkg --compare-versions "$2" 'le' '0.9.5-1'; then
39 chown --quiet backup:backup /var/log/proxmox-backup/api/auth.log || true
40 fi
ff7a2910 41 if dpkg --compare-versions "$2" 'le' '0.9.7-1'; then
10052ea6
FG
42 if [ -e /etc/proxmox-backup/remote.cfg ]; then
43 echo "NOTE: Switching over remote.cfg to new field names.."
44 flock -w 30 /etc/proxmox-backup/.remote.lck \
45 sed -i \
46 -e 's/^\s\+userid /\tauth-id /g' \
47 /etc/proxmox-backup/remote.cfg || true
48 fi
49 fi
83b039af 50 fi
ab661513
SR
51 # FIXME: Remove in future version once we're sure no broken entries remain in anyone's files
52 if grep -q -e ':termproxy::[^@]\+: ' /var/log/proxmox-backup/tasks/active; then
53 echo "Fixing up termproxy user id in task log..."
83b039af 54 flock -w 30 /var/log/proxmox-backup/tasks/active.lock sed -i 's/:termproxy::\([^@]\+\): /:termproxy::\1@pam: /' /var/log/proxmox-backup/tasks/active || true
aafe8609 55 fi
b28253d6
DM
56 ;;
57
58 abort-upgrade|abort-remove|abort-deconfigure)
59 ;;
60
61 *)
62 echo "postinst called with unknown argument \`$1'" >&2
63 exit 1
64 ;;
65esac
66
67exit 0