diff options
Diffstat (limited to 'repo-specific')
-rwxr-xr-x | repo-specific/github-mirror | 24 | ||||
-rwxr-xr-x | repo-specific/github-ssh-wrapper | 11 | ||||
-rwxr-xr-x | repo-specific/website-maker | 44 |
3 files changed, 79 insertions, 0 deletions
diff --git a/repo-specific/github-mirror b/repo-specific/github-mirror new file mode 100755 index 0000000..9223975 --- /dev/null +++ b/repo-specific/github-mirror @@ -0,0 +1,24 @@ +#!/bin/sh +# based on https://cgit.gentoo.org/infra/githooks.git/plain/github-mirror/github-mirror + +# simple gitolite mirroring + +# flush STDIN coming from git, because gitolite's own post-receive.mirrorpush +# script does the same thing +[ -t 0 ] || cat >/dev/null + +if [ -z "${GL_REPO}" ]; then + echo "GL_REPO not set" >&2 + exit 1 +fi + +targets=$(git config --get mirror.url) +[ -z "${targets}" ] && exit 0 + +[ -z "${GIT_SSH_KEY}" ] && export GIT_SSH_KEY=$(git config --get mirror.pubkey) +export GIT_SSH=$(dirname "$(readlink -f "$0")")/github-ssh-wrapper + +for target in ${targets}; do + # --force because someone may accidentally push into the mirror + git push --mirror --force ${target} +done diff --git a/repo-specific/github-ssh-wrapper b/repo-specific/github-ssh-wrapper new file mode 100755 index 0000000..b05ff4f --- /dev/null +++ b/repo-specific/github-ssh-wrapper @@ -0,0 +1,11 @@ +#!/bin/sh +# also ripped from gentoo's githooks (they're simply awesome) + +# Use via GIT_SSH +# OBSOLETE!!! Github is terrible and requires old ciphers/kex/macs +#CIPHERS='-o Ciphers=chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc' +#KEX='-o KexAlgorithms=curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1' +#MACS='-o MACs=hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,hmac-sha1' + +# Now run it +exec ssh ${GIT_SSH_KEY:+-i} ${GIT_SSH_KEY} $CIPHERS $KEX $MACS "$@" diff --git a/repo-specific/website-maker b/repo-specific/website-maker new file mode 100755 index 0000000..9137c21 --- /dev/null +++ b/repo-specific/website-maker @@ -0,0 +1,44 @@ +#!/bin/sh +# this one i made myself +# website.dir - directory to output to +# website.standalone - used to inform pandoc that we are standalone mode +# (used with template.html in project /) +# .wbignore follows grep syntax +# you can see www/www.turret.cyou for an example project structure + +[ -t 0 ] || cat >/dev/null + +if [ -z "${GL_REPO}" ]; then + echo "GL_REPO not set" >&2 + exit 1 +fi + +target=$(git config --get website.dir) +[ -z "${target}" ] && exit 0 + +TMPDIR=$(mktemp -d) +chmod 755 "${TMPDIR}" + +cp . "${TMPDIR}/.git" -R + +cd "${TMPDIR}" +unset GIT_DIR +unset GIT_WORK_TREE +git config --unset core.bare +git checkout master -f +echo "WEBSITEBUILDER: generating html files" +files=$(find * -type f || exit 1) +[ -f .wbignore ] && files=$(echo -n "${files}" | grep -vf .wbignore) +for file in ${files}; do + outputfile="$(echo -n $file | rev | cut -d '.' -f2- | rev).html" + pandoc "${file}" $([ $(git config --get website.standalone || echo -n 0) -gt 0 ] && echo -n "--standalone $([ -f template.html ] && echo -n "--template template.html")") --ascii -o "${outputfile}" + rm "${file}" +done + +echo "WEBSITEBUILDER: deploying" +rm -Rf "${target}" || (echo "WEBSITEBUILDER: couldnt remove old website" && exit 1) +rm -Rf "${TMPDIR}/.git" +mv "${TMPDIR}" "${target}" || (echo "WEBSITEBUILDER: couldnt update website" && exit 1) +chmod -R a+rX "${target}" + +cd |