#!/bin/sh # sitecheck.sh — every page of website/ (clean URL), the sitemap, an asset, a missing page (must be 404), # and the installer's sha256 against installer-v1.36.1. Prints one line per check and a summary. B="$1"; R=/mnt/5_hdd/felhom.eu/git/felhom.eu; ok=0; bad=0 chk() { code=$(curl -s -o /dev/null -w '%{http_code}' "$B$1"); if [ "$code" = "$2" ]; then ok=$((ok+1)); else bad=$((bad+1)); echo "BAD $1 -> $code (want $2)"; fi; } for f in $(cd $R/website && find . -name '*.html' | sed 's|^\./||' | sort); do case "$f" in 404.html) continue;; index.html) p=/;; */index.html) p=/${f%index.html};; *) p=/${f%.html};; esac chk "$p" 200 done chk /sitemap.xml 200; chk /robots.txt 200; chk /assets/site.css 200; chk /no-such-page-r1228 404 want=$(git -C $R show installer-v1.36.1:scripts/felhom-host-install.sh | sha256sum | cut -d' ' -f1) got=$(curl -fsS "$B/scripts/felhom-host-install.sh" | sha256sum | cut -d' ' -f1) [ "$want" = "$got" ] && { ok=$((ok+1)); echo "installer sha256 $got = installer-v1.36.1"; } || { bad=$((bad+1)); echo "BAD installer sha256 $got (want $want)"; } echo "$B: $ok ok, $bad bad"