wok-6.x view nagisk/receipt @ rev 24308

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jan 17 18:18:17 2022 +0000 (2022-01-17)
parents bc37a1a08055
children e717a4953b0e
line source
1 # SliTaz package receipt.
3 PACKAGE="nagisk"
4 VERSION="1.2.9"
5 CATEGORY="network"
6 SHORT_DESC="Simple tool to monitor Asterisk from a Nagios server."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL3"
9 WEB_SITE="https://github.com/nicolargo/nagisk"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WGET_URL="${WEB_SITE}archive/v$VERSION.tar.gz"
14 DEPENDS="nagios-nrpe perl sudo"
15 BUILD_DEPENDS=""
17 # What is the latest version available today?
18 current_version()
19 {
20 wget -O - $WEB_SITE/tags 2>/dev/null | \
21 sed '/archive.*tar/!d;s|.*/[A-Za-z_-]*\(.*\).tar.*|\1|;q'
22 }
24 # Rules to gen a SliTaz package suitable for Tazpkg.
25 genpkg_rules()
26 {
27 mkdir -p $fs/usr/share/nagios/libexec
28 cp -a $src/nagisk.pl $fs/usr/share/nagios/libexec
29 sed -i 's/^elsif/} &/' $fs/usr/share/nagios/libexec/nagisk.pl
30 }
32 # Pre and post install commands for Tazpkg.
33 post_install()
34 {
35 grep -qs check_asterisk_version "$1/etc/nagios/nrpe.cfg" ||
36 cat >> "$1/etc/nagios/nrpe.cfg" <<EOT
37 command[check_asterisk_version]=/usr/share/nagios/libexec/nagisk.pl -c version
38 command[check_asterisk_peers]=/usr/share/nagios/libexec/nagisk.pl -c peers -w \$ARG1\$ -x \$ARG2\$
39 command[check_asterisk_peer]=/usr/share/nagios/libexec/nagisk.pl -c peer -p \$ARG1\$ -w \$ARG2\$ -x \$ARG3\$
40 command[check_asterisk_channels]=/usr/share/nagios/libexec/nagisk.pl -c channels -w \$ARG1\$ -x \$ARG2\$
41 command[check_asterisk_konference]=/usr/share/nagios/libexec/nagisk.pl -c konference -w \$ARG1\$ -x \$ARG2\$
42 command[check_asterisk_jabber]=/usr/share/nagios/libexec/nagisk.pl -c jabber -b \$ARG1\$
43 #command[check_asterisk_zaptel]=/usr/share/nagios/libexec/nagisk.pl -c zaptel
44 #command[check_asterisk_span]=/usr/share/nagios/libexec/nagisk.pl -c span -s \$ARG1\$
45 #command[check_asterisk_dahdi]=/usr/share/nagios/libexec/nagisk.pl -c dahdi
46 #command[check_asterisk_dahdi_span]=/usr/share/nagios/libexec/nagisk.pl -c dahdi_span -s \$ARG1\$
47 #command[check_asterisk_pri_span]=/usr/share/nagios/libexec/nagisk.pl -c pri_span -s \$ARG1\$
48 #command[check_asterisk_pri_spans]=/usr/share/nagios/libexec/nagisk.pl -c pri_spans
49 command[check_asterisk_registry]=/usr/share/nagios/libexec/nagisk.pl -c registry
50 EOT
51 grep '^nagios ALL=NOPASSWD' "$1/etc/sudoers" | grep -q asterisk ||
52 cat >> "$1/etc/sudoers" <<EOT
53 nagios ALL=NOPASSWD: /usr/sbin/asterisk
54 EOT
55 chroot "$1/" chown nagios:nagios /usr/share/nagios/libexec/nagisk.pl
56 }