wok-current view ndoutils/receipt @ rev 16649
libxfcegui4: xfce_setenv is removed in libxfce4util 4.11.0
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue May 13 08:32:11 2014 +0000 (2014-05-13) |
parents | 9938a922ca78 |
children | 0d8a1a3edc72 |
line source
1 # SliTaz package receipt.
3 PACKAGE="ndoutils"
4 VERSION="1.5.2"
5 CATEGORY="network"
6 SHORT_DESC="Provide mysql access to nagios."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://www.nagios.org/"
11 WGET_URL="$SF_MIRROR/nagios/$TARBALL"
12 CONFIG_FILES="/etc/nagios"
14 DEPENDS="nagios mysql"
15 BUILD_DEPENDS="mysql-dev"
17 # Rules to configure and make the package.
18 compile_rules()
19 {
20 cd $src
22 while read patch_file; do
23 if [ ! -f done.$patch_file ]; then
24 patch -p1 < $stuff/$patch_file || exit 1
25 touch done.$patch_file
26 fi
27 done <<EOT
28 $PACKAGE-$VERSION-Makefiles.in.u
29 EOT
31 ./configure --prefix=/usr \
32 --with-ndo2db-user=nagios \
33 --with-ndo2db-group=nagios \
34 --localstatedir=/var/run/nagios \
35 --sysconfdir=/etc/nagios \
36 --libexecdir=/usr/lib/$PACKAGE \
37 --mandir=/usr/share/man $CONFIGURE_ARGS &&
38 make && \
39 make DESTDIR=$DESTDIR install && \
40 make DESTDIR=$DESTDIR install-config
41 }
43 # Rules to gen a SliTaz package suitable for Tazpkg.
44 genpkg_rules()
45 {
46 mkdir -p $fs/usr/share/nagios/ndoutils \
47 $fs/etc/nagios \
48 $fs/var/run/nagios \
49 $fs/etc/mysql.d
51 cp -a $install/usr/bin $fs/usr
52 cp -a $install/usr/lib $fs/usr
53 cp -a $install/etc $fs
55 # config ndo2db.cfg
56 sed -i -e 's/ndo2db_user=nagios/ndo2db_user=nagios/' \
57 -e 's/ndo2db_group=nagios/ndo2db_group=nagios/' \
58 -e 's|/usr/local/nagios/var/|/var/run/nagios/|' \
59 -e 's/db_user=ndouser/db_user=root/' \
60 -e 's/db_pass=ndopassword/db_pass=/' $fs/etc/nagios/ndo2db.cfg
62 # config ndomod.cfg
63 sed -i -e 's|output=/usr/local/nagios/var/|output=/var/run/nagios/|' \
64 -e 's|buffer_file=/usr/local/nagios/var/|buffer_file=/var/tmp/|' \
65 $fs/etc/nagios/ndomod.cfg
67 cp -a $src/db/mysql.sql $fs/usr/share/nagios/ndoutils/nagios.sql
68 cp -a stuff/etc $fs
70 chmod 755 $fs/usr/bin/*
71 chmod 755 $fs/etc/mysql.d/*
72 }
74 post_install()
75 {
76 if ! grep -q nagios $1/etc/passwd; then
77 echo -n "Adding user nagios..."
78 chroot $1/ adduser -S -D -H nagios
79 status
80 fi
82 if ! grep -q ndomod.cfg $1/etc/nagios/nagios.cfg; then
83 sed -i '/LOG ROTATION METHOD/i\broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg' $1/etc/nagios/nagios.cfg
84 chroot $1/ chown nagios.nagios $1/etc/nagios/nagios.cfg
85 fi
87 chroot $1/ chown nagios.nagios $fs/usr/lib/ndoutils/ndomod.o \
88 $fs/etc/nagios/ndo2db.cfg $fs/etc/nagios/ndomod.cfg \
89 $fs/var/run/nagios $fs/etc/nagios
91 sed -i "s/nagios/ndo2db nagios/" $1/etc/rcS.conf
93 if [ -z "$1" ]; then
94 [ -f /var/run/mysqld/mysql.pid ] || /etc/init.d/mysql start
95 /etc/mysql.d/$PACKAGE
96 #/usr/bin/ndo2db -c /etc/nagios/ndo2db.cfg
97 /etc/init.d/ndo2db start
98 /etc/init.d/nagios stop
99 /etc/init.d/nagios start
101 fi
102 }
104 pre_remove()
105 {
106 /etc/init.d/ndo2db stop
107 }
109 post_remove()
110 {
111 sed -i "s/ndo2db//" $1/etc/rcS.conf
112 /etc/init.d/nagios restart
113 sed -i 's|broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg||' $1/etc/nagios/nagios.cfg
114 }