Commit | Line | Data |
---|---|---|
f4189f51 | 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 \ | |
294904cc | 7 | sh -c "test -e {}/.hcoop-git && { \ |
8 | rm -f /var/cache/git/\$(basename {}); \ | |
6671a96c | 9 | ln -sf {}/.hcoop-git /var/cache/git/\$(basename {}); }" \; \ |
10 | > /dev/null 2>&1 | |
f4189f51 | 11 | |
3b680833 | 12 | # Remove symlinks for users that have wrong permissions |
294904cc | 13 | IFS=$'\n' |
14 | for user in $(ls -1 /var/cache/git); do | |
15 | if ! test -e $(readlink /var/cache/git/$user); then | |
16 | rm -f /var/cache/git/$user | |
17 | continue | |
18 | fi | |
19 | gitpath=$(readlink /var/cache/git/$user) | |
20 | find -L $gitpath -noleaf -type d \ | |
50dd6258 | 21 | -regex '.*/\(refs\|objects\|hooks\)\(/.*\|$\)' -prune -o -exec \ |
294904cc | 22 | sh -c "! { fs la {} | \ |
23 | egrep '^ +system:anyuser .*r' > /dev/null; } && \ | |
0547d712 | 24 | rm -f /var/cache/git/$user 2>/dev/null" \; \ |
6671a96c | 25 | > /dev/null 2>&1 |
294904cc | 26 | done |
3b680833 | 27 | |
f4189f51 | 28 | # Update cache of front page. |
0547d712 CE |
29 | # unused for a long while... |
30 | # cache=/var/local/lib/gitweb/indexcache.html | |
31 | # wget -q --timeout 30 -O $cache.tmp 'http://git.hcoop.net/?nocache=y' | |
32 | # if test -s $cache.tmp; then | |
33 | # chmod a+r $cache.tmp | |
34 | # mv $cache.tmp $cache | |
35 | # else | |
36 | # rm -f $cache.tmp | |
37 | # fi |