shlib.sh: Add new bang_eval function
[girocco.git] / gitweb / genindex.sh
blob76371db7913ea2c15bc7a9189e00e2e7573596cf
1 #!/bin/bash
3 # genindex - Generate gitweb project list from Girocco's
5 . @basedir@/shlib.sh
7 set -e
9 # Use the correct umask so the list file is group-writable, if owning_group set
10 if [ -n "$cfg_owning_group" ]; then
11 umask 002
14 # gitweb calls CGI::Util::unescape on both the path and owner, but the only
15 # character we allow that needs to be escaped is '+' which is allowed in
16 # both the owner email and in the project name. Otherwise '+' will be
17 # displayed as a ' ' in the owner email and will cause a project name
18 # containing it to be omitted from the project list page.
19 get_repo_list | while read proj; do
20 echo "$proj.git $(cd "$cfg_reporoot/$proj.git" && config_get owner)"
21 done | sed -e 's/+/%2B/g' >/tmp/gitweb.list.$$
23 # Set the proper group, if configured, before the move
24 if [ -n "$cfg_owning_group" ]; then
25 chgrp "$cfg_owning_group" /tmp/gitweb.list.$$
28 # Atomically move into place
29 mv -f /tmp/gitweb.list.$$ "$cfg_chroot/etc/gitweb.list"