summary refs log tree commit diff
path: root/www/they.causal.agency/post-update.sh
diff options
context:
space:
mode:
Diffstat (limited to 'www/they.causal.agency/post-update.sh')
-rw-r--r--www/they.causal.agency/post-update.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/www/they.causal.agency/post-update.sh b/www/they.causal.agency/post-update.sh
new file mode 100644
index 00000000..2c0e6f54
--- /dev/null
+++ b/www/they.causal.agency/post-update.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -eu
+
+do_tree() {
+	tree=$1
+	manpath=$2
+	echo "Copying manuals for ${tree}..."
+	git ls-tree $tree | while read -r mode type hash name; do
+		if [ $type != blob ]; then
+			continue
+		fi
+		case "$name" in
+			(README.7)
+				continue
+				;;
+			(*.[1-9])
+				section=${name##*.}
+				mkdir -p /var/www/man/${manpath}/man${section}
+				git cat-file $type $hash \
+					>/var/www/man/${manpath}/man${section}/${name}
+		esac
+	done
+	if test -d /var/www/man/${manpath}; then
+		makewhatis /var/www/man/${manpath}
+		if ! fgrep -q ${manpath} /var/www/man/manpath.conf; then
+			echo $manpath >>/var/www/man/manpath.conf
+		fi
+	fi
+}
+
+do_tree HEAD HEAD
+
+repo=${PWD##*/}
+for tag in $(git tag); do
+	manpath=${repo%.git}-${tag}
+	if ! test -d /var/www/man/${manpath}; then
+		do_tree $tag $manpath
+	fi
+done