7 [ "$unique" = true ] && unique="$arg"
8 [ "$arg" = "--only" ] && unique=true
9 [ "$arg" = "--fresh" ] && fresh=true
12 [ "$unique" = true ] && {
13 echo "Expected argument after \`--only\`.";
17 STAGIT=/var/www/git/stagit.out
18 [ ! -f "$STAGIT" ] && STAGIT=stagit
20 STAGIT_INDEX=/var/www/git/stagit-index.out
21 [ ! -f "$STAGIT_INDEX" ] && STAGIT_INDEX=stagit-index
25 repo="$(basename "$repo" | sed 's/\.git$//g')"
27 [ "$fresh" = true ] && {
28 echo "Deleting HTML for $repo.";
29 rm -fr "/var/www/git/$repo";
31 mkdir -p "/var/www/git/$repo"
32 cd "/var/www/git/$repo" || { echo "Couldn't cd."; exit 1; }
34 [ ! -f style.css ] && ln -s ../style.css ./
35 [ ! -f favicon.png ] && ln -s ../favicon.png ./
36 [ ! -f logo.png ] && ln -s ../logo.png ./
37 [ ! -f highlight ] && ln -s ../highlight ./
39 echo "git://git.knutsen.co/$repo" > "/srv/git/$repo.git/url"
41 COMMAND="$STAGIT /srv/git/$repo.git"
42 echo "Building web-page for $repo."
47 if [ "$unique" = false ]; then
48 for repo in /srv/git/*.git; do
55 echo "Generating index.html with \`$STAGIT_INDEX\`."
56 "$STAGIT_INDEX" /srv/git/*.git > /var/www/git/index.html
58 # Correct ownership of the web files.
59 chown git:www-data -R /var/www/git -f
60 chmod g+rw -R /var/www/git -f