aboutsummaryrefslogtreecommitdiffstats
path: root/roles/cgit/files/generate-static-git.sh
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-12-11 13:54:22 +0000
committerRomain Gonçalves <me@rgoncalves.se>2021-12-11 13:54:22 +0000
commite60e99796111ee6d43080b4e48971c08886c0570 (patch)
tree481e8fd119b3afdd0e2a2730ce1f41d623577e9e /roles/cgit/files/generate-static-git.sh
parent48208c520bb15d16b0eab623b97fa5e86c6f665c (diff)
downloadrules-e60e99796111ee6d43080b4e48971c08886c0570.tar.gz
roles: Add git and cgit roles
Diffstat (limited to 'roles/cgit/files/generate-static-git.sh')
-rw-r--r--roles/cgit/files/generate-static-git.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/roles/cgit/files/generate-static-git.sh b/roles/cgit/files/generate-static-git.sh
new file mode 100644
index 0000000..dd0db32
--- /dev/null
+++ b/roles/cgit/files/generate-static-git.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+GIT_DIR="/data/git"
+
+repositories=""
+repo=""
+
+for repo in "${GIT_DIR}"/*; do
+
+ if [ ! -f "${repo}/git-daemon-export-ok" ]; then
+ echo " [ERR] $(basename ${repo})"
+ continue
+ fi
+
+ repo=$(basename "${repo}")
+ repositories="${repositories} ${GIT_DIR}/${repo}"
+
+ echo " [OK ] ${repo}"
+ mkdir "${repo}" 2>/dev/null
+ (cd "${repo}" && /usr/local/bin/stagit "${GIT_DIR}/${repo}")
+done
+
+if [ -z "$repositories" ]; then
+ exit 1
+fi
+
+echo " [#] ${repositories}"
+/usr/local/bin/stagit-index ${repositories} > index.html
remember that computers suck.