wowana.me

website source


commit a4db4e3f9013f768a350dda059a27b5953ac2a8f
parent 8b29dec056e804002af1d9b63a7d0ae25aca7dfb
Author: opal hart <opal@wowana.me>
Date:   Fri, 31 Jan 2020 06:07:27 +0000

gitindex: handle subdirectories, sort repos

Diffstat:
Mscripts/gitindex.sh | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/scripts/gitindex.sh b/scripts/gitindex.sh @@ -1,16 +1,19 @@ #!/bin/sh -repos="$(ssh mimiga find /var/lib/git -type d -name '*.git' -maxdepth 1)" +git_root=/var/lib/git +repos="$(ssh mimiga find "$git_root" -type d -name '*.git')" for repopath in $repos; do - repo="$(basename "$repopath" .git)" + repo="${repopath#"$git_root/"}" + repo="${repo%.git}" mkdir -p "out/git/$repo.git" markdown <src/git.inc >src/git.part.xht scripts/postproc.sh src/git.part.xht | - sed "s/%reponame%/$repo/g" >"out/git/$repo.git/index.xht" + sed "s@%reponame%@${repo#*/}@g" >"out/git/$repo.git/index.xht" done -printf %s "$repos" | sed 's@^.*/\([^/]*\)$@- [\1](/git/\1)@; 1i # git\n' | +printf %s "$repos" | sort | + sed 's@^'"$git_root"'/\(.*\)$@- [\1](/git/\1)@; 1i # git\n' | markdown > src/git-index.md.tmp scripts/postproc.sh src/git-index.md.tmp >out/git/index.xht rm src/git-index.md.tmp