πŸ’Ύ Archived View for going-flying.com β€Ί files β€Ί deploy captured on 2024-08-25 at 01:21:07.

View Raw

More Information

⬅️ Previous capture (2024-06-16)

-=-=-=-=-=-=-

#!/bin/sh
# going-flying.com post-receive hook for gemini://
# (c) 2016-2024 Matthew J. Ernisse <matt@going-flying.com>
# All Rights Reserved.
#
# Update the on-disk representation of my capsule when I push a new
# revision up to the git repository.

set -e

BRANCH=""
BUILD_DIR="/var/gemini"
CLONE_CREDS="$(cat hooks/.clone_creds)"
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
REV=0

while read oldrev newrev refname; do
	BRANCH="$refname"
	REV="$newrev"
done

if [ "$BRANCH" != "refs/heads/master" ]; then
	echo "detected $BRANCH, aborting"
	exit 0
fi

if [ -z "$GIT_DIR" ]; then
	echo >&2 "fatal: post-receive GIT_DIR not set"
	exit 1
fi

cat << EOF
                                Β»^  \
                               Ζ’     L
                      β–„β–„β–„β–Œ     ⌐    β•’
                     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆb   ΒΌ   /   ,β•“β–„β–„β–“β–ˆβ–Œ
                    β–β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ     )Θ    β•™β”” β•Ÿβ–ˆβ–ˆβ–ˆβ–Œ
                    β•«β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    ]   β••   Ξ¦β–ˆβ–€β–ˆβ–ˆβ–“β–ˆ
                    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β•ž    b "β–“ β–β–ˆβ•™Β¬
                    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ         β•˜ ]  β•šβ–€
                    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβŒ    β””
                   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ ╓┐  Ξ“
                  β–“β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ ,Β¬
                 β–β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
                ]β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
                β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–€β•™
              ]β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
              β•Ÿβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
              β•«β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ
              β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
             β–β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβŒ
             β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ
            ,β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
            β–β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆΒ΅
               ─└└└└└└└└└└└└└└└└└─
EOF

umask 0022

if [ ! -d "$BUILD_DIR" ]; then
	echo "Creating $BUILD_DIR"

	mkdir -p -- "$BUILD_DIR"
	chgrp www-data "$BUILD_DIR"
	chmod 664 "$BUILD_DIR"
fi

echo "updating $BUILD_DIR"
GIT_WORK_TREE=$BUILD_DIR git checkout -f

$BUILD_DIR/build/build.py "$BUILD_DIR/users/mernisse/"

echo "setting rev to $REV"
sed -e "s/GIT_REV/${REV}/" "$BUILD_DIR/how-built.gmi" > \
	"$BUILD_DIR/how-built.gmi.new"
mv $BUILD_DIR/how-built.gmi.new $BUILD_DIR/how-built.gmi

if [ ! -d "$BUILD_DIR/git/repo" ]; then
	mkdir -p -- "$BUILD_DIR/git/repo"
	sudo -u mernisse chown -- "$BUILD_DIR/git/repo"
fi

if [ -d "$BUILD_DIR/git/repo/gemini.git" ]; then
	sudo -u mernisse rm -r -- "$BUILD_DIR/git/repo/gemini.git"
fi

echo "Cloning bare repository for cgi."
sudo -u mernisse git -C $BUILD_DIR/git/repo clone --bare \
	https://${CLONE_CREDS}@ssl.ub3rgeek.net/repo/gemini.git

echo "site deployed."