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
diff --git a/jeepyb/cmd/create_cgitrepos.py b/jeepyb/cmd/create_cgitrepos.py
index 8acbfd6..3fc4f19 100644
--- a/jeepyb/cmd/create_cgitrepos.py
+++ b/jeepyb/cmd/create_cgitrepos.py
@@ -31,6 +31,8 @@
'/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 @@
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__":