summaryrefslogtreecommitdiff
path: root/debian/prerm
diff options
context:
space:
mode:
authorBernhard Schmidt <berni@debian.org>2017-12-30 22:21:14 +0100
committerBernhard Schmidt <berni@debian.org>2017-12-30 22:21:14 +0100
commit166ec510cb88cc1213ba6f441ffb372836fbddd3 (patch)
tree8a8160ebeff4eaa8924367dbca91ff89fccbbb2d /debian/prerm
parent1e5f64f1519f3e43bdd34e2975c9c97840779592 (diff)
parent75286879ecd00a15e21cb9126643fef0316bd47f (diff)
Merge tag 'debian/2.4.4-2' into stretch-backports
openvpn Debian release 2.4.4-2
Diffstat (limited to 'debian/prerm')
-rw-r--r--debian/prerm34
1 files changed, 27 insertions, 7 deletions
diff --git a/debian/prerm b/debian/prerm
index b888ef8..ec08b7b 100644
--- a/debian/prerm
+++ b/debian/prerm
@@ -7,14 +7,34 @@
set -e
test $DEBIAN_SCRIPT_DEBUG && set -v -x
+#
+# POSIX-compliant shell function
+# to check for the existence of a command
+# Return 0 if found
+#
+pathfind() {
+ OLDIFS="$IFS"
+ IFS=:
+ for p in $PATH; do
+ if [ -x "$p/$*" ]; then
+ IFS="$OLDIFS"
+ return 0
+ fi
+ done
+ IFS="$OLDIFS"
+ return 1
+}
+
+
stop_vpn () {
- if [ -x "/etc/init.d/openvpn" ]; then
- if [ -x /usr/sbin/invoke-rc.d ] ; then
- invoke-rc.d openvpn stop
- else
- /etc/init.d/openvpn stop
- fi
- fi
+ if [ -x "/etc/init.d/openvpn" ]; then
+ pathfind invoke-rc.d
+ if [ $? = 0 ]; then
+ invoke-rc.d openvpn stop
+ else
+ /etc/init.d/openvpn stop
+ fi
+ fi
}