wok-stable view nagios/receipt @ rev 12460

fix symlinks
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Apr 28 09:09:24 2017 +0200 (2017-04-28)
parents d1768332cee0
children
line source
1 # SliTaz package receipt.
3 PACKAGE="nagios"
4 VERSION="3.2.3"
5 CATEGORY="network"
6 SHORT_DESC="Host and network monitoring"
7 MAINTAINER="erjo@slitaz.org"
8 DEPENDS="apache nagios-plugins libpng libjpeg libltdl"
9 BUILD_DEPENDS="libgd-dev libpng-dev jpeg-dev libtool"
10 TARBALL="$PACKAGE-$VERSION.tar.gz"
11 WEB_SITE="http://www.nagios.org/"
12 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
13 SUGGESTED="nagios-nrpe"
15 # Rules to configure and make the package.
16 compile_rules()
17 {
18 cd $src
19 while read patch_file; do
20 if [ ! -f done.$patch_file ]; then
21 patch -p1 < $stuff/$patch_file || return 1
22 touch done.$patch_file
23 fi
24 done <<EOT
25 $PACKAGE-$VERSION-Makefiles.u
26 EOT
27 #patch -p1 < $stuff/nagios-3.2.1-Makefiles.u || return 1
28 ./configure \
29 --prefix=/usr \
30 --infodir=/usr/share/info \
31 --mandir=/usr/share/man \
32 --with-nagios-user=nagios \
33 --with-nagios-group=nagios \
34 --with-lockfile=/var/run/nagios/nagios.pid \
35 --with-checkresult-dir=/var/spool/nagios/checkresults \
36 --sysconfdir=/etc/nagios \
37 --with-httpd-conf=/etc/apache/conf.d \
38 --libexecdir=/usr/lib/nagios/plugins \
39 --sbindir=/usr/lib/nagios/cgi \
40 --datadir=/usr/share/nagios \
41 --htmldir=/usr/share/nagios \
42 --localstatedir=/var/lib/nagios \
43 $CONFIGURE_ARGS
45 sed -i s!HTMLDIR=.*!HTMLDIR=/usr/share/nagios! html/Makefile
47 make all && make DESTDIR=$PWD/_pkg fullinstall \
48 && make DESTDIR=$PWD/_pkg install-config
49 }
51 # Rules to gen a SliTaz package suitable for Tazpkg.
52 genpkg_rules()
53 {
54 mkdir -p $fs/usr $fs/etc/init.d \
55 $fs/var/lib/nagios/rw \
56 $fs/var/run/nagios \
57 $fs/var/spool/nagios/checkresults \
58 $fs/etc/apache
60 cp -a $_pkg/etc/apache $fs/etc
61 cp -a $_pkg/etc/nagios $fs/etc
62 cp -a stuff/nagios $fs/etc/init.d
63 install -o root -g root -m 644 stuff/htpasswd.users $fs/etc/nagios/
65 cp -a $_pkg/usr/bin $fs/usr
66 cp -a $_pkg/usr/lib $fs/usr
67 cp -a $_pkg/usr/share $fs/usr
69 # Put doc in separate package
70 rm -rf $fs/usr/share/nagios/docs
72 # Fix Apache config for Nagvis
73 sed -i 's/Options None/Options FollowSymLinks/' $fs/etc/apache/conf.d/nagios.conf
75 # Fix permissions
76 chmod 755 $fs/usr/bin/nagios*
77 }
79 post_install()
80 {
81 if ! grep -q nagios $1/etc/passwd; then
82 echo -n "Adding user/group nagios..."
83 chroot $1/ addgroup -S nagios
84 chroot $1/ adduser -S -D -H -G nagios nagios
85 status
86 fi
88 # Fix perms for files and directories
89 chroot $1/ chown -R nagios.nagios /var/log/nagios \
90 /var/run/nagios \
91 /var/spool/nagios \
92 /var/lib/nagios \
93 /usr/share/nagios \
94 /etc/nagios/*
97 chmod 2775 $1/var/lib/nagios/rw
98 chroot $1/ addgroup www nagios
100 # Start Nagios daemon if we are on running system
101 [ -z $1 ] && /etc/init.d/nagios start
103 # post_install messges
104 echo -e "\nTo starts $PACKAGE server you can run :\n"
105 echo "/etc/init.d/$PACKAGE start"
106 echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n"
107 echo -e "Default login/password for the Web GUI is nagiosadmin/nagios"
108 }