[Pkg-mongodb-maintainers] [pkg-mongodb] 04/11: Only create the mongodb user when it doesn't exist

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Mon Oct 2 07:55:14 UTC 2017


This is an automated email from the git hooks/post-receive script.

apoikos pushed a commit to branch master
in repository pkg-mongodb.

commit 1c41bbdc414f170049a805451e3b578fcbfc0463
Author: Apollon Oikonomopoulos <apoikos at debian.org>
Date:   Tue Sep 26 11:08:02 2017 +0300

    Only create the mongodb user when it doesn't exist
    
    Closes: #858903
---
 debian/mongodb-server.postinst | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/debian/mongodb-server.postinst b/debian/mongodb-server.postinst
index aa9e3c3..713baae 100644
--- a/debian/mongodb-server.postinst
+++ b/debian/mongodb-server.postinst
@@ -21,9 +21,11 @@ set -e
 case "$1" in
     configure)
 	# create a mongodb group and user
-	adduser --system --disabled-password --disabled-login \
-		--home /var/lib/mongodb --no-create-home \
-		--quiet --group mongodb
+	if ! getent passwd mongodb >/dev/null; then
+		adduser --system --disabled-password --disabled-login \
+			--home /var/lib/mongodb --no-create-home \
+			--quiet --group mongodb
+	fi
 
 	for dir in /var/lib/mongodb /var/log/mongodb; do
 		if ! dpkg-statoverride --list "$dir" >/dev/null 2>&1; then

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mongodb/pkg-mongodb.git



More information about the Pkg-mongodb-maintainers mailing list