From 1991cb46128f2a0c5e5207bb07c5bb2d4feead95 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Mon, 18 Nov 2013 17:53:40 -0800 Subject: [PATCH] genindex.sh: make gitweb.list group writable The gitweb.list file may be generated either via the web interface or by maintenance activity of the mirror_user. If an owning_group value has been configured, make sure the created gitweb.list file is owned by that group and is group writable so that both the web interface and mirror_user encounter no difficulty updating a file written by the other. --- gitweb/genindex.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gitweb/genindex.sh b/gitweb/genindex.sh index cfb13fb..76371db 100755 --- a/gitweb/genindex.sh +++ b/gitweb/genindex.sh @@ -6,6 +6,11 @@ set -e +# Use the correct umask so the list file is group-writable, if owning_group set +if [ -n "$cfg_owning_group" ]; then + umask 002 +fi + # gitweb calls CGI::Util::unescape on both the path and owner, but the only # character we allow that needs to be escaped is '+' which is allowed in # both the owner email and in the project name. Otherwise '+' will be @@ -14,4 +19,11 @@ set -e get_repo_list | while read proj; do echo "$proj.git $(cd "$cfg_reporoot/$proj.git" && config_get owner)" done | sed -e 's/+/%2B/g' >/tmp/gitweb.list.$$ + +# Set the proper group, if configured, before the move +if [ -n "$cfg_owning_group" ]; then + chgrp "$cfg_owning_group" /tmp/gitweb.list.$$ +fi + +# Atomically move into place mv -f /tmp/gitweb.list.$$ "$cfg_chroot/etc/gitweb.list" -- 2.11.4.GIT