example_create.sh (1373B)
1 #!/bin/sh 2 3 # This script is ment to initialize your stagit website 4 5 # - Makes index for repositories in a single directory. 6 # - Makes static pages for each repository directory. 7 # 8 # NOTE, things to do manually (once) before running this script: 9 # - copy style.css, logo.png and favicon.png manually, a style.css example 10 # is included. 11 # 12 # - write clone URL, for example "git://git.codemadness.org/dir" to the "url" 13 # file for each repo. 14 # - write owner of repo to the "owner" file. 15 # - write description in "description" file. 16 # 17 # How to use 18 # - mkdir -p htmldir && cd htmldir 19 # - sh example_create.sh 20 21 # path must be absolute. 22 23 # Repodir is where your git repos are located 24 reposdir="/srv/git" 25 26 #curdir is the current directory but I suggest switching it to your website directory 27 # Current 28 #curdir="$(pwd)" 29 30 # Absolute 31 curdir="/var/www/git/htmldir" 32 33 # make index. 34 stagit-index "${reposdir}/"*/ > "${curdir}/index.html" 35 36 # make files per repo. 37 for dir in "${reposdir}/"*/; do 38 # strip .git suffix. 39 r=$(basename "${dir}") 40 d=$(basename "${dir}" ".git") 41 printf "%s... " "${d}" 42 43 mkdir -p "${curdir}/${d}" 44 cd "${curdir}/${d}" || continue 45 stagit -c ".cache" -u "https://git.codemadness.nl/$d/" "${reposdir}/${r}" 46 47 # symlinks 48 ln -sf log.html index.html 49 ln -sf ../style.css style.css 50 ln -sf ../logo.png logo.png 51 ln -sf ../favicon.png favicon.png 52 53 echo "done" 54 done