#!/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.3.4} 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" _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 ./configure \ --with-nagios-user=$_nagios_user \ --with-nagios-group=$_nagios_group \ --prefix="/$_instdir" \ --bindir="/$_bindir" \ --localstatedir="/$_vardir" \ --sysconfdir="/$_confdir" \ --with-httpd-conf="/$_httpdconfdir" \ --with-checkresultdir="/$_checkresultdir" \ --enable-embedded-perl make all || exit 2 make \ prefix=$PKG/$_instdir \ BINDIR=$PKG/$_bindir \ LOGDIR=$PKG/$_vardir \ CFGDIR=$PKG/$_confdir \ HTTPD_CONF=$PKG/$_httpdconfdir \ CHECKRESULTDIR=$PKG/$_checkresultdir \ install install-config install -D -m 755 daemon-init $PKG/etc/nagios/ install -D -m 644 sample-config/httpd.conf $PKG/$_httpdconfdir/nagios.example.conf install -D -m 755 $CWD/rc.nagios $PKG/etc/rc.d/init.d/nagios chmod -R g-w $PKG/var/nagios mkdir $PKG/var/nagios/rw chown $_nagios_user.$_nagios_group $PKG/var/nagios/rw chmod 775 $PKG/var/nagios/rw 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 Changelog INSTALLING LEGAL LICENSE README 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