wok view nagios/receipt @ rev 14466

nagios: add pre_remove
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Apr 27 09:26:24 2013 +0200 (2013-04-27)
parents 00ec8a4f1615
children 3765f181a6d5
line source
1 # SliTaz package receipt.
3 PACKAGE="nagios"
4 VERSION="3.5.0"
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 ./configure \
28 --prefix=/usr \
29 --infodir=/usr/share/info \
30 --mandir=/usr/share/man \
31 --with-nagios-user=nagios \
32 --with-nagios-group=nagios \
33 --with-lockfile=/var/run/nagios/nagios.pid \
34 --with-checkresult-dir=/var/spool/nagios/checkresults \
35 --sysconfdir=/etc/nagios \
36 --with-httpd-conf=/etc/apache/conf.d \
37 --libexecdir=/usr/lib/nagios/plugins \
38 --sbindir=/usr/lib/nagios/cgi \
39 --datadir=/usr/share/nagios \
40 --localstatedir=/var/lib/nagios \
41 $CONFIGURE_ARGS
43 sed -i s!HTMLDIR=.*!HTMLDIR=/usr/share/nagios! html/Makefile
45 #~ make all && make DESTDIR=$PWD/_pkg fullinstall \
46 #~ && make DESTDIR=$PWD/_pkg install-config
47 make all && make install \
48 && make install-config \
49 && make install-commandmode \
50 && make install-webconf \
51 && make install-classicui
53 }
55 # Rules to gen a SliTaz package suitable for Tazpkg.
56 genpkg_rules()
57 {
58 mkdir -p $fs/usr $fs/etc/init.d \
59 $fs/var/lib/nagios/rw \
60 $fs/var/run/nagios \
61 $fs/var/log/nagios \
62 $fs/var/spool/nagios/checkresults \
63 $fs/etc/apache
65 cp -a $install/etc/apache $fs/etc
66 cp -a $install/etc/nagios $fs/etc
67 cp -a $stuff/nagios $fs/etc/init.d
68 install -o root -g root -m 644 $stuff/htpasswd.users $fs/etc/nagios/
70 cp -a $install/usr/bin $fs/usr
71 cp -a $install/usr/lib $fs/usr
72 cp -a $install/usr/share $fs/usr
74 # Put doc in separate package
75 rm -rf $fs/usr/share/nagios/docs
77 # Fix Apache config for Nagvis
78 sed -i 's/Options None/Options FollowSymLinks/' $fs/etc/apache/conf.d/nagios.conf
80 # Fix permissions
81 chmod 755 $fs/usr/bin/nagios*
82 }
84 post_install()
85 {
86 if ! grep -q nagios $1/etc/passwd; then
87 echo -n "Adding user/group nagios..."
88 chroot $1/ addgroup -S nagios
89 chroot $1/ adduser -S -D -H -G nagios nagios
90 status
91 fi
93 # Fix perms for files and directories
94 chroot $1/ chown -R nagios.nagios /var/log/nagios \
95 /var/run/nagios \
96 /var/spool/nagios \
97 /var/lib/nagios \
98 /usr/share/nagios \
99 /etc/nagios/*
102 chmod 2775 $1/var/lib/nagios/rw
103 chroot $1/ addgroup www nagios
105 # Start Nagios daemon if we are on running system
106 [ -z $1 ] && /etc/init.d/nagios start
108 # post_install messges
109 echo -e "\nTo starts $PACKAGE server you can run :\n"
110 echo "/etc/init.d/$PACKAGE start"
111 echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n"
112 echo -e "Default login/password for the Web GUI is nagiosadmin/nagios"
113 }
115 pre_remove()
116 {
117 [ -z $1 ] && /etc/init.d/nagios stop
118 }