]> git.proxmox.com Git - pve-cluster.git/blob - debian/pve-cluster.postinst
ensure problematic ha service is stopped during update
[pve-cluster.git] / debian / pve-cluster.postinst
1 #!/bin/bash
2
3 # abort if any command returns an error value
4 set -e
5
6 # handle problem with ha-manager <= 2.0-3 which cannot handle a pmxcfs
7 # restart correctly
8 # TODO: remove in PVE 6.0
9 ha_version=$(dpkg-query --showformat='${Version}' --show pve-ha-manager)
10 hacfg_version=$(dpkg-query --showformat='${Config-Version}' --show pve-ha-manager)
11
12 function handlehaservice {
13 if test -z "$1"; then
14 # no old version, nothing to do
15 true
16 else
17 if dpkg --compare-versions "$ha_version" '<=' '2.0-3' || dpkg --compare-versions "$hacfg_version" '<=' '2.0-3'; then
18 if systemctl --quiet "$2" "pve-ha-crm.service"; then
19 systemctl "$3" "pve-ha-crm.service"
20 fi
21 if systemctl --quiet "$2" "pve-ha-lrm.service"; then
22 systemctl "$3" "pve-ha-lrm.service"
23 fi
24 fi
25 fi
26 }
27
28
29 case "$1" in
30 configure)
31 handlehaservice "$2" 'is-active' 'stop'
32 ;;
33
34 esac
35
36 #DEBHELPER#
37
38 case "$1" in
39 configure)
40 handlehaservice "$2" 'is-enabled' 'start'
41 ;;
42
43 esac
44