system/mongodb: If user/group doesn't exist, exit 1.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2023-08-01 23:28:07 -04:00 committed by Willy Sudiarto Raharjo
parent 035396b379
commit a0d9c15065
No known key found for this signature in database
GPG key ID: 3F617144D7238786

View file

@ -68,10 +68,8 @@ fi
set -e
# Bail if user or group isn't valid on your system
if ! getent passwd mongo 1>/dev/null 2>/dev/null; then
cat << EOF
bailout() {
cat << EOF
You must have a mongo user to run this script
@ -79,18 +77,12 @@ cat << EOF
# useradd -u $MONGO_USER -d /var/lib/$PRGNAM -s /bin/false -g mongo mongo
EOF
exit 1
}
exit
elif ! getent group mongo 1>/dev/null 2>/dev/null; then
cat << EOF
You must have a mongo group to run this script
# groupadd -g $MONGO_GROUP mongo
EOF
exit
fi
# Bail if user or group isn't valid on your system
getent passwd mongo &>/dev/null || bailout
getent group mongo &>/dev/null || bailout
rm -fr $TMP/$SRC_FLDR $PKG
mkdir -p $TMP $PKG $OUTPUT