wok-current annotate nagios/receipt @ rev 18730
Quote root dir in post_install
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Dec 20 15:13:45 2015 +0100 (2015-12-20) |
parents | 0d8a1a3edc72 |
children | 4ed9d8ca19d9 |
rev | line source |
---|---|
erjo@8330 | 1 # SliTaz package receipt. |
erjo@8330 | 2 |
erjo@8330 | 3 PACKAGE="nagios" |
erjo@14455 | 4 VERSION="3.5.0" |
erjo@8330 | 5 CATEGORY="network" |
erjo@8330 | 6 SHORT_DESC="Host and network monitoring" |
erjo@8330 | 7 MAINTAINER="erjo@slitaz.org" |
pascal@15584 | 8 LICENSE="GPL2" |
erjo@8330 | 9 TARBALL="$PACKAGE-$VERSION.tar.gz" |
erjo@8330 | 10 WEB_SITE="http://www.nagios.org/" |
erjo@8330 | 11 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" |
erjo@8330 | 12 SUGGESTED="nagios-nrpe" |
erjo@8330 | 13 |
pascal@15584 | 14 DEPENDS="apache nagios-plugins libpng libjpeg libltdl" |
pascal@15584 | 15 BUILD_DEPENDS="libgd-dev libpng-dev jpeg-dev libtool" |
pascal@15584 | 16 |
erjo@8330 | 17 # Rules to configure and make the package. |
erjo@8330 | 18 compile_rules() |
erjo@8330 | 19 { |
erjo@8330 | 20 cd $src |
erjo@8330 | 21 while read patch_file; do |
erjo@8330 | 22 if [ ! -f done.$patch_file ]; then |
slaxemulator@9700 | 23 patch -p1 < $stuff/$patch_file || return 1 |
erjo@8330 | 24 touch done.$patch_file |
erjo@8330 | 25 fi |
erjo@8330 | 26 done <<EOT |
erjo@8330 | 27 $PACKAGE-$VERSION-Makefiles.u |
erjo@8330 | 28 EOT |
erjo@8330 | 29 ./configure \ |
erjo@8330 | 30 --prefix=/usr \ |
erjo@8330 | 31 --infodir=/usr/share/info \ |
erjo@8330 | 32 --mandir=/usr/share/man \ |
erjo@8330 | 33 --with-nagios-user=nagios \ |
erjo@8330 | 34 --with-nagios-group=nagios \ |
erjo@8330 | 35 --with-lockfile=/var/run/nagios/nagios.pid \ |
erjo@8330 | 36 --with-checkresult-dir=/var/spool/nagios/checkresults \ |
erjo@8330 | 37 --sysconfdir=/etc/nagios \ |
erjo@8330 | 38 --with-httpd-conf=/etc/apache/conf.d \ |
erjo@8330 | 39 --libexecdir=/usr/lib/nagios/plugins \ |
erjo@8330 | 40 --sbindir=/usr/lib/nagios/cgi \ |
erjo@8330 | 41 --datadir=/usr/share/nagios \ |
erjo@8700 | 42 --localstatedir=/var/lib/nagios \ |
erjo@8330 | 43 $CONFIGURE_ARGS |
erjo@8330 | 44 |
erjo@9865 | 45 sed -i s!HTMLDIR=.*!HTMLDIR=/usr/share/nagios! html/Makefile |
erjo@9865 | 46 |
pascal@15584 | 47 #~ make all && make DESTDIR=$DESTDIR fullinstall \ |
pascal@15584 | 48 #~ && make DESTDIR=$DESTDIR install-config |
erjo@14455 | 49 make all && make install \ |
erjo@14455 | 50 && make install-config \ |
erjo@14455 | 51 && make install-commandmode \ |
erjo@14455 | 52 && make install-webconf \ |
erjo@14455 | 53 && make install-classicui |
erjo@14455 | 54 |
erjo@8330 | 55 } |
erjo@8330 | 56 |
erjo@8330 | 57 # Rules to gen a SliTaz package suitable for Tazpkg. |
erjo@8330 | 58 genpkg_rules() |
erjo@8330 | 59 { |
erjo@8330 | 60 mkdir -p $fs/usr $fs/etc/init.d \ |
erjo@8700 | 61 $fs/var/lib/nagios/rw \ |
pascal@14465 | 62 $fs/var/log/nagios \ |
erjo@8330 | 63 $fs/var/spool/nagios/checkresults \ |
erjo@8330 | 64 $fs/etc/apache |
erjo@8330 | 65 |
erjo@14455 | 66 cp -a $install/etc/apache $fs/etc |
erjo@14455 | 67 cp -a $install/etc/nagios $fs/etc |
erjo@14455 | 68 cp -a $stuff/nagios $fs/etc/init.d |
erjo@14455 | 69 install -o root -g root -m 644 $stuff/htpasswd.users $fs/etc/nagios/ |
erjo@8330 | 70 |
erjo@14455 | 71 cp -a $install/usr/bin $fs/usr |
erjo@14455 | 72 cp -a $install/usr/lib $fs/usr |
erjo@14455 | 73 cp -a $install/usr/share $fs/usr |
erjo@8330 | 74 |
erjo@8330 | 75 # Put doc in separate package |
erjo@8330 | 76 rm -rf $fs/usr/share/nagios/docs |
erjo@8330 | 77 |
erjo@8330 | 78 # Fix Apache config for Nagvis |
erjo@8330 | 79 sed -i 's/Options None/Options FollowSymLinks/' $fs/etc/apache/conf.d/nagios.conf |
erjo@8700 | 80 |
erjo@8700 | 81 # Fix permissions |
erjo@8700 | 82 chmod 755 $fs/usr/bin/nagios* |
erjo@8330 | 83 } |
erjo@8330 | 84 |
erjo@8330 | 85 post_install() |
erjo@8330 | 86 { |
pascal@18730 | 87 if ! grep -q nagios "$1/etc/passwd"; then |
erjo@8330 | 88 echo -n "Adding user/group nagios..." |
pascal@18730 | 89 chroot "$1/" addgroup -S nagios |
pascal@18730 | 90 chroot "$1/" adduser -S -D -H -G nagios nagios |
erjo@8330 | 91 status |
erjo@8330 | 92 fi |
erjo@8330 | 93 |
erjo@8330 | 94 # Fix perms for files and directories |
pascal@18730 | 95 chroot "$1/" chown -R nagios.nagios /var/log/nagios \ |
erjo@8330 | 96 /var/spool/nagios \ |
erjo@8700 | 97 /var/lib/nagios \ |
erjo@8330 | 98 /usr/share/nagios \ |
erjo@8330 | 99 /etc/nagios/* |
erjo@8330 | 100 |
erjo@8330 | 101 |
pascal@18730 | 102 chmod 2775 "$1/var/lib/nagios/rw" |
pascal@18730 | 103 chroot "$1/" addgroup www nagios |
erjo@8330 | 104 |
erjo@8330 | 105 # Start Nagios daemon if we are on running system |
pascal@18730 | 106 [ "$1" ] || /etc/init.d/nagios start |
erjo@8330 | 107 |
erjo@8330 | 108 # post_install messges |
erjo@8330 | 109 echo -e "\nTo starts $PACKAGE server you can run :\n" |
erjo@8330 | 110 echo "/etc/init.d/$PACKAGE start" |
erjo@8330 | 111 echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n" |
erjo@8330 | 112 echo -e "Default login/password for the Web GUI is nagiosadmin/nagios" |
erjo@8330 | 113 } |
erjo@8330 | 114 |
pascal@14466 | 115 pre_remove() |
pascal@14466 | 116 { |
pascal@18730 | 117 [ "$1" ] || /etc/init.d/nagios stop |
pascal@14466 | 118 } |