Add chown of git repo directories

When creating git repositories, we want to recursively chown
them to the cgit user so the cgit user for replication can
write to them.

Change-Id: Ib349b4af32090d0fbda933d51ef514cae7033499
This commit is contained in:
Elizabeth Krumbach 2013-08-13 13:04:55 -07:00
parent ce650a4fe2
commit 95398b631c
1 changed files with 4 additions and 0 deletions

View File

@ -31,6 +31,8 @@ CGIT_REPOS = os.environ.get('CGIT_REPOS',
'/etc/cgitrepos')
REPO_PATH = os.environ.get('REPO_PATH',
'/var/lib/git')
CGIT_USER = os.environ.get('CGIT_USER', 'cgit')
CGIT_GROUP = os.environ.get('CGIT_GROUP', 'cgit')
def main():
@ -62,6 +64,8 @@ def main():
cgit_file.write('repo.desc=%s\n' % (description))
if not os.path.exists(project_repo):
subprocess.call(['git', 'init', '--bare', project_repo])
subprocess.call(['chown', '-R', '%s:%s'
% (CGIT_USER, CGIT_GROUP), project_repo])
if __name__ == "__main__":