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