summaryrefslogtreecommitdiffstats
path: root/build-website
blob: b7d0928a163965244d4eaf0dc2e327da24e7a1f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

set -e
set -u

FATAL_SANITY_CHECK=yes

# Parse arguments aimed at this wrapper, and drop them from $@ 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 -- "${@}" "${arg}"
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-sanity-check option" >&2
        exit 1
    fi
fi

# If I knew Ikiwiki better I'd probably figure out how to just make it
# keep the misc/*.html files as-is instead of this hack.
fixup_14962_workaround() {
    mkdir -p config/chroot_local-includes/usr/share/doc/tails/website/misc
    rm -f config/chroot_local-includes/usr/share/doc/tails/website/misc/*
    cp wiki/src/misc/*.html \
       config/chroot_local-includes/usr/share/doc/tails/website/misc
}

ikiwiki -setup ikiwiki.setup -refresh "$@" && fixup_14962_workaround