| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Git maintenance script, run by cron. |
| 4 | |
| 5 | # Update symlinks to user git repo locations. |
| 6 | find /afs/hcoop.net/user -mindepth 3 -maxdepth 3 -noleaf -exec \ |
| 7 | sh -c "test -e {}/.hcoop-git && \ |
| 8 | ln -s {}/.hcoop-git/ /var/cache/git/\$(basename {}) 2>/dev/null" \; |
| 9 | |
| 10 | # Remove symlinks for users that have wrong permissions |
| 11 | find /afs/hcoop.net/user -mindepth 3 -maxdepth 3 -noleaf -exec \ |
| 12 | sh -c "test ! -e {}/.hcoop-git || \ |
| 13 | ! { fs la {}/.hcoop-git | \ |
| 14 | egrep '^ +system:anyuser .*r' > /dev/null; } && \ |
| 15 | rm -f /var/cache/git/\$(basename {}) 2>/dev/null" \; |
| 16 | |
| 17 | # Update cache of front page. |
| 18 | cache=/var/local/lib/gitweb/indexcache.html |
| 19 | wget -q -O $cache.tmp 'http://git.hcoop.net/?nocache=y' |
| 20 | if test -s $cache.tmp; then |
| 21 | chmod a+r $cache.tmp |
| 22 | mv $cache.tmp $cache |
| 23 | else |
| 24 | rm -f $cache.tmp |
| 25 | fi |