wok-next annotate ndoutils/receipt @ rev 21688

updated glu (9.0.0 -> 9.0.1)
author Hans-G?nter Theisgen
date Mon Jun 29 17:17:08 2020 +0100 (2020-06-29)
parents a3c581bf52b8
children
rev   line source
al@20534 1 # SliTaz package receipt v2.
erjo@8703 2
erjo@8703 3 PACKAGE="ndoutils"
erjo@14463 4 VERSION="1.5.2"
erjo@8703 5 CATEGORY="network"
al@20534 6 SHORT_DESC="Provide mysql access to nagios"
erjo@8703 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15601 8 LICENSE="GPL2"
al@20906 9 WEB_SITE="https://www.nagios.org/"
al@20534 10
erjo@8703 11 TARBALL="$PACKAGE-$VERSION.tar.gz"
erjo@8703 12 WGET_URL="$SF_MIRROR/nagios/$TARBALL"
pascal@15601 13
erjo@8703 14 BUILD_DEPENDS="mysql-dev"
erjo@8703 15
al@20534 16 compile_rules() {
al@20534 17 ./configure \
al@20534 18 --with-ndo2db-user=nagios \
al@20534 19 --with-ndo2db-group=nagios \
al@20534 20 --localstatedir=/var/run/nagios \
al@20534 21 --sysconfdir=/etc/nagios \
al@20534 22 --libexecdir=/usr/lib/$PACKAGE \
al@20534 23 $CONFIGURE_ARGS &&
al@20534 24 make &&
al@21020 25 make DESTDIR=$install install &&
al@21020 26 make DESTDIR=$install install-config
al@20534 27 }
erjo@8703 28
al@20534 29 genpkg_rules() {
erjo@8703 30 mkdir -p $fs/usr/share/nagios/ndoutils \
erjo@8703 31 $fs/etc/nagios \
erjo@8703 32 $fs/etc/mysql.d
al@21020 33
pascal@15601 34 cp -a $install/usr/bin $fs/usr
pascal@15601 35 cp -a $install/usr/lib $fs/usr
pascal@15601 36 cp -a $install/etc $fs
al@21020 37
erjo@8703 38 # config ndo2db.cfg
erjo@8703 39 sed -i -e 's/ndo2db_user=nagios/ndo2db_user=nagios/' \
erjo@8703 40 -e 's/ndo2db_group=nagios/ndo2db_group=nagios/' \
erjo@8703 41 -e 's|/usr/local/nagios/var/|/var/run/nagios/|' \
erjo@8703 42 -e 's/db_user=ndouser/db_user=root/' \
erjo@8703 43 -e 's/db_pass=ndopassword/db_pass=/' $fs/etc/nagios/ndo2db.cfg
erjo@8703 44
erjo@8703 45 # config ndomod.cfg
erjo@8703 46 sed -i -e 's|output=/usr/local/nagios/var/|output=/var/run/nagios/|' \
erjo@8703 47 -e 's|buffer_file=/usr/local/nagios/var/|buffer_file=/var/tmp/|' \
erjo@8703 48 $fs/etc/nagios/ndomod.cfg
erjo@8703 49
al@21020 50 cp -a $src/db/mysql.sql $fs/usr/share/nagios/ndoutils/nagios.sql
al@21020 51 cp -a $stuff/etc $fs
al@21020 52
erjo@8703 53 chmod 755 $fs/usr/bin/*
erjo@8703 54 chmod 755 $fs/etc/mysql.d/*
al@20534 55 DEPENDS="nagios mysql"
al@20534 56 CONFIG_FILES="/etc/nagios"
erjo@8703 57 }
erjo@8703 58
al@20534 59 post_install() {
pascal@18730 60 if ! grep -q nagios "$1/etc/passwd"; then
pascal@18730 61 chroot "$1/" adduser -S -D -H nagios
erjo@8703 62 fi
al@20534 63
pascal@18730 64 if ! grep -q ndomod.cfg "$1/etc/nagios/nagios.cfg"; then
pascal@18730 65 sed -i '/LOG ROTATION METHOD/i\broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg' "$1/etc/nagios/nagios.cfg"
pascal@18730 66 chroot "$1/" chown nagios.nagios /etc/nagios/nagios.cfg
erjo@8703 67 fi
al@20534 68
al@20534 69 chroot "$1/" chown nagios.nagios \
al@20534 70 /usr/lib/ndoutils/ndomod.o \
al@20534 71 /etc/nagios/ndo2db.cfg \
al@20534 72 /etc/nagios/ndomod.cfg \
al@20534 73 /etc/nagios
erjo@8703 74
pascal@18730 75 sed -i "s/nagios/ndo2db nagios/" "$1/etc/rcS.conf"
al@20534 76
al@20534 77 if [ -z "$1" ]; then
erjo@8703 78 [ -f /var/run/mysqld/mysql.pid ] || /etc/init.d/mysql start
al@20534 79 /etc/mysql.d/$PACKAGE
erjo@8703 80 #/usr/bin/ndo2db -c /etc/nagios/ndo2db.cfg
erjo@8703 81 /etc/init.d/ndo2db start
erjo@8703 82 /etc/init.d/nagios stop
erjo@8703 83 /etc/init.d/nagios start
al@20534 84 fi
erjo@8703 85 }
erjo@8703 86
al@20534 87 pre_remove() {
erjo@8703 88 /etc/init.d/ndo2db stop
erjo@8703 89 }
erjo@8703 90
al@20534 91 post_remove() {
al@20534 92 sed -i "s/ndo2db//" "$1/etc/rcS.conf"
al@20534 93 /etc/init.d/nagios restart
al@20534 94 sed -i 's|broker_module=/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios/ndomod.cfg||' "$1/etc/nagios/nagios.cfg"
erjo@8703 95 }