stagit-gopher

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

commit ba520aca416e0a37bb905d9ce2ea81d876f440bf
parent cf09c0af0a65f1f284033bf3f69c94820e981214
Author: hhvn <dev@hhvn.uk>
Date:   Sat, 22 Jan 2022 12:29:27 +0000

makefile create.sh -> create.rc: rewrite create script

Diffstat:
Acreate.rc | 37+++++++++++++++++++++++++++++++++++++
Dcreate.sh | 48------------------------------------------------
Mmakefile | 16+++-------------
3 files changed, 40 insertions(+), 61 deletions(-)

diff --git a/create.rc b/create.rc @@ -0,0 +1,37 @@ +#!/bin/rc + +# Add my dir to $path +# This script should still be able to +# run if the binaries aren't installed. +# path = ($path `$nl{dirname $0}) + +reposdir = /srv/git +repos = $reposdir/* +gopherdir = /srv/zfs/net +stagitdir = /git/o +destdir = $gopherdir ^ '/' ^ $stagitdir + +# Make index +if (test -f $reposdir/info) { + cp $reposdir/info $destdir/index.gph +} else { + rm $destdir/index.gph +} +stagit-gopher-index -b $stagitdir $repos | tail -n +2 >> $destdir/index.gph + +# Make repos +for (repo in $repos) { + display = `$nl{basename $repo '.git'} + dest = $destdir ^ $display + savedir = `$nl{pwd} + + printf '%s... ' $display + + mkdir -p $dest + cd $dest + stagit-gopher -b $dest -l 75 $repo + ln -sf log.gph index.gph + + cd $savedir + printf 'done\n' +} diff --git a/create.sh b/create.sh @@ -1,48 +0,0 @@ -#!/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. -cp "${reposdir}/info" "${destdir}/index.gph" -stagit-gopher-index -b "${stagitdir}" "${reposdir}/"*/ | tail -n +2 >> "${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}" -l 75 "${reposdir}/${r}" - - for f in ${destdir}/${d}/log.gph ${destdir}/${d}/refs.gph ${destdir}/${d}/files.gph - do - out=$(sed "s~^\[1|Log|~[j|git clone git://hhvn.uk/$(basename $(dirname $f))|$(basename $(dirname $f))|hhvn.uk|9418]\n[1|Log|~" < $f; printf "\n\n[e|Send patches to: dev@MAIlH0ST - where MAIlH0ST is hhvn.uk|dev|hhvn.uk|]\n") - printf '%s\n' "$out" > $f - done - - # symlinks - ln -sf log.gph index.gph - - echo "done" -done diff --git a/makefile b/makefile @@ -6,7 +6,6 @@ VERSION = 0.9.4 # paths PREFIX = /usr/local MANPREFIX = ${PREFIX}/man -DOCPREFIX = ${PREFIX}/share/doc/${NAME} LIBGIT_INC = -I/usr/local/include LIBGIT_LIB = -L/usr/local/lib -lgit2 @@ -52,7 +51,6 @@ dist: mkdir -p ${NAME}-${VERSION} cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \ Makefile \ - example_create.sh example_post-receive.sh \ ${NAME}-${VERSION} # make tarball tar -cf - ${NAME}-${VERSION} | \ @@ -70,18 +68,14 @@ stagit-gopher-index: stagit-gopher-index.o ${COMPATOBJ} clean: rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz -install-sh: - install -m 755 create.sh $(DESTDIR)$(PREFIX)/bin/stagit-gopher-create +install-rc: + install -m 755 create.rc $(DESTDIR)$(PREFIX)/bin/stagit-gopher-create -install: all install-sh +install: all install-rc # installing executable files. mkdir -p ${DESTDIR}${PREFIX}/bin cp -f ${BIN} ${DESTDIR}${PREFIX}/bin for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done - # installing example files. - mkdir -p ${DESTDIR}${DOCPREFIX} - cp -f README\ - ${DESTDIR}${DOCPREFIX} # installing manual pages. mkdir -p ${DESTDIR}${MANPREFIX}/man1 cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 @@ -90,10 +84,6 @@ install: all install-sh uninstall: # removing executable files. for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done - # removing example files. - rm -f \ - ${DESTDIR}${DOCPREFIX}/README - -rmdir ${DESTDIR}${DOCPREFIX} # removing manual pages. for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done