SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "nagisk"

# SliTaz package receipt.

PACKAGE="nagisk"
VERSION="1.2.9"
CATEGORY="network"
SHORT_DESC="Simple tool to monitor Asterisk from a Nagios server."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL3"
WEB_SITE="https://github.com/nicolargo/nagisk"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$WEB_SITE/archive/refs/tags/v$VERSION.tar.gz"

DEPENDS="nagios-nrpe perl sudo"
BUILD_DEPENDS=""

# What is the latest version available today?
current_version()
{
    wget -O - $WEB_SITE/tags 2>/dev/null | \
    sed '/archive.*tar/!d;s|.*/[A-Za-z_-]*\(.*\).tar.*|\1|;q'
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share/nagios/libexec
    cp -a $src/nagisk.pl    $fs/usr/share/nagios/libexec
    sed -i 's/^elsif/} &/'    $fs/usr/share/nagios/libexec/nagisk.pl
}

# Pre and post install commands for Tazpkg.
post_install()
{
    grep -qs check_asterisk_version "$1/etc/nagios/nrpe.cfg" ||
    cat >> "$1/etc/nagios/nrpe.cfg" <<EOT
command[check_asterisk_version]=/usr/share/nagios/libexec/nagisk.pl -c version
command[check_asterisk_peers]=/usr/share/nagios/libexec/nagisk.pl -c peers -w \$ARG1\$ -x \$ARG2\$
command[check_asterisk_peer]=/usr/share/nagios/libexec/nagisk.pl -c peer -p \$ARG1\$ -w \$ARG2\$ -x \$ARG3\$
command[check_asterisk_channels]=/usr/share/nagios/libexec/nagisk.pl -c channels -w \$ARG1\$ -x \$ARG2\$
command[check_asterisk_konference]=/usr/share/nagios/libexec/nagisk.pl -c konference -w \$ARG1\$ -x \$ARG2\$
command[check_asterisk_jabber]=/usr/share/nagios/libexec/nagisk.pl -c jabber -b \$ARG1\$
#command[check_asterisk_zaptel]=/usr/share/nagios/libexec/nagisk.pl -c zaptel
#command[check_asterisk_span]=/usr/share/nagios/libexec/nagisk.pl -c span -s \$ARG1\$
#command[check_asterisk_dahdi]=/usr/share/nagios/libexec/nagisk.pl -c dahdi
#command[check_asterisk_dahdi_span]=/usr/share/nagios/libexec/nagisk.pl -c dahdi_span -s \$ARG1\$
#command[check_asterisk_pri_span]=/usr/share/nagios/libexec/nagisk.pl -c pri_span -s \$ARG1\$
#command[check_asterisk_pri_spans]=/usr/share/nagios/libexec/nagisk.pl -c pri_spans
command[check_asterisk_registry]=/usr/share/nagios/libexec/nagisk.pl -c registry
EOT
    grep '^nagios ALL=NOPASSWD' "$1/etc/sudoers" | grep -q asterisk ||
    cat >> "$1/etc/sudoers" <<EOT
nagios ALL=NOPASSWD: /usr/sbin/asterisk
EOT
    chroot "$1/" chown nagios:nagios /usr/share/nagios/libexec/nagisk.pl
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)