From 55261777287c696f31f0aa3ea3db877266c42a9d Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Sun, 12 Sep 2021 18:00:13 -0500 Subject: Add repos.cgi --- repos.cgi | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 repos.cgi (limited to 'repos.cgi') diff --git a/repos.cgi b/repos.cgi new file mode 100755 index 0000000..5b67464 --- /dev/null +++ b/repos.cgi @@ -0,0 +1,22 @@ +#!/usr/bin/python3 + +import os + +print("Content-type:text/plain\r\n\r\n", end="") + +# `ls -d /srv/git/*` +config_filename = os.environ["GITWEB_CONFIG"] +project_root = None +remote_prefix = None + +with open(config_filename) as f: + for line in f.readlines(): + if line.startswith("$projectroot"): + project_root = line.split('"')[1] + elif line.startswith("$remote_prefix"): + remote_prefix = line.split('"')[1] + +if project_root is not None or remote_prefix is not None: + for file in os.scandir(project_root): + desc=open(f"{file.path}/description").read() + print(f"{file.name},{remote_prefix}{file.path},{desc}".strip()) -- cgit v1.2.3