]> git.armaanb.net Git - stagit.git/blob - repo-gen.sh
Properly cut .git out of name.
[stagit.git] / repo-gen.sh
1 #!/bin/sh
2
3 fresh=false
4
5 for arg in "$@"; do
6         [ "$arg" = "--fresh" ] && fresh=true
7 done
8
9 STAGIT=/var/www/git/stagit.out
10 [ ! -f "$STAGIT" ] && STAGIT=stagit
11
12 STAGIT_INDEX=/var/www/git/stagit-index.out
13 [ ! -f "$STAGIT_INDEX" ] && STAGIT_INDEX=stagit-index
14
15 for repo in /srv/git/*.git; do
16         repo="$(basename "$repo" | rev | cut -c 5- | rev)"
17
18         [ "$fresh" = true ] \
19                 && echo "Deleting HTML for $repo." \
20                 && rm -fr "/var/www/git/$repo"
21         mkdir -p "/var/www/git/$repo"
22         cd "/var/www/git/$repo"
23
24         [ ! -f style.css ]   && ln -s ../style.css ./
25         [ ! -f favicon.png ] && ln -s ../favicon.png ./
26         [ ! -f logo.png ]    && ln -s ../logo.png ./
27
28         echo "git://git.knutsen.co/$repo" > "/srv/git/$repo.git/url"
29
30         COMMAND="$STAGIT /srv/git/$repo.git"
31         echo "$COMMAND"
32         $COMMAND
33 done
34
35 echo "Generating index.html with \`$STAGIT_INDEX\`."
36 "$STAGIT_INDEX" /srv/git/*.git > /var/www/git/index.html