The MCDE chapter gets the desktop, System Settings, file manager and terminal figures; the Information Manager chapter gets its book list. The system HTML embeds the PNGs as data URIs, the website form points to www/img/, the manual pages keep the caption and the dtinfo book keeps the caption (the CDE DTD could carry TIFFs, but the library stays text). The PDF gets a page-number overlay (gs + qpdf) and a chapter outline (mutool); mutool clean normalises the file so qpdf and readers see the outline. docs/guide/check.sh checks outline and page numbers when the tools are installed; tools/test-tools.sh copies www/img for the site check and stays at 33 ok.
104 lines
3.8 KiB
Bash
Executable File
104 lines
3.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
#
|
|
# check.sh -- verify the installed copies of The Makronix Guide.
|
|
#
|
|
# This is the test that can go red: it reads the files the release installs
|
|
# (src/share/doc/makronix, src/share/man/man7, src/etc) and checks that each
|
|
# form is present and readable. It does not rebuild anything; the build is
|
|
# docs/guide/build.sh, which needs pandoc and Chrome.
|
|
#
|
|
# Usage: docs/guide/check.sh [root]
|
|
# (default root: the repository this script is in)
|
|
|
|
set -eu
|
|
|
|
HERE=$(cd "$(dirname "$0")" && pwd)
|
|
ROOT=${1:-$(cd "$HERE/../.." && pwd)}
|
|
DOC=$ROOT/src/share/doc/makronix
|
|
MAN=$ROOT/src/share/man/man7
|
|
ETC=$ROOT/src/etc
|
|
|
|
die()
|
|
{
|
|
echo "guide check: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
[ -s "$DOC/makronix-guide.html" ] || die "missing HTML"
|
|
grep -q '<title>The Makronix Guide</title>' "$DOC/makronix-guide.html" ||
|
|
die "the HTML does not name the guide"
|
|
grep -q 'class="cover"' "$DOC/makronix-guide.html" ||
|
|
die "the HTML has no cover"
|
|
grep -q 'data:image/png;base64,' "$DOC/makronix-guide.html" ||
|
|
die "the HTML has no embedded logo"
|
|
|
|
[ -s "$DOC/makronix-guide.pdf" ] || die "missing PDF"
|
|
pages=1
|
|
if command -v pdfinfo >/dev/null 2>&1; then
|
|
pages=$(pdfinfo "$DOC/makronix-guide.pdf" 2>/dev/null |
|
|
awk '/^Pages:/ { print $2; exit }')
|
|
[ -n "$pages" ] || die "the PDF has no page count"
|
|
[ "$pages" -gt 10 ] || die "the PDF has only $pages pages"
|
|
head -c 4 "$DOC/makronix-guide.pdf" | grep -q '%PDF' ||
|
|
die "the PDF has no PDF header"
|
|
fi
|
|
|
|
[ -f "$DOC/infolib/makronix.dti/bookcase.map" ] ||
|
|
die "missing information library"
|
|
grep -q 'MAKRONIX' "$DOC/infolib/makronix.dti/bookcase.map" ||
|
|
die "the information library does not name MAKRONIX"
|
|
[ -f "$DOC/infolib/makronix.dti/MAKRONIX/MAKRONIX.dbd" ] ||
|
|
die "the information library has no book database"
|
|
[ -f "$DOC/infolib/makronix.dti/MAKRONIX/dtsearch/dtsearch.ocf" ] ||
|
|
die "the information library has no search index"
|
|
|
|
command -v mandoc >/dev/null 2>&1 || die "mandoc is not installed"
|
|
want=$(( $(grep -c '^[^#].*|' "$HERE/chapters.list") + 1 ))
|
|
n=0
|
|
for f in "$MAN"/makronix-guide*.7; do
|
|
[ -f "$f" ] || continue
|
|
head -1 "$f" | grep -q '^\.TH ' || die "$f has no .TH line"
|
|
mandoc -Tutf8 "$f" >/dev/null 2>&1 || die "$f does not render"
|
|
n=$((n + 1))
|
|
done
|
|
[ "$n" -eq "$want" ] || die "found $n manual pages, expected $want"
|
|
|
|
[ -f "$ETC/makronix-xsession" ] || die "missing the Xsession script"
|
|
grep -q 'DTINFOLIBDEFAULT=makronix' "$ETC/makronix-xsession" ||
|
|
die "the Xsession script does not select the guide"
|
|
grep -q '/usr/share/doc/makronix/infolib/makronix.dti' "$ETC/Makefile" ||
|
|
die "src/etc/Makefile does not link the information library"
|
|
|
|
# The website copy lives in www/ in the source tree, not on an installed
|
|
# system. Check it when the tree has it.
|
|
if [ -f "$ROOT/www/guide.html" ]; then
|
|
[ -f "$ROOT/www/style.css" ] || die "www/guide.html has no style.css"
|
|
grep -q 'class="content guide"' "$ROOT/www/guide.html" ||
|
|
die "www/guide.html has no site window"
|
|
grep -q 'href="guide.html" class="here"' "$ROOT/www/guide.html" ||
|
|
die "www/guide.html does not mark the Guide menu"
|
|
if command -v xmllint >/dev/null 2>&1; then
|
|
xmllint --html --noout "$ROOT/www/guide.html" 2>/dev/null ||
|
|
die "www/guide.html does not parse as HTML"
|
|
fi
|
|
for img in $(grep -o 'src="img/[^"]*"' "$ROOT/www/guide.html" |
|
|
cut -d'"' -f2); do
|
|
[ -f "$ROOT/www/$img" ] ||
|
|
die "www/guide.html refers to missing $img"
|
|
done
|
|
fi
|
|
|
|
if command -v mutool >/dev/null 2>&1; then
|
|
mutool show "$DOC/makronix-guide.pdf" outline 2>/dev/null |
|
|
grep -q 'MCDE: The Desktop' ||
|
|
die "the PDF has no chapter outline"
|
|
fi
|
|
if command -v pdftotext >/dev/null 2>&1; then
|
|
pdftotext "$DOC/makronix-guide.pdf" - 2>/dev/null |
|
|
grep -q 'Page ' ||
|
|
die "the PDF has no page numbers"
|
|
fi
|
|
|
|
echo "guide check: ok ($n manual pages, $pages PDF pages)"
|