#!/bin/sh # going-flying.com post-receive hook for gemini:// # (c) 2016-2020 Matthew J. Ernisse # 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" 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 -- "$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 echo "site deployed."