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