summaryrefslogtreecommitdiff
path: root/debian/mongodb-enterprise-unstable-server.postinst
diff options
context:
space:
mode:
authorRamon Fernandez <ramon@mongodb.com>2017-05-22 18:56:02 -0400
committerRamon Fernandez <ramon@mongodb.com>2017-05-22 18:56:02 -0400
commitcb1ea2ad2254ad9794138c366ef8737443dfc348 (patch)
tree0d15ca82f35d5708a65c8e783ed682336e8af9ab /debian/mongodb-enterprise-unstable-server.postinst
parent5cc9a5e0622b7f4d4a907aaf3fad77330b245610 (diff)
downloadmongo-cb1ea2ad2254ad9794138c366ef8737443dfc348.tar.gz
SERVER-23516 Packages should not modify permissions when dbpath exists
Diffstat (limited to 'debian/mongodb-enterprise-unstable-server.postinst')
-rw-r--r--debian/mongodb-enterprise-unstable-server.postinst24
1 files changed, 14 insertions, 10 deletions
diff --git a/debian/mongodb-enterprise-unstable-server.postinst b/debian/mongodb-enterprise-unstable-server.postinst
index 2914fb85631..52761cd3e3f 100644
--- a/debian/mongodb-enterprise-unstable-server.postinst
+++ b/debian/mongodb-enterprise-unstable-server.postinst
@@ -20,20 +20,24 @@ set -e
case "$1" in
configure)
- # create a mongodb group and user
+ # create a mongodb group and user
if ! getent passwd mongodb >/dev/null 2>&1; then
- adduser --system --no-create-home mongodb
- addgroup --system mongodb
- adduser mongodb mongodb
+ 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 db -- note: this should agree with dbpath in mongod.conf
+ if [ ! -d /var/lib/mongodb ]; then
+ mkdir -p /var/lib/mongodb
+ chown mongodb:mongodb /var/lib/mongodb
+ fi
- # create logdir -- note: this should agree with logpath in mongod.conf
- mkdir -p /var/log/mongodb
- chown -R mongodb:mongodb /var/log/mongodb
+ # create logdir -- note: this should agree with logpath in mongod.conf
+ if [ ! -d /var/log/mongodb ]; then
+ mkdir -p /var/log/mongodb
+ chown mongodb:mongodb /var/log/mongodb
+ fi
;;
abort-upgrade|abort-remove|abort-deconfigure)