wok-6.x view ndoutils/receipt @ rev 22984

updated keyutils and keyutils-dev (1.6 -> 1.6.1)
author Hans-G?nter Theisgen
date Sun Mar 01 07:46:00 2020 +0100 (2020-03-01)
parents 970c5ec9a60a
children 3ed673065a99
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="https://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/etc/mysql.d
50 cp -a $install/usr/bin $fs/usr
51 cp -a $install/usr/lib $fs/usr
52 cp -a $install/etc $fs
54 # config ndo2db.cfg
55 sed -i -e 's/ndo2db_user=nagios/ndo2db_user=nagios/' \
56 -e 's/ndo2db_group=nagios/ndo2db_group=nagios/' \
57 -e 's|/usr/local/nagios/var/|/var/run/nagios/|' \
58 -e 's/db_user=ndouser/db_user=root/' \
59 -e 's/db_pass=ndopassword/db_pass=/' $fs/etc/nagios/ndo2db.cfg
61 # config ndomod.cfg
62 sed -i -e 's|output=/usr/local/nagios/var/|output=/var/run/nagios/|' \
63 -e 's|buffer_file=/usr/local/nagios/var/|buffer_file=/var/tmp/|' \
64 $fs/etc/nagios/ndomod.cfg
66 cp -a $src/db/mysql.sql $fs/usr/share/nagios/ndoutils/nagios.sql
67 cp -a stuff/etc $fs
69 chmod 755 $fs/usr/bin/*
70 chmod 755 $fs/etc/mysql.d/*
71 }
73 post_install()
74 {
75 if ! grep -q nagios "$1/etc/passwd"; then
76 echo
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 /etc/nagios/nagios.cfg
85 fi
87 chroot "$1/" chown nagios.nagios /usr/lib/ndoutils/ndomod.o \
88 /etc/nagios/ndo2db.cfg /etc/nagios/ndomod.cfg \
89 /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 }