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
38
39
40
41
42
43
|
#!/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'
<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140" stroke="#000"><path stroke-width="122" stroke-dasharray="2,38" d="m9,70h122M70,9v122"/><path stroke-width="33" stroke-linecap="round" d="m70,30h0m40,40h0m-80,40v0m40,0h0m40,0h0"/></svg>
SVGEOF
# Inject favicon link and network footer into all deployed HTML pages
python3 - "$WEBROOT" <<'EOF'
import sys, os, glob
webroot = sys.argv[1]
footer = (
'<footer>\n<hr>\n'
'<a href="https://twt.gumx.cc">twt</a> /\n'
'<a href="https://git.gumx.cc">git</a> /\n'
'<a href="https://mail.gumx.cc">mail</a> /\n'
'<a href="https://irc.gumx.cc">irc</a> /\n'
'<a href="https://files.gumx.cc">files</a> /\n'
'<a href="https://vpn.gumx.cc">vpn</a> /\n'
'<a href="https://pgp.gumx.cc">pgp</a> /\n'
'<a href="https://demo.gumx.cc">demo</a> /\n'
'<a href="https://wk.fo">wk.fo</a>\n'
'</footer>'
)
favicon_tag = '<link rel="icon" type="image/svg+xml" href="/favicon.svg">'
for path in glob.glob(os.path.join(webroot, '**', '*.html'), recursive=True):
html = open(path).read()
if '</head>' in html and favicon_tag not in html:
html = html.replace('</head>', favicon_tag + '\n</head>', 1)
if '</body>' in html and 'twt.gumx.cc' not in html:
html = html.replace('</body>', footer + '\n</body>', 1)
open(path, 'w').write(html)
EOF
echo "webring deployed"
|