3 # genindex - Generate gitweb project list from Girocco's
5 # Usage: genindex.sh [project-to-update]
7 # If project-to-update is given, then only that one will be updated
15 # Use the correct umask so the list file is group-writable, if owning_group set
16 if [ -n "$cfg_owning_group" ]; then
20 # gitweb calls CGI::Util::unescape on both the path and owner, but the only
21 # character we allow that needs to be escaped is '+' which is allowed in
22 # both the owner email and in the project name. Otherwise '+' will be
23 # displayed as a ' ' in the owner email and will cause a project name
24 # containing it to be omitted from the project list page.
26 if [ -z "$update" ] ||
[ ! -s "$cfg_chroot/etc/gitproj.list" ]; then
27 # Must read all the owners so don't bother with join at all
28 get_repo_list |
while read proj
; do
29 echo "$proj $(cd "$cfg_reporoot/$proj.git
" && config_get owner)"
30 done | LC_ALL
=C
sort -k 1,1 >/tmp
/gitproj.list.$$
32 get_repo_list | LC_ALL
=C
sort -k 1,1 | \
33 LC_ALL
=C
join -a 1 - "$cfg_chroot/etc/gitproj.list" | \
34 while read proj owner
; do
35 if [ -z "$owner" -o "$proj" = "$update" ]; then
36 echo "$proj $(cd "$cfg_reporoot/$proj.git
" && config_get owner)"
40 done | LC_ALL
=C
sort -k 1,1 >/tmp
/gitproj.list.$$
42 sed -e 's/ /.git /;s/+/%2B/g' </tmp
/gitproj.list.$$
>/tmp
/gitweb.list.$$
44 # Set the proper group, if configured, before the move
45 if [ -n "$cfg_owning_group" ]; then
46 chgrp
"$cfg_owning_group" /tmp
/gitproj.list.$$
/tmp
/gitweb.list.$$
49 # Atomically move into place
50 mv -f /tmp
/gitproj.list.$$
"$cfg_chroot/etc/gitproj.list"
51 mv -f /tmp
/gitweb.list.$$
"$cfg_chroot/etc/gitweb.list"