summaryrefslogtreecommitdiff
path: root/debian/mongodb-enterprise-unstable-server.postinst
diff options
context:
space:
mode:
authorErnie Hershey <ernie.hershey@10gen.com>2013-10-04 20:12:44 -0400
committerErnie Hershey <ernie.hershey@10gen.com>2013-10-12 18:20:01 -0400
commitb57a0b403ef86071c2d8d8e8c32f54abb8907a75 (patch)
tree1e51113be134aded201d382f5a0d664cf5dea2b1 /debian/mongodb-enterprise-unstable-server.postinst
parentb2f87f53245b8c15eff65700a929984ebeab75a8 (diff)
downloadmongo-b57a0b403ef86071c2d8d8e8c32f54abb8907a75.tar.gz
SERVER-963 Externalize enterprise packaging spec files
Diffstat (limited to 'debian/mongodb-enterprise-unstable-server.postinst')
-rw-r--r--debian/mongodb-enterprise-unstable-server.postinst55
1 files changed, 55 insertions, 0 deletions
diff --git a/debian/mongodb-enterprise-unstable-server.postinst b/debian/mongodb-enterprise-unstable-server.postinst
new file mode 100644
index 00000000000..b9700a1232f
--- /dev/null
+++ b/debian/mongodb-enterprise-unstable-server.postinst
@@ -0,0 +1,55 @@
+#!/bin/sh
+# postinst script for mongodb
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ # create a mongodb group and user
+ if ! grep -q mongodb /etc/passwd; then
+ adduser --system --no-create-home mongodb
+ addgroup --system mongodb
+ adduser mongodb mongodb
+ fi
+
+ # create db -- note: this should agree with dbpath in mongod.conf
+ mkdir -p /var/lib/mongodb
+ chown -R mongodb:mongodb /var/lib/mongodb
+
+ # create logdir -- note: this should agree with logpath in mongod.conf
+ mkdir -p /var/log/mongodb
+ chown -R mongodb:mongodb /var/log/mongodb
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+