wok view nagios/receipt @ rev 25037

Up glza (0.11.4)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 21 21:38:29 2022 +0000 (23 months ago)
parents afae00265386
children d3556b8f5c3d
line source
1 # SliTaz package receipt.
3 PACKAGE="nagios"
4 VERSION="4.4.7"
5 CATEGORY="network"
6 SHORT_DESC="Host and network monitoring."
7 MAINTAINER="erjo@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="https://www.nagios.org/"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
14 SUGGESTED="nagios-nrpe"
15 DEPENDS="apache libjpeg libltdl libpng nagios-plugins"
16 BUILD_DEPENDS="jpeg-dev libgd-dev libpng-dev libtool openssl-dev procps unzip"
17 # busybox ps and unzip do not supply the required options
19 # What is the latest version available today?
20 current_version()
21 {
22 wget -O - https://sourceforge.net/projects/nagios/files/ 2>/dev/null | \
23 sed '/scope="row/!d;/nagios-/!d;s|.*href="|"https://sourceforge.net|;q' | xargs wget -O - 2>/dev/null | \
24 sed '/scope="row/!d;s|.*href="|"https://sourceforge.net|;q' | xargs wget -O - 2>/dev/null | \
25 sed '/scope="row/!d;s|.*/nagios-||;s|.tar.*||;q'
26 }
28 # Rules to configure and make the package.
29 compile_rules()
30 {
31 while read patch_file
32 do
33 if [ ! -f done.$patch_file ]
34 then
35 patch -p1 < $stuff/$patch_file || return 1
36 touch done.$patch_file
37 fi
38 done <<EOT
39 $PACKAGE-Makefiles.u
40 EOT
42 ./configure \
43 --prefix=/usr \
44 --infodir=/usr/share/info \
45 --mandir=/usr/share/man \
46 --with-nagios-user=nagios \
47 --with-nagios-group=nagios \
48 --with-lockfile=/var/run/nagios/nagios.pid \
49 --with-checkresult-dir=/var/spool/nagios/checkresults \
50 --sysconfdir=/etc/nagios \
51 --with-httpd-conf=/etc/apache/conf.d \
52 --libexecdir=/usr/lib/nagios/plugins \
53 --sbindir=/usr/lib/nagios/cgi \
54 --datadir=/usr/share/nagios \
55 --localstatedir=/var/lib/nagios \
56 $CONFIGURE_ARGS
58 # 4.4.7 not required
59 # sed -i s!HTMLDIR=.*!HTMLDIR=/usr/share/nagios! html/Makefile
61 #~ make all && make DESTDIR=$DESTDIR fullinstall \
62 #~ && make DESTDIR=$DESTDIR install-config
63 make all &&
64 make install &&
65 make install-config &&
66 make install-commandmode &&
67 make install-webconf &&
68 make install-classicui
69 }
71 # Rules to gen a SliTaz package suitable for Tazpkg.
72 genpkg_rules()
73 {
74 mkdir -p $fs/etc/apache
75 mkdir -p $fs/etc/init.d
76 mkdir -p $fs/usr
77 mkdir -p $fs/var/lib/nagios/rw
78 mkdir -p $fs/var/log/nagios
79 mkdir -p $fs/var/spool/nagios/checkresults
81 cp -a $install/etc/apache $fs/etc
82 cp -a $install/etc/nagios $fs/etc
83 cp -a $stuff/nagios $fs/etc/init.d
84 install -o root -g root -m 644 $stuff/htpasswd.users \
85 $fs/etc/nagios/
87 cp -a $install/usr/bin $fs/usr
88 cp -a $install/usr/lib $fs/usr
89 cp -a $install/usr/share $fs/usr
91 # Put documentation in a separate package
92 rm -rf $fs/usr/share/nagios/docs
94 # Mofify Apache configuration for nagvis
95 sed -i 's/Options None/Options FollowSymLinks/' \
96 $fs/etc/apache/conf.d/nagios.conf
98 # Fix permissions
99 chmod 755 $fs/usr/bin/nagios*
100 }
102 post_install()
103 {
104 if ! grep -q nagios "$1/etc/passwd"
105 then
106 echo -n "Adding user and group nagios..."
107 chroot "$1/" addgroup -S nagios
108 chroot "$1/" adduser -S -D -H -G nagios nagios
109 status
110 fi
112 # Fix permissions for files and directories
113 chroot "$1/" chown -R nagios.nagios \
114 /var/log/nagios \
115 /var/spool/nagios \
116 /var/lib/nagios \
117 /usr/share/nagios \
118 /etc/nagios/*
120 chmod 2775 "$1/var/lib/nagios/rw"
121 chroot "$1/" addgroup www nagios
123 # Start Nagios daemon if we are on running system
124 [ "$1" ] || /etc/init.d/nagios start
126 # post_install messges
127 echo -e "\nTo start $PACKAGE server you can run :\n"
128 echo "/etc/init.d/$PACKAGE start"
129 echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n"
130 echo -e "Default user and password for the Web GUI is nagiosadmin and nagios"
131 }
133 pre_remove()
134 {
135 [ "$1" ] || /etc/init.d/nagios stop
136 }