X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=nagcollect.git;a=blobdiff_plain;f=Makefile;h=ba9bd211da4e64cd58e2e0f9daddbb96cd6d3b4d;hp=8a1ed0a308a2eaac239508ab5ba6d13461a473e9;hb=c9c8e04e4bfbe4c43b0967efb0962df1f6f88689;hpb=838f971d2c8b7013bb4ee34042f884d5af12b2c2 diff --git a/Makefile b/Makefile index 8a1ed0a..ba9bd21 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,30 @@ # # NagCollect -- Nagios Data Collector for Passive Checks -# Copyright (c)2009 Alexander Barton, alex@barton.de +# Copyright (c)2009-2011 Alexander Barton, alex@barton.de # +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# Please read the file COPYING, README and AUTHORS for more information. +# + +all: server client plugins -all: +clean: + find . -name .DS_Store -delete + rm -rf client/lib/nagios + +distclean: clean install: - @echo " ** Use make targets 'install-client', 'install-server' and 'install-all'" - @echo " ** to install client and/or server components!" + @echo " ** Use make targets 'install-client', 'install-server', 'install-plugins' + @echo " ** or 'install-all' to install client, server and or plugin components!" -install-all: install-server install-client +install-all: install-server install-client install-plugins -install-server: - install -d -o nagios -g nagios -m 750 \ - /var/lib/nagios3/collect +install-server: server + install -d -o nagios -g nagios -m 750 /var/lib/nagios3/collect [ -r /etc/nagios3/system.cfg ] || \ install -D -o nagios -g root -m 640 -p \ server/etc/system.cfg /etc/nagios3/system.cfg @@ -26,11 +37,85 @@ install-server: server/bin/nagios-submit-service /usr/local/sbin/nagios-submit-service install -D -o root -g root -m 644 -p \ server/web/nagcollect.php /var/www/nagcollect.php + [ -r contrib/Makefile.`uname` ] \ + && make -f contrib/Makefile.`uname` "install-server" || true -install-client: - install -D -o 0 -g 0 -m 755 -p \ +install-client: client + install -d -o 0 -g 0 -m 755 /usr/local/sbin + install -c -o 0 -g 0 -m 755 -p \ client/bin/nagcollect /usr/local/sbin/nagcollect + install -c -o 0 -g 0 -m 755 -p \ + client/bin/nagcollectreset /usr/local/sbin/nagcollectreset + install -d -o 0 -g 0 -m 755 /usr/local/etc + [ -r /usr/local/etc/nagcollect.conf ] || \ + install -o 0 -g 0 -m 600 -p \ + client/etc/nagcollect.conf /usr/local/etc/nagcollect.conf + install -d -o 0 -g 0 -m 755 /usr/local/lib/nagcollect + (cd client/lib/tests; find . -name '*.tst' | \ + while read x; do \ + install -d -o 0 -g 0 -m 755 `dirname "/usr/local/lib/nagcollect/$$x"`; \ + install -o 0 -g 0 -m 644 "$$x" "/usr/local/lib/nagcollect/$$x"; \ + done \ + ) + [ -r contrib/Makefile.`uname` ] \ + && make -f contrib/Makefile.`uname` "install-client" || true + +install-plugins: plugins + install -d -o 0 -g 0 -m 755 /usr/local/lib/nagios/plugins + (cd client/lib/nagios/plugins; find . -name 'check_nc_*' | \ + while read x; do \ + install -o 0 -g 0 -m 755 "$$x" "/usr/local/lib/nagios/plugins/$$x"; \ + done \ + ) + +check: + +dist: distclean + rel=`grep "^NagCollect " ChangeLog|awk "{print \\\$$3 }"|head -n 1`; \ + dir=`basename $${PWD}` \ + && cd .. \ + && COPYFILE_DISABLE=true tar cvzf "NagCollect-R$${rel}.tar.gz" \ + --exclude .git "$${dir}" + +distcheck: check dist + +server: + +client: + +plugins: + mkdir -p client/lib/nagios/plugins + (cd client/lib/tests; (ls -1 *.tst; ls -1 `uname`/*.tst) | \ + while read x; do \ + name="check_nc_`basename "$$x" | cut -d'.' -f1 | tr '[A-Z]' '[a-z]'`"; \ + dest="../nagios/plugins/$$name"; \ + echo " * $$x -> $$name"; \ + cat "../wrapper/wrapper-top.sh" >"$$dest"; \ + cat "$$x" >>"$$dest"; \ + cat "../wrapper/wrapper-bottom.sh" >>"$$dest"; \ + chmod 755 "$$dest"; \ + done \ + ) + +osxpkg: + rel=`grep "^NagCollect " ChangeLog|awk "{print \\\$$3 }"|head -n 1`; \ + rm -rf "../NagCollect-R$${rel}.mpkg" \ + && packagemaker \ + --doc "contrib/NagCollect.pmdoc" \ + --out "../NagCollect-R$${rel}.mpkg" + +osxdmg: osxpkg + rel=`grep "^NagCollect " ChangeLog|awk "{print \\\$$3 }"|head -n 1`; \ + rm -f "../NagCollect-R$${rel}.dmg" \ + && hdiutil create -srcfolder \ + "../NagCollect-R$${rel}.mpkg" "../NagCollect-R$${rel}.dmg" + +nagcollecttestscripts: + COPYFILE_DISABLE=true tar -czvf nagcollecttestscripts.tgz \ + -C client/lib/tests . -.PHONY: all install-server install-client +.PHONY: all install install-all install-server install-client \ + install-plugins clean distclean check dist distcheck server client \ + plugins osxpkg osxdmg nagcollecttestscripts # -eof-