stagit

[fork] HTML git frontend
Log | Files | Refs | README | LICENSE

example_create.sh (1160B)


      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.
     19 reposdir="/var/www/domains/git.codemadness.nl/home/src"
     20 curdir="$(pwd)"
     21 
     22 # make index.
     23 stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
     24 
     25 # make files per repo.
     26 for 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.codemadness.nl/$d/" "${reposdir}/${r}"
     35 
     36 	# symlinks
     37 	ln -sf log.html index.html
     38 	ln -sf ../style.css style.css
     39 	ln -sf ../logo.png logo.png
     40 	ln -sf ../favicon.png favicon.png
     41 
     42 	echo "done"
     43 done