SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "nagios-nrpe"

# SliTaz package receipt.

PACKAGE="nagios-nrpe"
VERSION="2.12"
CATEGORY="network"
SHORT_DESC="Service and network monitoring program, remote monitoring."
MAINTAINER="erjo@slitaz.org"
SOURCE="nrpe"
TARBALL="$SOURCE-$VERSION.tar.gz"
WEB_SITE="http://www.nagios.org/"
WGET_URL="$SF_MIRROR/nagios/$TARBALL"
BUILD_DEPENDS="libcrypto-dev openssl-dev openssl libwrap-dev"
DEPENDS="nagios-plugins libssl libcrypto"

# Rules to configure and make the package.
compile_rules()
{
    cd $src
        while read patch_file; do
        if [ ! -f done.$patch_file ]; then
            patch -p1 < $stuff/$patch_file || return 1
            touch done.$patch_file
        fi
    done <<EOT
$PACKAGE-$VERSION-Makefile.u
EOT
    ./configure --prefix=/usr --infodir=/usr/share/info \
    --localstatedir=/var \
    --datadir=/usr/share/nagios \
    --sysconfdir=/etc/nagios \
    --sbindir=/usr/lib/nagios \
    --bindir=/usr/bin \
    --libexecdir=/usr/lib/nagios/plugins \
    --with-nagios-user=nagios \
    --with-nagios-group=nagios \
    --with-nrpe-user=nagios \
    --with-nrpe-group=nagios \
    --mandir=/usr/share/man $CONFIGURE_ARGS &&
    make all &&
    make DESTDIR=$PWD/_pkg install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/etc/nagios/objects \
        $fs/etc/init.d \
         $fs/var/run/nagios
    
    cp -a $_pkg/usr $fs
    install -m 0644 $src/sample-config/nrpe.cfg $fs/etc/nagios
    sed -i 's|/var/run|/var/run/nagios|' $fs/etc/nagios/nrpe.cfg
    
    # Install config file nd init script
    install -o root -g root -m 644 stuff/nrpe.cfg $fs/etc/nagios/objects
    install -o root -g root -m 755 stuff/nrpe $fs/etc/init.d
}

post_install()
{
    if ! grep -q nagios $1/etc/passwd; then
        echo -n "Adding user nagios..."
        chroot $1/ adduser -S -D -H nagios
        status
    fi
    
    # Set perms for files and directories
    chroot $1/ chown -R nagios.nagios /usr/lib/nagios/plugins  /var/run/nagios
    chroot $1/ chown  nagios.nagios /etc/nagios/* 
    
    # Add check_nrpe in nagios config file
    echo "cfg_file=/etc/nagios/objects/nrpe.cfg" >> $1/etc/nagios/nagios.cfg
}

post_remove()
{
    [ -f $1/etc/nagios/nagios.cfg ] && sed -i 's/.*nrpe.cfg//' $1/etc/nagios/nagios.cfg
}
3382 packages and 430813 files in stable database (Mon Mar 4 17:53:49 2019)