example_create.sh - stagit-gopher - A git gopher frontend. (mirror)
HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
example_create.sh (1101B)
---
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 # - write clone URL, for example "git://git.codemadness.org/dir" to the "url"
7 # file for each repo.
8 # - write description in "description" file.
9 #
10 # Usage:
11 # - mkdir -p gphdir && cd gphdir
12 # - sh example_create.sh
13
14 # path must be absolute.
15 reposdir="/var/scm/git"
16 gopherdir="/var/gopher"
17 stagitdir="/scm"
18 destdir="${gopherdir}/${stagitdir}"
19
20 # remove /'s at the end.
21 stagitdir=$(printf "%s" "${stagitdir}" | sed 's@[/]*$@@g')
22
23 # make index.
24 stagit-gopher-index -b "${stagitdir}" "${reposdir}/"*/ > "${destdir}/index.gph"
25
26 # make files per repo.
27 for dir in "${reposdir}/"*/; do
28 # strip .git suffix.
29 r=$(basename "${dir}")
30 d=$(basename "${dir}" ".git")
31 printf "%s... " "${d}"
32
33 mkdir -p "${destdir}/${d}"
34 cd "${destdir}/${d}" || continue
35 stagit-gopher -b "${stagitdir}/${d}" -c ".cache" \
36 -u "gopher://codemadness.org/1/git/$d/" "${reposdir}/${r}"
37
38 # symlinks
39 ln -sf log.gph index.gph
40
41 echo "done"
42 done