#!/bin/sh # Build the site into public/ and pack it as site.tar.gz: each page in # src/ has its `` and `` # lines replaced by partials/header.html and partials/footer.html; # everything else in src/ is copied as it is. Plain sh, awk and tar, so # it runs in any image (and on the VisionFive 2 Lite) with nothing to # install. set -eu cd "$(dirname "$0")/.." rm -rf public mkdir -p public (cd src && find . -type f) | while read -r f; do mkdir -p "public/$(dirname "$f")" case "$f" in *.html) awk ' // { while ((getline l < "partials/header.html") > 0) print l; close("partials/header.html"); next } // { while ((getline l < "partials/footer.html") > 0) print l; close("partials/footer.html"); next } { print } ' "src/$f" > "public/$f" if grep -q '