diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-09-04 16:24:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-09-04 16:24:02 +0000 |
commit | 56d5120c27df0b02ad9acf801bd2fb01f1b9abcc (patch) | |
tree | f28f65f6d6845a82f84e127bfda667e006dd778a | |
parent | Adding upstream version 20210828. (diff) | |
download | open-infrastructure-service-tools-cf204308437c0adb2b4d1d95c4832a911852d86a.tar.xz open-infrastructure-service-tools-cf204308437c0adb2b4d1d95c4832a911852d86a.zip |
Adding upstream version 20210904.upstream/20210904
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
24 files changed, 494 insertions, 10 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8fe2fd7..9aeb844 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,19 @@ +2021-09-04 Daniel Baumann <daniel.baumann@open-infrastructure.net> + + * Releasing version 20210904. + + [ Daniel Baumann ] + * Adding dehydrated TODO file. + * Adding knot tools. + * Reading configuration files in dehydrated-nsupdate for future tsig support. + * Using less confusing variable name for the txt record to update in dehydrated-nsupdate. + * Improving message when update txt records in dehydrated-nsupdate. + * Harmonizing copyright headers. + * Correcting typo in date of previous changelog entry. + 2021-08-28 Daniel Baumann <daniel.baumann@open-infrastructure.net> - * Releasing version 20210821. + * Releasing version 20210828. [ Daniel Baumann ] * Moving apache files to subdirectory. diff --git a/VERSION.txt b/VERSION.txt index 31d17e8..fd5abf1 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -20210828 +20210904 diff --git a/apache/Makefile b/apache/Makefile index 90758cf..3977399 100644 --- a/apache/Makefile +++ b/apache/Makefile @@ -1,4 +1,6 @@ -# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -13,7 +15,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. SHELL := sh -e diff --git a/dehydrated/Makefile b/dehydrated/Makefile index 0c9da96..5a6239d 100644 --- a/dehydrated/Makefile +++ b/dehydrated/Makefile @@ -50,7 +50,7 @@ test: then \ for SCRIPT in $(SCRIPTS); \ do \ - shellcheck -e SC2039 $${SCRIPT}; \ + shellcheck -e SC1090 -e SC2039 $${SCRIPT}; \ echo -n "."; \ done; \ else \ diff --git a/dehydrated/TODO b/dehydrated/TODO new file mode 100644 index 0000000..0025e8a --- /dev/null +++ b/dehydrated/TODO @@ -0,0 +1,4 @@ +TODO +==== + + * add hmac/tsig support diff --git a/dehydrated/bin/dehydrated-cron b/dehydrated/bin/dehydrated-cron index 09e1a44..8264761 100755 --- a/dehydrated/bin/dehydrated-cron +++ b/dehydrated/bin/dehydrated-cron @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e mkdir -p /var/log/dehydrated diff --git a/dehydrated/bin/dehydrated-hook.d b/dehydrated/bin/dehydrated-hook.d index 2d9a5af..4e7b7ff 100755 --- a/dehydrated/bin/dehydrated-hook.d +++ b/dehydrated/bin/dehydrated-hook.d @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e HOOKS="/etc/dehydrated/hook.d" diff --git a/dehydrated/bin/dehydrated-nsupdate b/dehydrated/bin/dehydrated-nsupdate index f901d2e..ec8cf7f 100755 --- a/dehydrated/bin/dehydrated-nsupdate +++ b/dehydrated/bin/dehydrated-nsupdate @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e HOOK="$(basename "${0}")" @@ -50,18 +69,27 @@ else exit 1 fi +# config +for FILE in /etc/default/dehydrated-nsupdate /etc/default/dehydrated-nsupdate.d/* +do + if [ -e "${FILE}" ] + then + . "${FILE}" + fi +done + # find txt record to update CNAME="$(${DIG} "_acme-challenge.${DOMAIN}" 2>&1 | awk '/CNAME/ { print $5 }' | tail -n1)" if [ -n "${CNAME}" ] then - UPDATE_DOMAIN="${CNAME}" + TXT_RECORD="${CNAME}" else - UPDATE_DOMAIN="_acme-challenge.${DOMAIN}" + TXT_RECORD="_acme-challenge.${DOMAIN}" fi # find nameservers to update -ZONE="${UPDATE_DOMAIN}" +ZONE="${TXT_RECORD}" while true do @@ -80,12 +108,12 @@ NAMESERVERS="$(${DIG} +short NS "${ZONE}")" # update nameservers for NAMESERVER in ${NAMESERVERS} do - echo -n " + Adding TXT record (${UPDATE_DOMAIN})..." + echo -n " + sending '${HOOK_ACTION}' for ${TXT_RECORD} to ${NAMESERVER}..." echo "server ${NAMESERVER} zone ${ZONE} ttl 0 -update ${HOOK_ACTION} ${UPDATE_DOMAIN} 0 TXT ${TOKEN_VALUE} +update ${HOOK_ACTION} ${TXT_RECORD} 0 TXT ${TOKEN_VALUE} send" | "${NSUPDATE}" echo " done." diff --git a/dehydrated/share/hooks/deploy_cert.fullchain-privkey b/dehydrated/share/hooks/deploy_cert.fullchain-privkey index 5457036..95f0aa7 100755 --- a/dehydrated/share/hooks/deploy_cert.fullchain-privkey +++ b/dehydrated/share/hooks/deploy_cert.fullchain-privkey @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e DIRECTORY="$(dirname "${FULLCHAINFILE}")" diff --git a/dehydrated/share/hooks/deploy_ocsp.fullchain-privkey b/dehydrated/share/hooks/deploy_ocsp.fullchain-privkey index e68716b..70af6dc 100755 --- a/dehydrated/share/hooks/deploy_ocsp.fullchain-privkey +++ b/dehydrated/share/hooks/deploy_ocsp.fullchain-privkey @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e FILE="$(readlink "${OCSPFILE}")" diff --git a/dehydrated/share/hooks/exit_hook.fix-permissions b/dehydrated/share/hooks/exit_hook.fix-permissions index c5bb646..d19c8e6 100755 --- a/dehydrated/share/hooks/exit_hook.fix-permissions +++ b/dehydrated/share/hooks/exit_hook.fix-permissions @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e echo " + Fixing permissions..." diff --git a/dehydrated/share/hooks/exit_hook.service-reload b/dehydrated/share/hooks/exit_hook.service-reload index 2da8c1b..f7bc8e4 100755 --- a/dehydrated/share/hooks/exit_hook.service-reload +++ b/dehydrated/share/hooks/exit_hook.service-reload @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e echo " + Reloading services..." diff --git a/git/bin/git-checkout-branches b/git/bin/git-checkout-branches index 5b1ef15..f1aa862 100755 --- a/git/bin/git-checkout-branches +++ b/git/bin/git-checkout-branches @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e CURRENT_BRANCH="$(git branch --show-current)" diff --git a/git/bin/git-hook.d b/git/bin/git-hook.d index 1c0ab10..b6928d9 100755 --- a/git/bin/git-hook.d +++ b/git/bin/git-hook.d @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e HOOKS="${0}.d" diff --git a/git/bin/git-remove-origin-branches b/git/bin/git-remove-origin-branches index f2b580f..9ae5f30 100755 --- a/git/bin/git-remove-origin-branches +++ b/git/bin/git-remove-origin-branches @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e BRANCHES="${*}" diff --git a/git/bin/git-remove-origin-tags b/git/bin/git-remove-origin-tags index bcbf192..5d99ada 100755 --- a/git/bin/git-remove-origin-tags +++ b/git/bin/git-remove-origin-tags @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e TAGS="${*}" diff --git a/git/bin/git-repo-repack b/git/bin/git-repo-repack index d9d7357..0d3c106 100755 --- a/git/bin/git-repo-repack +++ b/git/bin/git-repo-repack @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e case "${1}" in diff --git a/git/share/hooks/post-update.d/cgit-agefile b/git/share/hooks/post-update.d/cgit-agefile index cf95745..f036215 100755 --- a/git/share/hooks/post-update.d/cgit-agefile +++ b/git/share/hooks/post-update.d/cgit-agefile @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e agefile="$(git rev-parse --git-dir)"/info/web/last-modified diff --git a/git/share/hooks/post-update.d/git-update-server-info b/git/share/hooks/post-update.d/git-update-server-info index fba9845..9a055f1 100755 --- a/git/share/hooks/post-update.d/git-update-server-info +++ b/git/share/hooks/post-update.d/git-update-server-info @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e git update-server-info diff --git a/git/share/hooks/post-update.d/irker-notification b/git/share/hooks/post-update.d/irker-notification index 212cc6c..3daf5d0 100755 --- a/git/share/hooks/post-update.d/irker-notification +++ b/git/share/hooks/post-update.d/irker-notification @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e if [ -z "$(git config --get irker.project)" ] diff --git a/irker/bin/irkerhook-debian b/irker/bin/irkerhook-debian index bd9e160..9e40ebf 100755 --- a/irker/bin/irkerhook-debian +++ b/irker/bin/irkerhook-debian @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e MESSAGE="${*}" diff --git a/knot-resolver/bin/kresd-cache-clear b/knot-resolver/bin/kresd-cache-clear index 5eadee0..2cd54a6 100755 --- a/knot-resolver/bin/kresd-cache-clear +++ b/knot-resolver/bin/kresd-cache-clear @@ -1,5 +1,24 @@ #!/bin/sh +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + set -e HOSTS="${*}" diff --git a/knot/Makefile b/knot/Makefile new file mode 100644 index 0000000..3a2e4b9 --- /dev/null +++ b/knot/Makefile @@ -0,0 +1,80 @@ +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + +SHELL := sh -e + +SCRIPTS = bin/* + +all: build + +test: + @echo -n "Checking for syntax errors with sh... " + @for SCRIPT in $(SCRIPTS); \ + do \ + sh -n $${SCRIPT}; \ + echo -n "."; \ + done + @echo " done." + + @echo -n "Checking for bashisms... " + @if [ -x /usr/bin/checkbashisms ]; \ + then \ + for SCRIPT in $(SCRIPTS); \ + do \ + checkbashisms -f -x $${SCRIPT}; \ + echo -n "."; \ + done; \ + else \ + echo "Note: devscripts not installed, skipping checkbashisms."; \ + fi + @echo " done." + + @echo -n "Checking with shellcheck... " + @if [ -x /usr/bin/shellcheck ]; \ + then \ + for SCRIPT in $(SCRIPTS); \ + do \ + shellcheck -e SC2039 $${SCRIPT}; \ + echo -n "."; \ + done; \ + else \ + echo "Note: shellcheck not installed, skipping shellcheck."; \ + fi + @echo " done." + +build: + +install: build + mkdir -p $(DESTDIR)/usr/bin + cp -r bin/* $(DESTDIR)/usr/bin + +uninstall: + for FILE in bin/*; \ + do \ + rm -f $(DESTDIR)/usr/bin/$$(basename $${FILE}); \ + done + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/bin || true + + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR) || true + +clean: + +distclean: + +reinstall: uninstall install diff --git a/knot/bin/knot-zone-reset b/knot/bin/knot-zone-reset new file mode 100755 index 0000000..cc310b0 --- /dev/null +++ b/knot/bin/knot-zone-reset @@ -0,0 +1,53 @@ +#!/bin/sh + +# Open Infrastructure: service-tools + +# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# SPDX-License-Identifier: GPL-3.0+ +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <https://www.gnu.org/licenses/>. + +set -e + +HOSTS="${*}" + +if [ -z "${HOSTS}" ] +then + echo "Usage: ${0} localhost|[HOST1 HOST2 ...]" >&2 + exit 1 +fi + +for HOST in ${HOSTS} +do + case "${HOST}" in + localhost) + echo -n "Flushing zone memory..." + + service knot stop + rm -rf /var/lib/knot/timers/*.mdb + service knot start + + echo " done." + ;; + + *) + echo -n "Flushing ${HOST} zone memory..." + + ssh "${HOST}" "sudo service knot stop && rm -rf /var/lib/knot/timers/*.mdb && sudo service knot start" + + echo " done." + ;; + esac +done |