Use custom templates for Git repositories
[aur.git] / scripts / git-integration / gen-templates.py
blobe451b53eaf8aea93bf2265fa8f5b69ca05c71b47
1 #!/usr/bin/python3
3 import configparser
4 import os
5 import shutil
6 import sys
8 config = configparser.RawConfigParser()
9 config.read(os.path.dirname(os.path.realpath(__file__)) + "/../../conf/config")
11 template_path = config.get('serve', 'template-path')
12 git_update_hook = config.get('serve', 'git-update-hook')
14 def die(msg):
15 sys.stderr.write("%s\n" % (msg))
16 exit(1)
18 if os.path.exists(template_path):
19 shutil.rmtree(template_path)
21 os.mkdir(template_path)
22 os.chdir(template_path)
23 os.mkdir("branches")
24 os.mkdir("hooks")
25 os.mkdir("info")
26 os.symlink(git_update_hook, template_path + 'hooks/update')
28 with open("description", 'w') as f:
29 f.write("Unnamed repository; push to update the description.\n")