summaryrefslogtreecommitdiff
path: root/network/nagios/nagios.SlackBuild
diff options
context:
space:
mode:
authorMario Preksavec <mario@slackware.hr>2017-09-25 11:39:41 +0200
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-09-30 07:19:35 +0700
commitaf149b3737645ac9eca576de165cd8a1bc474d0a (patch)
tree67ced2184695051d905922d3072fd28b968e0c29 /network/nagios/nagios.SlackBuild
parent07efe8658c0f31705c451fef8907bde9cc85e8a9 (diff)
downloadslackbuilds-af149b3737645ac9eca576de165cd8a1bc474d0a.tar.gz
network/nagios: Updated for version 4.3.4.
Signed-off-by: Mario Preksavec <mario@slackware.hr>
Diffstat (limited to 'network/nagios/nagios.SlackBuild')
-rw-r--r--network/nagios/nagios.SlackBuild33
1 files changed, 26 insertions, 7 deletions
diff --git a/network/nagios/nagios.SlackBuild b/network/nagios/nagios.SlackBuild
index c2f2d5108d..d19ea44f60 100644
--- a/network/nagios/nagios.SlackBuild
+++ b/network/nagios/nagios.SlackBuild
@@ -24,7 +24,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=nagios
-VERSION=${VERSION:-4.3.2}
+VERSION=${VERSION:-4.3.4}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -63,14 +63,33 @@ else
LIBDIRSUFFIX=""
fi
+USERNAME=${USERNAME:-nagios}
+GROUPNAME=${GROUPNAME:-nagios}
+USERID=${USERID:-213}
+GROUPID=${GROUPID:-213}
+HOMEDIR=${HOMEDIR:-/var/nagios}
+SHELLNAME=${SHELLNAME:-/bin/bash}
+
+GETUSER=$(getent passwd $USERNAME)
+GETGROUP=$(getent group $GROUPNAME)
+
set -e
-# Check if the 'nagios' user & group exist:
-if [ "$(grep ^nagios /etc/passwd)" = "" -o "$(grep ^nagios /etc/group)" = "" ] ; then
- printf "\nYou must have a nagios user and group.\n\nExample:\n"
- printf "\t# groupadd -g 213 nagios\n"
- printf "\t# useradd -d /dev/null -s /bin/false -u 213 -g nagios nagios\n\n"
- exit 1
+if [ -z "$GETUSER" -o -z "$GETGROUP" ]; then
+ printf "\n You must have a \"$PRGNAM\" user and a group to run this script\n\n"
+ [ -z "$GETGROUP" ] && printf " # groupadd -g $GROUPID $GROUPNAME\n"
+ [ -z "$GETUSER" ] && printf " # useradd -u $USERID -d $HOMEDIR -s $SHELLNAME -g $GROUPNAME $USERNAME\n"
+ printf "\n"
+ exit 1
+fi
+
+if [[ ! $GETUSER =~ ^$USERNAME:[^:]+:$USERID:$GROUPID:[^:]*:$HOMEDIR:$SHELLNAME$ ]]; then
+ printf "\n You must update the \"$PRGNAM\" user to run this script\n\n"
+ [[ $GETUSER =~ ^[^:]+:[^:]+:[^:]+:[^:]+:[^:]*:([^:]+):([^:]+)$ ]]
+ [ "${BASH_REMATCH[1]}" != "$HOMEDIR" ] && printf " # usermod -d $HOMEDIR $USERNAME\n"
+ [ "${BASH_REMATCH[2]}" != "$SHELLNAME" ] && printf " # usermod -s $SHELLNAME $USERNAME\n"
+ printf "\n"
+ exit 1
fi
rm -rf $PKG