stagit

example_create.sh

1.1 kB
 1#!/bin/sh
 2# - Makes index for repositories in a single directory.
 3# - Makes static pages for each repository directory.
 4#
 5# NOTE, things to do manually (once) before running this script:
 6# - copy style.css, logo.png and favicon.png manually, a style.css example
 7#   is included.
 8#
 9# - write clone URL, for example "git://git.codemadness.org/dir" to the "url"
10#   file for each repo.
11# - write owner of repo to the "owner" file.
12# - write description in "description" file.
13#
14# Usage:
15# - mkdir -p htmldir && cd htmldir
16# - sh example_create.sh
17
18# path must be absolute.
19reposdir="/var/www/git/"
20curdir="$(pwd)"
21
22# make index.
23stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
24
25# make files per repo.
26for dir in "${reposdir}/"*/; do
27	# strip .git suffix.
28	r=$(basename "${dir}")
29	d=$(basename "${dir}" ".git")
30	printf "%s... " "${d}"
31
32	mkdir -p "${curdir}/${d}"
33	cd "${curdir}/${d}" || continue
34	stagit -c ".cache" -u "https://git.arjun.lol/$d/" "${reposdir}/${r}"
35
36	# symlinks
37	ln -sf log.html index.html
38	ln -sf ../style.css style.css
39	ln -sf ../me.webp me.webp
40	ln -sf ../favicon.png favicon.png
41	ln -sf ../style.css
42
43	echo "done"
44done