wok view nagios-nrpe/receipt @ rev 24353

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Feb 03 12:55:23 2022 +0000 (2022-02-03)
parents 02aa9958ad62
children 5b83babda761
line source
1 # SliTaz package receipt.
3 PACKAGE="nagios-nrpe"
4 VERSION="4.0.2"
5 CATEGORY="network"
6 SHORT_DESC="Service and network monitoring program, remote monitoring."
7 MAINTAINER="erjo@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="https://www.nagios.org/"
11 SOURCE="nrpe"
12 TARBALL="$SOURCE-$VERSION.tar.gz"
13 WGET_URL="https://github.com/NagiosEnterprises/$SOURCE/releases/download/$SOURCE-$VERSION/$TARBALL"
15 BUILD_DEPENDS="libcrypto-dev libwrap-dev openssl openssl-dev"
16 DEPENDS="libcrypto libssl nagios-plugins"
18 current_version()
19 {
20 wget -O - ${WGET_URL%/down*} 2>/dev/null | \
21 sed '/archive.*tar/!d;s|.*/nrpe-\(.*\).tar.*|\1|;q'
22 }
24 # Rules to configure and make the package.
25 compile_rules()
26 {
27 while read patch_file
28 do
29 if [ ! -f done.$patch_file ]
30 then
31 patch -p1 < $stuff/$patch_file || return 1
32 touch done.$patch_file
33 fi
34 done <<EOT
35 $PACKAGE-$VERSION-Makefile.u
36 EOT
38 addgroup nagios
39 adduser -D -G nagios nagios
41 ./configure \
42 --prefix=/usr \
43 --infodir=/usr/share/info \
44 --localstatedir=/var \
45 --datadir=/usr/share/nagios \
46 --sysconfdir=/etc/nagios \
47 --sbindir=/usr/lib/nagios \
48 --bindir=/usr/bin \
49 --libexecdir=/usr/lib/nagios/plugins \
50 --enable-ssl \
51 --with-nagios-user=nagios \
52 --with-nagios-group=nagios \
53 --with-nrpe-user=nagios \
54 --with-nrpe-group=nagios \
55 --mandir=/usr/share/man \
56 $CONFIGURE_ARGS &&
57 make all &&
58 make install
59 }
61 # Rules to gen a SliTaz package suitable for Tazpkg.
62 genpkg_rules()
63 {
64 mkdir -p $fs/etc/nagios/objects
65 mkdir -p $fs/etc/init.d
67 cp -a $install/usr $fs
68 install -m 0644 $src/sample-config/nrpe.cfg $fs/etc/nagios
70 sed -i 's|/var/run|/var/run/nagios|' $fs/etc/nagios/nrpe.cfg
72 # Install configuration file and init script
73 install -o root -g root -m 644 $stuff/nrpe.cfg $fs/etc/nagios/objects
74 install -o root -g root -m 755 $stuff/nrpe $fs/etc/init.d
75 }
77 post_install()
78 {
79 if ! grep -q nagios "$1/etc/passwd"
80 then
81 echo
82 echo -n "Adding user nagios..."
83 chroot "$1/" adduser -S -D -H nagios
84 status
85 fi
87 # Set permissions for files and directories
88 chroot "$1/" chown -R nagios.nagios /usr/lib/nagios/plugins
89 chroot "$1/" chown nagios.nagios /etc/nagios/*
91 # Add check_nrpe in nagios configuration file
92 echo "cfg_file=/etc/nagios/objects/nrpe.cfg" >> "$1/etc/nagios/nagios.cfg"
93 }
95 post_remove()
96 {
97 [ -f "$1/etc/nagios/nagios.cfg" ] &&
98 sed -i 's/.*nrpe.cfg//' "$1/etc/nagios/nagios.cfg"
99 }