summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2017-10-13 18:34:45 +0200
committeranonym <anonym@riseup.net>2017-10-13 18:37:20 +0200
commit71e27f1d28e6a5fc7d64583a3de904b14fb29308 (patch)
tree5c5f7e78a6db9447472da96b5aa8a01f516eb774
parent598a022e337e143c95614de39f1ea765e9784bed (diff)
build-website: sanity check the website source before building it
... and make the check fatal unless `--non-fatal-sanity-check` is passed to `build-webiste`. Will-fix: #12726
-rwxr-xr-xbuild-website25
1 files changed, 25 insertions, 0 deletions
diff --git a/build-website b/build-website
index bb1590b..cea5580 100755
--- a/build-website
+++ b/build-website
@@ -1,3 +1,28 @@
#!/bin/sh
+set -e
+set -u
+
+FATAL_SANITY_CHECK=yes
+
+# Parse arguments aimed at this wrapper, and drop them for $@ so we
+# can pass it on to ikiwiki.
+for arg in "${@}"; do
+ shift
+ if [ "${arg}" = --non-fatal-sanity-check ]; then
+ FATAL_SANITY_CHECK=no
+ continue
+ fi
+ set -- "${@}" "${p}"
+done
+
+git_dir="$(git rev-parse --show-toplevel)"
+if ! "${git_dir}/bin/sanity-check-website" ; then
+ if [ "${FATAL_SANITY_CHECK}" != no ]; then
+ echo "Some pages in our wiki are bad! Please fix them or re-run" \
+ "with the --non-fatal-verification option">&2
+ exit 1
+ fi
+fi
+
ikiwiki -setup ikiwiki.setup -refresh "$@"