!/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."

Proxy Information
Original URL
gemini://going-flying.com/files/deploy
Status Code
Success (20)
Meta
text/plain; charset=utf-8
Capsule Response Time
591.2569 milliseconds
Gemini-to-HTML Time
0.899567 milliseconds

This content has been proxied by September (ba2dc).