SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "nagios-nrpe"

# SliTaz package receipt.

PACKAGE="nagios-nrpe"
VERSION="4.0.3"
CATEGORY="network"
SHORT_DESC="Service and network monitoring program, remote monitoring."
MAINTAINER="erjo@slitaz.org"
LICENSE="GPL2"
WEB_SITE="https://www.nagios.org/"
REPOLOGY="nrpe"

SOURCE="nrpe"
TARBALL="$SOURCE-$VERSION.tar.gz"
WGET_URL="https://github.com/NagiosEnterprises/$SOURCE/releases/download/$SOURCE-$VERSION/$TARBALL"

DEPENDS="libcrypto libssl nagios-plugins"
BUILD_DEPENDS="libcrypto-dev libwrap-dev openssl openssl-dev"

current_version()
{
    wget -O - ${WGET_URL%/down*} 2>/dev/null | \
    sed '/archive.*tar/!d;s|.*/nrpe-\(.*\).tar.*|\1|;q'
}

# Rules to configure and make the package.
compile_rules()
{
    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

    addgroup nagios
    adduser -D -G nagios nagios

    ./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    \
        --enable-ssl                \
        --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 install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/etc/nagios/objects
    mkdir -p $fs/etc/init.d

    cp -a $install/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 configuration file and 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
        echo -n "Adding user nagios..."
        chroot "$1/" adduser -S -D -H nagios
        status
    fi
    
    # Set permissions for files and directories
    chroot "$1/" chown -R nagios.nagios    /usr/lib/nagios/plugins
    chroot "$1/" chown  nagios.nagios    /etc/nagios/* 
    
    # Add check_nrpe in nagios configuration 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"
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)