wok-6.x annotate nagios/receipt @ rev 10505

gource: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed May 25 14:56:46 2011 +0200 (2011-05-25)
parents d1768332cee0
children bec5edcc9ad1
rev   line source
erjo@8330 1 # SliTaz package receipt.
erjo@8330 2
erjo@8330 3 PACKAGE="nagios"
erjo@8330 4 VERSION="3.2.3"
erjo@8330 5 CATEGORY="network"
erjo@8330 6 SHORT_DESC="Host and network monitoring"
erjo@8330 7 MAINTAINER="erjo@slitaz.org"
slaxemulator@8889 8 DEPENDS="apache nagios-plugins libpng libjpeg libltdl"
slaxemulator@8889 9 BUILD_DEPENDS="libgd-dev libpng-dev jpeg-dev libtool"
erjo@8330 10 TARBALL="$PACKAGE-$VERSION.tar.gz"
erjo@8330 11 WEB_SITE="http://www.nagios.org/"
erjo@8330 12 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
erjo@8330 13 SUGGESTED="nagios-nrpe"
erjo@8330 14
erjo@8330 15 # Rules to configure and make the package.
erjo@8330 16 compile_rules()
erjo@8330 17 {
erjo@8330 18 cd $src
erjo@8330 19 while read patch_file; do
erjo@8330 20 if [ ! -f done.$patch_file ]; then
slaxemulator@9700 21 patch -p1 < $stuff/$patch_file || return 1
erjo@8330 22 touch done.$patch_file
erjo@8330 23 fi
erjo@8330 24 done <<EOT
erjo@8330 25 $PACKAGE-$VERSION-Makefiles.u
erjo@8330 26 EOT
slaxemulator@9700 27 #patch -p1 < $stuff/nagios-3.2.1-Makefiles.u || return 1
erjo@8330 28 ./configure \
erjo@8330 29 --prefix=/usr \
erjo@8330 30 --infodir=/usr/share/info \
erjo@8330 31 --mandir=/usr/share/man \
erjo@8330 32 --with-nagios-user=nagios \
erjo@8330 33 --with-nagios-group=nagios \
erjo@8330 34 --with-lockfile=/var/run/nagios/nagios.pid \
erjo@8330 35 --with-checkresult-dir=/var/spool/nagios/checkresults \
erjo@8330 36 --sysconfdir=/etc/nagios \
erjo@8330 37 --with-httpd-conf=/etc/apache/conf.d \
erjo@8330 38 --libexecdir=/usr/lib/nagios/plugins \
erjo@8330 39 --sbindir=/usr/lib/nagios/cgi \
erjo@8330 40 --datadir=/usr/share/nagios \
erjo@9865 41 --htmldir=/usr/share/nagios \
erjo@8700 42 --localstatedir=/var/lib/nagios \
erjo@8330 43 $CONFIGURE_ARGS
erjo@8330 44
erjo@9865 45 sed -i s!HTMLDIR=.*!HTMLDIR=/usr/share/nagios! html/Makefile
erjo@9865 46
erjo@8330 47 make all && make DESTDIR=$PWD/_pkg fullinstall \
erjo@8330 48 && make DESTDIR=$PWD/_pkg install-config
erjo@8330 49 }
erjo@8330 50
erjo@8330 51 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@8330 52 genpkg_rules()
erjo@8330 53 {
erjo@8330 54 mkdir -p $fs/usr $fs/etc/init.d \
erjo@8700 55 $fs/var/lib/nagios/rw \
erjo@8330 56 $fs/var/run/nagios \
erjo@8330 57 $fs/var/spool/nagios/checkresults \
erjo@8330 58 $fs/etc/apache
erjo@8330 59
erjo@8330 60 cp -a $_pkg/etc/apache $fs/etc
erjo@8330 61 cp -a $_pkg/etc/nagios $fs/etc
erjo@8330 62 cp -a stuff/nagios $fs/etc/init.d
erjo@8330 63 install -o root -g root -m 644 stuff/htpasswd.users $fs/etc/nagios/
erjo@8330 64
erjo@8330 65 cp -a $_pkg/usr/bin $fs/usr
erjo@8330 66 cp -a $_pkg/usr/lib $fs/usr
erjo@8330 67 cp -a $_pkg/usr/share $fs/usr
erjo@8330 68
erjo@8330 69 # Put doc in separate package
erjo@8330 70 rm -rf $fs/usr/share/nagios/docs
erjo@8330 71
erjo@8330 72 # Fix Apache config for Nagvis
erjo@8330 73 sed -i 's/Options None/Options FollowSymLinks/' $fs/etc/apache/conf.d/nagios.conf
erjo@8700 74
erjo@8700 75 # Fix permissions
erjo@8700 76 chmod 755 $fs/usr/bin/nagios*
erjo@8330 77 }
erjo@8330 78
erjo@8330 79 post_install()
erjo@8330 80 {
erjo@8330 81 if ! grep -q nagios $1/etc/passwd; then
erjo@8330 82 echo -n "Adding user/group nagios..."
erjo@8330 83 chroot $1/ addgroup -S nagios
erjo@8330 84 chroot $1/ adduser -S -D -H -G nagios nagios
erjo@8330 85 status
erjo@8330 86 fi
erjo@8330 87
erjo@8330 88 # Fix perms for files and directories
erjo@8330 89 chroot $1/ chown -R nagios.nagios /var/log/nagios \
erjo@8330 90 /var/run/nagios \
erjo@8330 91 /var/spool/nagios \
erjo@8700 92 /var/lib/nagios \
erjo@8330 93 /usr/share/nagios \
erjo@8330 94 /etc/nagios/*
erjo@8330 95
erjo@8330 96
erjo@8700 97 chmod 2775 $1/var/lib/nagios/rw
erjo@8330 98 chroot $1/ addgroup www nagios
erjo@8330 99
erjo@8330 100 # Start Nagios daemon if we are on running system
erjo@8330 101 [ -z $1 ] && /etc/init.d/nagios start
erjo@8330 102
erjo@8330 103 # post_install messges
erjo@8330 104 echo -e "\nTo starts $PACKAGE server you can run :\n"
erjo@8330 105 echo "/etc/init.d/$PACKAGE start"
erjo@8330 106 echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n"
erjo@8330 107 echo -e "Default login/password for the Web GUI is nagiosadmin/nagios"
erjo@8330 108 }
erjo@8330 109