#!/bin/bash # # nagios.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # nagios.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # default settings PACKAGE="nagios" PACKAGE_EXT="gz" VERSION=${VERSION:=4.4.10} BUILD=${BUILD:=1} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi # Check for nagios account here if ! grep ^nagios: /etc/group 2>&1 > /dev/null; then groupadd -g 213 nagios fi if ! grep ^nagios: /etc/passwd 2>&1 > /dev/null; then useradd -d /dev/null -s /bin/false -u 213 -g 213 -c "Nagios" nagios fi check_required SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT" URL="http://prdownloads.sourceforge.net/nagios/$SRC" _nagios_user="nagios" _nagios_group="nagios" _nagcmd_user="nagios" _nagcmd_group="nagios" _instdir="usr/share/nagios" _bindir="usr/bin" _vardir="var/nagios" _confdir="etc/nagios" _httpdconfdir="etc/httpd/extra/" _checkresultdir="var/nagios/spool/checkresults" _perldir="$_instdir/bin" get_source $SRC $URL unpack_source $SRC $PACKAGE-$VERSION CFLAGS="$SLKCFLAGS" ./configure \ --with-nagios-user=$_nagios_user \ --with-nagios-group=$_nagios_group \ --with-command-user=$_nagcmd_user \ --with-command-group=$_nagcmd_group \ --prefix="/$_instdir" \ --bindir="/$_bindir" \ --localstatedir="/$_vardir" \ --sysconfdir="/$_confdir" \ --with-checkresultdir="/$_checkresultdir" \ --with-httpd-conf="/$_httpdconfdir" \ --enable-embedded-perl || exit 1 make $NUMJOBS all || exit 2 DESTDIR="$PKG" make \ prefix=$_instdir \ BINDIR="/$_bindir" \ LOGDIR=/$_vardir \ CFGDIR=/$_confdir \ HTTPD_CONF=$_httpdconfdir \ CHECKRESULTDIR=/$_checkresultdir \ install install-config install-commandmode install -D -m 644 sample-config/httpd.conf $PKG/$_httpdconfdir/nagios.example.conf install -D -m 755 $CWD/rc.nagios $PKG/etc/rc.d/rc.nagios.new find $PKG/etc/nagios -name '*cfg' -exec mv "{}" "{}.sample" \; > /dev/null # Fix directory permissions chmod -R g-w $PKG/etc/nagios chmod -R o+r $PKG/etc/nagios chmod -R g-w $PKG/usr/bin chmod -R o+x $PKG/usr/bin chown -R root.root $PKG/usr/bin chmod -R g-w $PKG/usr/share/nagios/libexec chmod -R g-w $PKG/usr/share/nagios/sbin chmod -R g-w $PKG/usr/share/nagios/share chown -R root.root $PKG/usr/share/nagios mkdir -p $DOCS cp -a *.md Changelog INSTALLING LEGAL LICENSE THANKS UPGRADING $DOCS fixup_package $PKG # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi