diff --git a/.gitignore b/.gitignore index 6a82cbe..e5c18f6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,3 @@ doc/*.xml doc/*/*.xml *.texi *.fo -*.lock diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5391f4d..b499ddc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,10 +3,18 @@ stages: unit_tests: stage: test + before_script: + - 'apk update' + - 'apk add make rsync' script: - make test shellcheck: stage: test + before_script: + - 'apk update' + - 'apk add make' + - 'wget https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz' + - 'tar xf shellcheck-stable.linux.x86_64.tar.xz && mv shellcheck-stable/shellcheck /usr/bin/' script: - make shellcheck diff --git a/Makefile b/Makefile index cda6d81..1e783fc 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ ASCIIDOC=asciidoc DOCBOOKTOTEXI=docbook2x-texi DOCBOOKTOMAN=docbook2x-man XSLTPROC=xsltproc -XSL=/usr/local/share/xsl/docbook/html/docbook.xsl +XSL=/usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl A2X=a2x prefix=/usr/packages/ccollect-git @@ -41,7 +41,11 @@ manlink=/usr/local/man/man1 path_dir=/usr/local/bin path_destination=${path_dir}/${CCOLLECT_DEST} -docs_archive_name=docs.tar + +# where to publish +host=localhost +dir=/home/users/nico/privat/rechner/netz/seiten/www.nico.schottelius.org/src/software/ccollect +docdir=${dir}/documentation # # Asciidoc will be used to generate other formats later @@ -87,8 +91,6 @@ all: @echo "info: only generate Texinfo" @echo "man: only generate manpage{s}" @echo "install: install ccollect to ${prefix}" - @echo "shellcheck: shellcheck ccollect script" - @echo "test: run unit tests" html: ${HTMLDOCS} htm: ${DBHTMLDOCS} @@ -177,9 +179,9 @@ pub: git push publish-doc: documentation + @echo "Transferring files to ${host}" @chmod a+r ${DOCS} ${DOC_ALL} - @tar cf ${docs_archive_name} ${DOCS} ${DOC_ALL} - @echo "Documentation files are in ${docs_archive_name}" + @tar c ${DOCS} ${DOC_ALL} | ssh ${host} "cd ${dir}; tar xv" # # Distribution @@ -235,13 +237,13 @@ test-interval-changing: $(CCOLLECT_SOURCE) test-dir-source test-dir-destination- test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "0" || { cat ${TEST_LOG_FILE}; exit 1; } 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 - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "4" || { cat ${TEST_LOG_FILE}; exit 1; } + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "3" || { cat ${TEST_LOG_FILE}; exit 1; } 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 - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "6" || { cat ${TEST_LOG_FILE}; exit 1; } + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "5" || { cat ${TEST_LOG_FILE}; exit 1; } 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 - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "5" || { cat ${TEST_LOG_FILE}; exit 1; } + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "4" || { cat ${TEST_LOG_FILE}; exit 1; } printf "3" > ./test/conf/sources/local-with-interval/intervals/daily @printf "\nInterval changing test ended successfully\n" diff --git a/ccollect b/ccollect index 8b8f9e5..61e4ebd 100755 --- a/ccollect +++ b/ccollect @@ -45,8 +45,8 @@ TMP="$(mktemp "/tmp/${__myname}.XXXXXX")" export TMP CONTROL_PIPE="/tmp/${__myname}-control-pipe" -VERSION="2.10" -RELEASE="2020-08-26" +VERSION="2.7" +RELEASE="2019-11-14" HALF_VERSION="ccollect ${VERSION}" FULL_VERSION="ccollect ${VERSION} (${RELEASE})" @@ -824,11 +824,6 @@ while [ "${source_no}" -lt "${no_sources}" ]; do rsync "$@" "${source}" "${destination_dir}"; ret=$? _techo "Finished backup (rsync return code: $ret)." - # - # export rsync return code, might be useful in post_exec - # - export rsync_return_code=$ret - # # Set modification time (mtime) to current time, if sorting by mtime is enabled # @@ -861,16 +856,6 @@ while [ "${source_no}" -lt "${no_sources}" ]; do _techo "Warning: rsync failed with return code $ret." fi - # - # Create symlink to newest backup - # - # shellcheck disable=SC2010 - latest_dir="$(ls -${TSORT}p1 "${ddir}" | grep '/$' | head -n 1)" || \ - _exit_err "Failed to list content of ${ddir}." - - ln -snf "${ddir}/${latest_dir}" "${ddir}/current" || \ - _exit_err "Failed to create 'current' symlink." - # # post_exec # diff --git a/doc/ccollect.text b/doc/ccollect.text index f075b9a..2478265 100644 --- a/doc/ccollect.text +++ b/doc/ccollect.text @@ -1,7 +1,7 @@ ccollect - Installing, Configuring and Using ============================================ Nico Schottelius -2.10, for ccollect 2.10, Initial Version from 2006-01-13 +2.7, for ccollect 2.7, Initial Version from 2006-01-13 :Author Initials: NS diff --git a/doc/changes/2.10 b/doc/changes/2.10 deleted file mode 100644 index 1d1e85d..0000000 --- a/doc/changes/2.10 +++ /dev/null @@ -1 +0,0 @@ -* Add 'current' symlink to backup destinations (Steffen Zieger) diff --git a/doc/changes/2.8 b/doc/changes/2.8 deleted file mode 100644 index 563b438..0000000 --- a/doc/changes/2.8 +++ /dev/null @@ -1 +0,0 @@ -* Fix excluding destination dir from removal diff --git a/doc/changes/2.9 b/doc/changes/2.9 deleted file mode 100644 index 45097c7..0000000 --- a/doc/changes/2.9 +++ /dev/null @@ -1 +0,0 @@ -* Make rsync return code available in post_exec (Steffen Zieger) diff --git a/doc/changes/next b/doc/changes/next deleted file mode 100644 index 81efe7b..0000000 --- a/doc/changes/next +++ /dev/null @@ -1 +0,0 @@ -* Fix 'current' symlink (Jun Futagawa)