Introduction
Introduction Statistics Contact Development Disclaimer Help
tCreate stagit-gopher pages for repositories - stagit - static git page generat…
git clone git://src.adamsgaard.dk/stagit
Log
Files
Refs
README
LICENSE
---
commit 266351f14f1f75459a6d2e81d27513da080ad065
parent 659766c53a09b469a534cbeba9d2fe7181542fa5
Author: Anders Damsgaard <[email protected]>
Date: Mon, 24 Feb 2020 15:53:52 +0100
Create stagit-gopher pages for repositories
Diffstat:
A create-gopher.sh | 37 +++++++++++++++++++++++++++++…
M create.sh | 3 +--
M post-receive.sh | 27 +++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 2 deletions(-)
---
diff --git a/create-gopher.sh b/create-gopher.sh
t@@ -0,0 +1,37 @@
+#!/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.
+basedir="/src"
+reposdir="/home/git"
+curdir="$(pwd)"
+
+# make index.
+stagit-gopher-index -b "$basedir" "${reposdir}/"*/ > "${curdir}/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 "${curdir}/${d}"
+ cd "${curdir}/${d}" || continue
+ stagit-gopher -b "${basedir}/${d}" -c ".cache" "${reposdir}/${r}"
+
+ # symlinks
+ ln -sf log.gph index.gph
+
+ echo "done"
+done
diff --git a/create.sh b/create.sh
t@@ -41,8 +41,7 @@ for dir in "${reposdir}/"*/; do
ln -sf ../logo.png logo.png
ln -sf ../favicon.png favicon.png
- printf "Disallow: /%s/file/\nDisallow: /%s/commit/\n" \
- "$r" "$r" >> "${curdir}/robots.txt"
+ echo "Disallow: /${r}/file/\nDisallow: /${r}/commit/\n" >> "${…
echo "done"
done
diff --git a/post-receive.sh b/post-receive.sh
t@@ -22,8 +22,11 @@ fi
reposdir="/home/git"
dir="${reposdir}/${name}"
htmldir="/var/www/domains/src.adamsgaard.dk"
+gopherdir="/var/gopher"
stagitdir="/"
destdir="${htmldir}${stagitdir}"
+gopherstagitdir="/src"
+gopherdestdir="${gopherdir}${gopherstagitdir}"
cachefile=".htmlcache"
# /config
t@@ -49,6 +52,8 @@ done
# strip .git suffix.
r=$(basename "${name}")
d=$(basename "${name}" ".git")
+
+## HTML
printf "[%s] stagit HTML pages... " "${d}"
mkdir -p "${destdir}/${d}"
t@@ -77,3 +82,25 @@ ln -sf ../style.css style.css
ln -sf ../logo.png logo.png
echo "done"
+
+## GPH
+printf "[%s] stagit gopher pages... " "${d}"
+
+mkdir -p "${gopherdestdir}/${d}"
+cd "${gopherdestdir}/${d}" || exit 1
+
+# remove commits and ${cachefile} on git push -f, this recreated later on.
+if test "${force}" = "1"; then
+ rm -f "${cachefile}"
+ rm -rf "commit"
+fi
+
+# make index.
+stagit-gopher-index -b "${gopherstagitdir}" "${reposdir}/"*/ > "${destdir}/ind…
+
+# make pages.
+stagit-gopher -b "${gopherstagitdir}/${d}" -c "${cachefile}" "${reposdir}/${r}"
+
+ln -sf log.gph index.gph
+
+echo "done"
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.