summaryrefslogtreecommitdiff
path: root/src/deb/control/prerm
diff options
context:
space:
mode:
authorHilko Bengen <bengen@debian.org>2014-06-07 12:02:12 +0200
committerHilko Bengen <bengen@debian.org>2014-06-07 12:02:12 +0200
commitd5ed89b946297270ec28abf44bef2371a06f1f4f (patch)
treece2d945e4dde69af90bd9905a70d8d27f4936776 /src/deb/control/prerm
downloadelasticsearch-d5ed89b946297270ec28abf44bef2371a06f1f4f.tar.gz
Imported Upstream version 1.0.3upstream/1.0.3
Diffstat (limited to 'src/deb/control/prerm')
-rwxr-xr-xsrc/deb/control/prerm26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/deb/control/prerm b/src/deb/control/prerm
new file mode 100755
index 0000000..fb3c9eb
--- /dev/null
+++ b/src/deb/control/prerm
@@ -0,0 +1,26 @@
+#!/bin/sh
+set -e
+
+[ -f /etc/default/elasticsearch ] && . /etc/default/elasticsearch
+
+stopElasticsearch() {
+ if [ -x "/etc/init.d/elasticsearch" ]; then
+ if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+ invoke-rc.d elasticsearch stop || true
+ else
+ /etc/init.d/elasticsearch stop || true
+ fi
+ fi
+}
+
+case "$1" in
+ upgrade)
+ if [ "$RESTART_ON_UPGRADE" = "true" ] ; then
+ stopElasticsearch
+ fi
+ ;;
+ remove)
+ stopElasticsearch
+ ;;
+esac
+