#!/bin/sh ############################# ## Build script for: Nagios ## Creator: jmedina@tuxjm.net ## Date: 02 Feb 05 ## Builds package: Yes ## Source location: http://www.nagios.org ## Build script version: 1 ## Requirements: None ## ## Notes: Any special notes the person may need to edit this file. ## ## ChangeLog: ## 04/12/2005 Update to 2.0b3 ## 04/21/2005 Change permissions for the images in usr/share/nagios/images/logos ## so now are owned for root:root. # Set initial variables CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PKG=$TMP/package-nagios NAME=nagios VERSION=2.0b3 ARCH=${ARCH:-i486} BUILD=1jm PERL=/usr/bin/perl IMAGEPACK1=imagepak-base.tar.gz if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mcpu=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" fi if [ ! -d $TMP ]; then mkdir -p $TMP # location to build the source fi rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf ${NAME}-${VERSION} tar xvzf ${CWD}/${NAME}-${VERSION}.tar.gz cd ${TMP}/${NAME}-${VERSION} chown -R root.root . find . -perm 664 -exec chmod 644 {} \; find . -perm 775 -exec chmod 755 {} \; $PERL -pi.orig -e ' s|^(resource_file)=\@sysconfdir\@/resource.cfg|$1=\@sysconfdir\@/private/resource.cfg|; ' sample-config/nagios.cfg.in $PERL -pi -e ' s|/usr/local/nagios/var/rw|/var/log/nagios/rw|; s|/usr/local/nagios/libexec/eventhandlers|/usr/lib/nagios/plugins/eventhandlers|; ' contrib/eventhandlers/* contrib/eventhandlers/*/* CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --sbindir=/usr/lib/nagios/cgi \ --libexecdir=/usr/lib/nagios/plugins \ --datadir=/usr/share/nagios \ --sysconfdir=/etc/nagios \ --localstatedir=/var/log/nagios \ --with-nagios-user=nagios \ --with-nagios-grp=nagios \ --with-command-user=nobody \ --with-command-grp=nobody \ --with-mail=/bin/mail \ --with-init-dir=/etc/rc.d \ --with-lockfile=/var/run/nagios.pid \ --with-gd-lib=/usr/lib \ --with-gd-inc=/usr/include \ --with-cgiurl=/nagios/cgi-bin \ --with-htmurl=/nagios \ # --with-template-objects \ # --with-template-extinfo make all make -C contrib #install -d -m0755 ${PKG}/var/log/nagios/rw/ install -d -m0755 ${PKG}/usr/include/nagios/ \ ${PKG}/etc/apache/ \ ${PKG}/etc/nagios/private/ \ ${PKG}/usr/lib/nagios/plugins/eventhandlers/ chmod 750 ${PKG}/etc/nagios/private #chmod 2775 ${PKG}/var/log/nagios/rw make install DESTDIR=${PKG} INSTALL_OPTS="" COMMAND_OPTS="" # Don't use install-daemoninit instead install by hand #make install-daemoninit DESTDIR=${PKG} INSTALL_OPTS="" COMMAND_OPTS="" INIT_OPTS="" install -c -m 755 -d ${PKG}/etc/rc.d install -c -m 755 daemon-init ${PKG}/etc/rc.d/rc.nagios.new make install-commandmode DESTDIR=${PKG} COMMAND_OPTS="" # Don't use install-config instead install by hand :) #make install-config DESTDIR=${PKG} INSTALL_OPTS="" COMMAND_OPTS="" install -c -m 775 -d ${PKG}/etc/nagios install -c -m 664 sample-config/nagios.cfg ${PKG}/etc/nagios/nagios.cfg.new install -c -m 664 sample-config/cgi.cfg ${PKG}/etc/nagios/cgi.cfg.new install -c -m 660 sample-config/resource.cfg ${PKG}/etc/nagios/private/resource.cfg.new install -c -m 664 sample-config/template-object/bigger.cfg ${PKG}/etc/nagios/bigger.cfg.new install -c -m 664 sample-config/template-object/minimal.cfg ${PKG}/etc/nagios/minimal.cfg.new install -c -m 664 sample-config/template-object/checkcommands.cfg ${PKG}/etc/nagios/checkcommands.cfg.new install -c -m 664 sample-config/template-object/misccommands.cfg ${PKG}/etc/nagios/misccommands.cfg.new install -m0755 include/locations.h ${PKG}/usr/include/nagios/ install -m0644 sample-config/httpd.conf ${PKG}/etc/apache/nagios.conf.new make install -C contrib INSTALL="install" INSTALL_OPTS="" CGIDIR="${PKG}/usr/lib/nagios/cgi" \ BINDIR="${PKG}/usr/bin" cp -afv contrib/eventhandlers/* ${PKG}/usr/lib/nagios/plugins/eventhandlers/ #####chmod -R 755 ${PKG}/usr/lib/nagios/plugins/eventhandlers/* # Install logos tar -xvz -C ${PKG}/usr/share/nagios/images/logos -f ${CWD}/${IMAGEPACK1} chown -R root:root ${PKG}/usr/share/nagios/images/logos/base/* mkdir -p $PKG/usr/doc/${NAME}-${VERSION} cp -a Changelog INSTALLING LEGAL LICENSE nagios.spec README UPGRADING \ $PKG/usr/doc/${NAME}-${VERSION} ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) chown -R root.bin ${PKG}/usr/bin #####chmod -R 755 ${PKG}/usr/bin ${PKG}/usr/lib/nagios/ mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh # Build the package: cd $PKG makepkg -l y -c n ${TMP}/${NAME}-${VERSION}-${ARCH}-${BUILD}.tgz # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf ${TMP}/${NAME}-$VERSION rm -rf $PKG fi