stagit-gopher

[fork] gopher git frontend
Log | Files | Refs | README | LICENSE

commit bd3dc973cb3ad83ae58aaa48cfcc7be8090d9f24
parent 218c16a7b8203be267849416fe09f2f650fad4df
Author: hhvn <hayden@haydenvh.com>
Date:   Sun, 22 Nov 2020 17:51:08 +0000

create.sh: include clone URI

Diffstat:
Acreate.sh | 47+++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+), 0 deletions(-)

diff --git a/create.sh b/create.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# - Makes index for repositories in a single directory. +# - Makes static pages for each repository directory. +# +# NOTE, things to do manually (once) before running this script: +# - write clone url, for example "git://git.codemadness.org/dir" to the "url" +# file for each repo. +# - write description in "description" file. +# +# Usage: +# - mkdir -p gphdir && cd gphdir +# - sh example_create.sh + +# path must be absolute. +reposdir="$HOME/net/git/f" +gopherdir="$HOME/net" +stagitdir="/git/o" +destdir="${gopherdir}/${stagitdir}" + +# remove /'s at the end. +stagitdir=$(printf "%s" "${stagitdir}" | sed 's@[/]*$@@g') + +# make index. +stagit-gopher-index -b "${stagitdir}" "${reposdir}/"*/ > "${destdir}/index.gph" + +# make files per repo. +for dir in "${reposdir}/"*/; do + # strip .git suffix. + r=$(basename "${dir}") + d=$(basename "${dir}" ".git") + printf "%s... " "${d}" + + mkdir -p "${destdir}/${d}" + cd "${destdir}/${d}" || continue + stagit-gopher -b "${stagitdir}/${d}" -c ".cache" "${reposdir}/${r}" + + for f in ${destdir}/${d}/log.gph ${destdir}/${d}/refs.gph ${destdir}/${d}/files.gph + do + out=$(sed "s~^\[1|Log|~tgit clone git://haydenvh.com/$(basename $(dirname $f))\n[1|Log|~" < $f) + echo "$out" > $f + done + + # symlinks + ln -sf log.gph index.gph + + echo "done" +done