2006-01-13 11:44:02 +00:00
|
|
|
#
|
2008-03-12 23:22:26 +00:00
|
|
|
# 2006-2008 Nico Schottelius (nico-ccollect at schottelius.org)
|
|
|
|
#
|
|
|
|
# This file is part of ccollect.
|
|
|
|
#
|
|
|
|
# ccollect 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 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# ccollect is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with ccollect. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
# Initially written on Fri Jan 13 12:13:08 CET 2006
|
2006-01-13 11:44:02 +00:00
|
|
|
#
|
2008-02-14 00:24:26 +00:00
|
|
|
# FIXME: add prefix-support?
|
2008-03-12 23:22:26 +00:00
|
|
|
#
|
2006-01-13 11:44:02 +00:00
|
|
|
|
|
|
|
INSTALL=install
|
2011-01-15 01:31:29 +00:00
|
|
|
CCOLLECT_SOURCE=ccollect
|
|
|
|
CCOLLECT_DEST=ccollect
|
2006-01-13 11:44:02 +00:00
|
|
|
LN=ln -sf
|
2006-05-12 13:41:49 +00:00
|
|
|
ASCIIDOC=asciidoc
|
|
|
|
DOCBOOKTOTEXI=docbook2x-texi
|
2006-05-12 15:17:28 +00:00
|
|
|
DOCBOOKTOMAN=docbook2x-man
|
2006-10-26 09:55:16 +00:00
|
|
|
XSLTPROC=xsltproc
|
|
|
|
XSL=/usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl
|
2007-08-17 09:07:55 +00:00
|
|
|
A2X=a2x
|
2006-01-13 11:44:02 +00:00
|
|
|
|
2006-03-08 22:02:34 +00:00
|
|
|
prefix=/usr/packages/ccollect-git
|
2007-06-22 09:23:37 +00:00
|
|
|
bindir=${prefix}/bin
|
|
|
|
destination=${bindir}/${CCOLLECT_DEST}
|
2006-01-13 11:44:02 +00:00
|
|
|
|
2007-08-17 09:07:55 +00:00
|
|
|
mandest=${prefix}/man/man1
|
|
|
|
manlink=/usr/local/man/man1
|
|
|
|
|
2006-01-13 11:44:02 +00:00
|
|
|
path_dir=/usr/local/bin
|
2007-06-22 09:23:37 +00:00
|
|
|
path_destination=${path_dir}/${CCOLLECT_DEST}
|
2006-01-13 11:44:02 +00:00
|
|
|
|
2006-01-17 11:11:05 +00:00
|
|
|
# where to publish
|
2009-07-01 08:00:18 +00:00
|
|
|
host=localhost
|
2009-10-25 14:21:19 +00:00
|
|
|
dir=/home/users/nico/privat/rechner/netz/seiten/www.nico.schottelius.org/src/software/ccollect
|
2010-04-08 20:00:45 +00:00
|
|
|
docdir=${dir}/documentation
|
2006-01-17 11:11:05 +00:00
|
|
|
|
2006-05-12 13:54:38 +00:00
|
|
|
#
|
|
|
|
# Asciidoc will be used to generate other formats later
|
|
|
|
#
|
2007-08-17 09:07:55 +00:00
|
|
|
MANDOCS = doc/man/ccollect.text \
|
2008-03-07 22:01:56 +00:00
|
|
|
doc/man/ccollect_add_source.text \
|
2008-03-12 23:22:26 +00:00
|
|
|
doc/man/ccollect_analyse_logs.text \
|
2008-03-07 22:01:56 +00:00
|
|
|
doc/man/ccollect_delete_source.text \
|
2008-03-12 23:22:26 +00:00
|
|
|
doc/man/ccollect_logwrapper.text \
|
|
|
|
doc/man/ccollect_list_intervals.text
|
2007-08-17 09:07:55 +00:00
|
|
|
|
2009-07-01 08:03:00 +00:00
|
|
|
DOCS = ${MANDOCS} doc/ccollect.text
|
2006-05-12 13:54:38 +00:00
|
|
|
|
2006-10-26 09:55:16 +00:00
|
|
|
#
|
|
|
|
# Doku
|
|
|
|
#
|
2007-06-22 09:23:37 +00:00
|
|
|
HTMLDOCS = ${DOCS:.text=.html}
|
|
|
|
DBHTMLDOCS = ${DOCS:.text=.htm}
|
2006-10-26 09:55:16 +00:00
|
|
|
|
2007-08-17 09:23:32 +00:00
|
|
|
# texi is broken currently, don't know why xslt things complain yet
|
2007-06-22 09:23:37 +00:00
|
|
|
TEXIDOCS = ${DOCS:.text=.texi}
|
2007-08-17 09:23:32 +00:00
|
|
|
TEXIDOCS =
|
|
|
|
|
2007-08-17 09:24:30 +00:00
|
|
|
# fop fails here, so disable it for now
|
2007-08-17 09:23:32 +00:00
|
|
|
PDFDOCS = ${DOCS:.text=.pdf}
|
2007-08-17 09:24:30 +00:00
|
|
|
PDFDOCS =
|
2006-10-26 09:55:16 +00:00
|
|
|
|
2007-08-17 09:28:05 +00:00
|
|
|
MANPDOCS = ${MANDOCS:.text=.1}
|
2006-10-26 09:55:16 +00:00
|
|
|
|
2007-06-22 09:23:37 +00:00
|
|
|
DOCBDOCS = ${DOCS:.text=.docbook}
|
2006-10-26 09:55:16 +00:00
|
|
|
|
2007-08-17 09:23:32 +00:00
|
|
|
DOC_ALL = ${HTMLDOCS} ${DBHTMLDOCS} ${TEXIDOCS} ${MANPDOCS} ${PDFDOCS}
|
2006-10-26 09:55:16 +00:00
|
|
|
|
2019-11-15 07:28:55 +00:00
|
|
|
TEST_LOG_FILE = /tmp/ccollect/ccollect.log
|
|
|
|
|
2006-01-22 11:53:45 +00:00
|
|
|
#
|
|
|
|
# End user targets
|
|
|
|
#
|
2006-01-13 11:44:02 +00:00
|
|
|
all:
|
2006-06-15 21:56:47 +00:00
|
|
|
@echo "----------- ccollect make targets --------------"
|
|
|
|
@echo "documentation: generate HTMl, Texinfo and manpage"
|
|
|
|
@echo "html: only generate HTML"
|
|
|
|
@echo "info: only generate Texinfo"
|
2007-06-22 09:23:37 +00:00
|
|
|
@echo "man: only generate manpage{s}"
|
|
|
|
@echo "install: install ccollect to ${prefix}"
|
2006-01-13 11:44:02 +00:00
|
|
|
|
2011-11-05 14:58:26 +00:00
|
|
|
html: ${HTMLDOCS}
|
|
|
|
htm: ${DBHTMLDOCS}
|
|
|
|
info: ${TEXIDOCS}
|
|
|
|
man: ${MANPDOCS}
|
|
|
|
pdf: ${PDFDOCS}
|
|
|
|
documentation: ${DOC_ALL}
|
|
|
|
|
2007-08-17 09:07:55 +00:00
|
|
|
install: install-link install-manlink
|
2006-01-22 11:53:45 +00:00
|
|
|
|
|
|
|
install-link: install-script
|
2007-06-22 09:23:37 +00:00
|
|
|
${LN} ${destination} ${path_destination}
|
2006-01-17 11:13:30 +00:00
|
|
|
|
2006-01-22 11:53:45 +00:00
|
|
|
install-script:
|
2007-06-22 09:23:37 +00:00
|
|
|
${INSTALL} -D -m 0755 ${CCOLLECT_SOURCE} ${destination}
|
2006-01-22 11:53:45 +00:00
|
|
|
|
2007-08-17 09:07:55 +00:00
|
|
|
install-man: man
|
|
|
|
${INSTALL} -d -m 0755 ${mandest}
|
|
|
|
${INSTALL} -D -m 0644 doc/man/*.1 ${mandest}
|
|
|
|
|
|
|
|
install-manlink: install-man
|
|
|
|
${INSTALL} -d -m 0755 ${manlink}
|
|
|
|
for man in ${mandest}/*; do ${LN} $$man ${manlink}; done
|
|
|
|
|
2008-06-25 09:38:24 +00:00
|
|
|
#
|
|
|
|
# Tools
|
|
|
|
#
|
2011-01-15 01:31:29 +00:00
|
|
|
TOOLS2=ccollect_add_source
|
|
|
|
TOOLS2 += ccollect_analyse_logs
|
2008-06-25 09:38:24 +00:00
|
|
|
|
2011-01-15 01:31:29 +00:00
|
|
|
TOOLS=ccollect_add_source \
|
|
|
|
ccollect_analyse_logs \
|
|
|
|
ccollect_delete_source \
|
|
|
|
ccollect_list_intervals \
|
|
|
|
ccollect_logwrapper \
|
|
|
|
ccollect_list_intervals
|
|
|
|
|
|
|
|
# Stick to posix
|
|
|
|
TOOLSMAN1 = $(TOOLS:ccollect=doc/man/ccollect)
|
|
|
|
TOOLSMAN = $(TOOLSMAN1:=.text)
|
2008-06-25 09:38:24 +00:00
|
|
|
|
|
|
|
TOOLSFP = $(subst ccollect,tools/ccollect,$(TOOLS))
|
|
|
|
|
2011-01-15 01:31:29 +00:00
|
|
|
## FIXME: posix make: shell? =>
|
|
|
|
|
2008-06-25 09:38:24 +00:00
|
|
|
t2:
|
2011-01-15 01:31:29 +00:00
|
|
|
echo $(TOOLS) - $(TOOLSFP)
|
|
|
|
echo $(TOOLSMAN)
|
|
|
|
echo $(TOOLSFP)
|
2008-06-25 09:38:24 +00:00
|
|
|
|
2006-05-12 13:41:49 +00:00
|
|
|
|
2006-10-26 09:55:16 +00:00
|
|
|
# docbook gets .htm, asciidoc directly .html
|
|
|
|
%.htm: %.docbook
|
|
|
|
${XSLTPROC} -o $@ ${XSL} $<
|
|
|
|
|
|
|
|
%.html: %.text %.docbook
|
|
|
|
${ASCIIDOC} -n -o $@ $<
|
|
|
|
|
2006-05-12 13:41:49 +00:00
|
|
|
%.html: %.text
|
|
|
|
${ASCIIDOC} -n -o $@ $<
|
|
|
|
|
|
|
|
%.docbook: %.text
|
|
|
|
${ASCIIDOC} -n -b docbook -o $@ $<
|
|
|
|
|
|
|
|
%.texi: %.docbook
|
|
|
|
${DOCBOOKTOTEXI} --to-stdout $< > $@
|
2006-01-13 11:44:02 +00:00
|
|
|
|
2007-08-17 09:07:55 +00:00
|
|
|
#%.mandocbook: %.text
|
|
|
|
# ${ASCIIDOC} -b docbook -d manpage -o $@ $<
|
|
|
|
|
|
|
|
#%.man: %.mandocbook
|
|
|
|
# ${DOCBOOKTOMAN} --to-stdout $< > $@
|
|
|
|
|
2007-08-17 09:28:05 +00:00
|
|
|
#%.man: %.text
|
|
|
|
%.1: %.text
|
2007-08-17 09:07:55 +00:00
|
|
|
${A2X} -f manpage $<
|
2006-05-12 15:42:08 +00:00
|
|
|
|
2007-08-17 09:23:32 +00:00
|
|
|
%.pdf: %.text
|
|
|
|
${A2X} -f pdf $<
|
|
|
|
|
2006-05-12 15:17:28 +00:00
|
|
|
|
2006-01-17 11:13:30 +00:00
|
|
|
#
|
|
|
|
# Developer targets
|
|
|
|
#
|
2011-02-02 07:55:15 +00:00
|
|
|
pub:
|
2011-08-20 21:31:52 +00:00
|
|
|
git push
|
2006-01-17 11:13:30 +00:00
|
|
|
|
2006-01-17 11:11:05 +00:00
|
|
|
publish-doc: documentation
|
2007-06-22 09:23:37 +00:00
|
|
|
@echo "Transferring files to ${host}"
|
|
|
|
@chmod a+r ${DOCS} ${DOC_ALL}
|
|
|
|
@tar c ${DOCS} ${DOC_ALL} | ssh ${host} "cd ${dir}; tar xv"
|
2006-05-12 13:54:38 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Distribution
|
|
|
|
#
|
2007-08-17 09:23:32 +00:00
|
|
|
clean:
|
2007-06-22 09:23:37 +00:00
|
|
|
rm -f ${DOC_ALL}
|
2007-08-17 09:28:05 +00:00
|
|
|
rm -f doc/man/*.[0-9] doc/man/*.xml doc/*.fo doc/man/*.fo
|
2006-05-12 13:54:38 +00:00
|
|
|
|
2007-08-17 09:23:32 +00:00
|
|
|
distclean: clean
|
2007-06-22 09:23:37 +00:00
|
|
|
rm -f ${DOCBDOCS}
|
2006-05-12 13:54:38 +00:00
|
|
|
|
2006-06-15 21:56:47 +00:00
|
|
|
#
|
|
|
|
# Be nice with the users and generate documentation for them
|
|
|
|
#
|
2006-05-12 13:54:38 +00:00
|
|
|
dist: distclean documentation
|
2007-08-14 12:57:26 +00:00
|
|
|
|
2009-11-01 13:36:49 +00:00
|
|
|
/tmp/ccollect:
|
2009-02-02 10:46:48 +00:00
|
|
|
mkdir -p /tmp/ccollect
|
2009-11-01 13:36:49 +00:00
|
|
|
|
2019-11-14 18:16:11 +00:00
|
|
|
shellcheck: ./ccollect
|
|
|
|
shellcheck -s sh -f gcc -x ./ccollect
|
|
|
|
|
2019-11-15 07:28:55 +00:00
|
|
|
test-nico: $(CCOLLECT_SOURCE) /tmp/ccollect
|
2011-01-15 01:31:29 +00:00
|
|
|
cd ./conf/sources/; for s in *; do CCOLLECT_CONF=../ ../../ccollect daily "$$s"; done
|
2009-11-01 13:37:32 +00:00
|
|
|
touch /tmp/ccollect/$$(ls /tmp/ccollect | head -n1).ccollect-marker
|
2011-01-15 01:31:29 +00:00
|
|
|
CCOLLECT_CONF=./conf ./ccollect -a daily
|
2009-11-01 14:12:16 +00:00
|
|
|
touch /tmp/ccollect/$$(ls /tmp/ccollect | head -n1).ccollect-marker
|
2011-01-15 01:31:29 +00:00
|
|
|
CCOLLECT_CONF=./conf ./ccollect -a -p daily
|
2019-11-15 07:28:55 +00:00
|
|
|
|
|
|
|
test-dir-source:
|
|
|
|
mkdir -p /tmp/ccollect/source
|
|
|
|
cp -R -f ./* /tmp/ccollect/source
|
|
|
|
|
|
|
|
test-dir-destination:
|
|
|
|
mkdir -p /tmp/ccollect/backup
|
|
|
|
|
|
|
|
test-dir-destination-chint:
|
|
|
|
mkdir -p /tmp/ccollect/backup-chint
|
|
|
|
|
|
|
|
test-fixed-intervals: $(CCOLLECT_SOURCE) test-dir-source test-dir-destination test-dir-destination-chint
|
|
|
|
for s in ./test/conf/sources/*; do \
|
2019-11-25 12:35:22 +00:00
|
|
|
CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily "$$(basename '$$s')"; \
|
2019-11-25 07:42:42 +00:00
|
|
|
test "$$(ls -1 /tmp/ccollect/backup | wc -l)" -gt "0" || { cat ${TEST_LOG_FILE}; exit 1; }; \
|
2019-11-15 07:28:55 +00:00
|
|
|
done
|
|
|
|
CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} -a -v daily
|
2019-11-25 07:42:42 +00:00
|
|
|
test "$$(ls -1 /tmp/ccollect/backup | wc -l)" -gt "0" || { cat ${TEST_LOG_FILE}; exit 1; }
|
2019-11-15 07:28:55 +00:00
|
|
|
CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} -a -p daily
|
2019-11-25 07:42:42 +00:00
|
|
|
test "$$(ls -1 /tmp/ccollect/backup | wc -l)" -gt "0" || { cat ${TEST_LOG_FILE}; exit 1; }
|
2019-11-15 07:28:55 +00:00
|
|
|
@printf "\nFixed intervals test ended successfully\n"
|
|
|
|
|
|
|
|
test-interval-changing: $(CCOLLECT_SOURCE) test-dir-source test-dir-destination-chint
|
|
|
|
rm -rf /tmp/ccollect/backup-chint/*
|
2019-11-25 07:42:42 +00:00
|
|
|
test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "0" || { cat ${TEST_LOG_FILE}; exit 1; }
|
2019-11-15 07:28:55 +00:00
|
|
|
printf "3" > ./test/conf/sources/local-with-interval/intervals/daily
|
|
|
|
for x in 1 2 3 4 5; do CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily local-with-interval; done
|
2019-11-25 07:42:42 +00:00
|
|
|
test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "3" || { cat ${TEST_LOG_FILE}; exit 1; }
|
2019-11-15 07:28:55 +00:00
|
|
|
printf "5" > ./test/conf/sources/local-with-interval/intervals/daily
|
|
|
|
for x in 1 2 3 4 5 6 7; do CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily local-with-interval; done
|
2019-11-25 07:42:42 +00:00
|
|
|
test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "5" || { cat ${TEST_LOG_FILE}; exit 1; }
|
2019-11-15 07:28:55 +00:00
|
|
|
printf "4" > ./test/conf/sources/local-with-interval/intervals/daily
|
|
|
|
for x in 1 2 3 4 5 6; do CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily local-with-interval; done
|
2019-11-25 07:42:42 +00:00
|
|
|
test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "4" || { cat ${TEST_LOG_FILE}; exit 1; }
|
2019-11-15 07:28:55 +00:00
|
|
|
printf "3" > ./test/conf/sources/local-with-interval/intervals/daily
|
|
|
|
@printf "\nInterval changing test ended successfully\n"
|
|
|
|
|
|
|
|
test: test-fixed-intervals test-interval-changing
|
|
|
|
test -f "${TEST_LOG_FILE}"
|
|
|
|
@printf "\nTests ended successfully\n"
|