5
0
mirror of git://git.proxmox.com/git/pve-cluster.git synced 2025-03-12 20:58:25 +03:00

build: fix sysctl.d install path

and remove the directory before installing the snippet when upgrading
from a broken version (and if the incorrect directory exists).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2017-12-06 20:39:49 +01:00 committed by Wolfgang Bumiller
parent 08115244e4
commit 8639f6be74
3 changed files with 35 additions and 1 deletions

2
debian/install vendored
View File

@ -1 +1 @@
debian/sysctl.conf etc/sysctl.d/pve.conf
debian/sysctl.d/pve.conf etc/sysctl.d

34
debian/pve-cluster.preinst vendored Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
# abort if any command returns an error value
set -e
# handle incorrectly installed sysctl.d snippet (pve-cluster 5.0-16 and -17)
# TODO: remove in PVE 6.0
function sysctlcleanup {
if test -z "$1"; then
# no old version, nothing to do
true
else
if dpkg --compare-versions "$1" '<=' '5.0-17'; then
# remove directory if it exists
# otherwise we can't install our actual pve.conf file
if test -d '/etc/sysctl.d/pve.conf'; then
rm -rf '/etc/sysctl.d/pve.conf'
fi
fi
fi
}
case "$1" in
upgrade)
sysctlcleanup "$2"
;;
install)
sysctlcleanup "$2"
;;
esac
#DEBHELPER#