summaryrefslogtreecommitdiffstats
path: root/hooks/post-receive
blob: f628a107fb4faebafb449d54a0d9c5134e74ca91 (plain) (blame)
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
44
45
46
47
48
49
50
51
52
#!/bin/sh
set -e
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

WORK=/home/git/build/sites

cd "$WORK"
python3 _shared/build.py .

for SITE in irc.gumx.cc vpn.gumx.cc mail.gumx.cc pgp.gumx.cc wk.fo twt.gumx.cc files.gumx.cc demo.gumx.cc list.gumx.cc; do
    if [ -d "$SITE" ]; then
        WEBROOT="/var/www/$SITE"
        mkdir -p "$WEBROOT"
        case "$SITE" in
            irc.gumx.cc)
                # bots/ is managed by irc-bots repo
                rsync -rlptD --delete --exclude='/fonts' --exclude='/bots/' "$SITE/" "$WEBROOT/"
                ;;
            twt.gumx.cc)
                # twtxt.txt is written by alfred/twt.sh, not tracked in this repo
                rsync -rlptD --delete --exclude='/fonts' --exclude='/twtxt.txt' "$SITE/" "$WEBROOT/"
                ;;
            demo.gumx.cc)
                # no-style-please/ is managed by zola-no-style-please repo; demos.json is a source file
                # /ccc/ and /styles/ are managed by ccc repo hook — do not delete
                rsync -rlptD --delete \
                    --exclude='/fonts' \
                    --exclude='/no-style-please/' \
                    --exclude='/demos.json' \
                    --exclude='/ccc/' \
                    --exclude='/styles/' \
                    "$SITE/" "$WEBROOT/"
                ;;
            *)
                rsync -rlptD --delete --exclude='/fonts' "$SITE/" "$WEBROOT/"
                ;;
        esac
        mkdir -p "$WEBROOT/fonts"
        rsync -rlptD fonts/ "$WEBROOT/fonts/"
        cp _shared/favicon.svg "$WEBROOT/favicon.svg"
        cp _shared/404.html "$WEBROOT/404.html"
    fi
done

chmod +x /var/www/wk.fo/pks/cgi-bin/pgp-hkp.sh || true
chmod +x /var/www/pgp.gumx.cc/cgi-bin/pgp-hkp.sh || true

# 404 page for sites outside this hook
cp _shared/404.html /var/www/gumx.cc/404.html || true
cp _shared/404.html /usr/share/webapps/cgit/404.html || true

echo "sites deployed"