From a171a058f9102f3b2340a82792722452f88afcaa Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 22 Oct 2023 17:45:03 +0200 Subject: [PATCH] feat: check repo script --- tools/repo/check.d/crontabs.sh | 14 ++++++++++++++ tools/repo/check.d/docker-compose-config.sh | 8 ++++++++ tools/repo/check.sh | 12 ++++++++++++ 3 files changed, 34 insertions(+) create mode 100755 tools/repo/check.d/crontabs.sh create mode 100755 tools/repo/check.d/docker-compose-config.sh create mode 100755 tools/repo/check.sh diff --git a/tools/repo/check.d/crontabs.sh b/tools/repo/check.d/crontabs.sh new file mode 100755 index 0000000..23fea1d --- /dev/null +++ b/tools/repo/check.d/crontabs.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e +for cronfile in skel/etc/cron.d/*; do + echo "checking $cronfile..." + if ! echo "$cronfile" | grep -q "."; then + echo "$cronfile: crontabs may not have an extension" + exit 1 + fi + if ! [ $(tail -c1 "$cronfile" | wc -l) -gt 0 ]; then + echo "$cronfile: crontabs must end with a newline" + exit 1 + fi +done \ No newline at end of file diff --git a/tools/repo/check.d/docker-compose-config.sh b/tools/repo/check.d/docker-compose-config.sh new file mode 100755 index 0000000..e1e0393 --- /dev/null +++ b/tools/repo/check.d/docker-compose-config.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +for s in servers/*; do + echo "checking $s..." + HOSTNAME=$(echo $s | sed 's/servers\///') bash tools/server-docker-compose.sh config -q +done \ No newline at end of file diff --git a/tools/repo/check.sh b/tools/repo/check.sh new file mode 100755 index 0000000..2e2deeb --- /dev/null +++ b/tools/repo/check.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e +for c in tools/repo/check.d/*; do + echo "running $c..." + $c | while read line; do + echo -e "$c: $line" + done +done + +echo "repo is OK" +exit 0 \ No newline at end of file