#!/bin/sh
set -e
WEBROOT=/var/www/webring.gumx.cc
cd /home/git/build/webring
bash wr build
rsync -rlptD --delete public/ "$WEBROOT/"
# Deploy fonts (webring HTML references /fonts/KawkabMono-*.woff2 via @font-face)
mkdir -p "$WEBROOT/fonts"
rsync -rlptD /var/www/coffee.gumx.cc/fonts/ "$WEBROOT/fonts/"
# Deploy favicon as file
cat > "$WEBROOT/favicon.svg" <<'SVGEOF'
SVGEOF
# Inject favicon link and network footer into all deployed HTML pages
python3 - "$WEBROOT" <<'EOF'
import sys, os, glob
webroot = sys.argv[1]
footer = (
''
)
favicon_tag = ''
for path in glob.glob(os.path.join(webroot, '**', '*.html'), recursive=True):
html = open(path).read()
if '' in html and favicon_tag not in html:
html = html.replace('', favicon_tag + '\n', 1)
if '