summaryrefslogtreecommitdiff
path: root/debian/elasticsearch.preinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/elasticsearch.preinst')
-rwxr-xr-xdebian/elasticsearch.preinst28
1 files changed, 28 insertions, 0 deletions
diff --git a/debian/elasticsearch.preinst b/debian/elasticsearch.preinst
new file mode 100755
index 0000000..6ae63cb
--- /dev/null
+++ b/debian/elasticsearch.preinst
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install|upgrade)
+ if ! getent group 'elasticsearch' > /dev/null 2>&1 ; then
+ addgroup --system elasticsearch --quiet
+ fi
+ if ! getent user 'elasticsearch' > /dev/null 2>&1 ; then
+ adduser --system --home /var/lib/elasticsearch --no-create-home \
+ --ingroup elasticsearch --disabled-password --shell /bin/false \
+ elasticsearch
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0