stagit

my fork of stagit that runs this site
git clone git://git.jakekoroman.com/stagit
Log | Files | Refs | README | LICENSE

example_create.sh (1461B)


      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="/home/git/git/todisplay/"
     20 curdir="$(pwd)"
     21 
     22 stagit_files="style.css logo.png favicon.png"
     23 
     24 for file in ${stagit_files}; do
     25 	if test ! -e file; then
     26 		cp /home/git/opt/stagit/$file $curdir
     27 	fi
     28 done
     29 
     30 # make index.
     31 stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
     32 
     33 # make files per repo.
     34 for dir in "${reposdir}/"*/; do
     35 	# strip .git suffix.
     36 	r=$(basename "${dir}")
     37 	d=$(basename "${dir}" ".git")
     38 	printf "%s... " "${d}"
     39 
     40 	mkdir -p "${curdir}/${d}"
     41 	cd "${curdir}/${d}" || continue
     42 	stagit -c ".cache" -u "https://git.jakekoroman.com/$d/" "${reposdir}/${r}"
     43 	cat "/home/git/opt/stagit/example_post-receive.sh" | sed "s/{REPO_DIR}/$d/g" > "${reposdir}${r}/hooks/post-receive" && chmod +x "${reposdir}${r}/hooks/post-receive"
     44 
     45 	# symlinks
     46 	ln -sf log.html index.html
     47 	ln -sf ../style.css style.css
     48 	ln -sf ../logo.png logo.png
     49 	ln -sf ../favicon.png favicon.png
     50 
     51 	echo "done"
     52 done