create-gopher.sh (914B)
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 basedir="/src" 16 reposdir="/home/git" 17 curdir="$(pwd)" 18 19 # make index. 20 stagit-gopher-index -b "$basedir" "${reposdir}/"*/ > "${curdir}/index.gph" 21 22 # make files per repo. 23 for dir in "${reposdir}/"*/; do 24 # strip .git suffix. 25 r=$(basename "${dir}") 26 d=$(basename "${dir}" ".git") 27 printf "%s... " "${d}" 28 29 mkdir -p "${curdir}/${d}" 30 cd "${curdir}/${d}" || continue 31 stagit-gopher -b "${basedir}/${d}" -c ".cache" "${reposdir}/${r}" 32 33 # symlinks 34 ln -sf log.gph index.gph 35 36 echo "done" 37 done