diff options
author | B. Watson <urchlay@slackware.uk> | 2023-08-01 23:28:07 -0400 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-08-12 08:29:50 +0700 |
commit | a0d9c15065b131731699969fa740ac4e78532ac9 (patch) | |
tree | aaff427d715c43024b3f94f6efa70f2eb4574d15 | |
parent | 035396b379c5890c0df1d7ddca737954bf1cd2ff (diff) |
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>
-rw-r--r-- | system/mongodb/mongodb.SlackBuild | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/system/mongodb/mongodb.SlackBuild b/system/mongodb/mongodb.SlackBuild index e2d613fe6946..fdf3e89a2312 100644 --- a/system/mongodb/mongodb.SlackBuild +++ b/system/mongodb/mongodb.SlackBuild @@ -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 |