stagit-gopher

static git page generator for gopher (mirror)
git clone git://git.2f30.org/stagit-gopher.git
Log | Files | Refs | README | LICENSE

example_create.sh (1057B)


      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" "${reposdir}/${r}"
     36 
     37 	# symlinks
     38 	ln -sf log.gph index.gph
     39 
     40 	echo "done"
     41 done