summaryrefslogtreecommitdiffstats
path: root/roles/wiki/templates/post-update
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-17 17:44:06 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-17 17:44:06 -0400
commit7671b51616a25fa6cff9c26fe65d5f703ff94e21 (patch)
treeb85c0e39c1ca65cbf2d9fb4d0e534acd6861083b /roles/wiki/templates/post-update
parent656e440054f43fc09050ba13e29d4eaaf355fcf5 (diff)
downloademacsconf-ansible-7671b51616a25fa6cff9c26fe65d5f703ff94e21.tar.xz
emacsconf-ansible-7671b51616a25fa6cff9c26fe65d5f703ff94e21.zip
Get wiki role to push updates to the right place in docker
Ikiwiki has this three-repo setup with post-update hooks
Diffstat (limited to '')
-rwxr-xr-xroles/wiki/templates/post-update20
-rwxr-xr-xroles/wiki/templates/post-update.h00-ikiwiki-wrapper6
2 files changed, 26 insertions, 0 deletions
diff --git a/roles/wiki/templates/post-update b/roles/wiki/templates/post-update
new file mode 100755
index 0000000..523b8de
--- /dev/null
+++ b/roles/wiki/templates/post-update
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Determine what input the hook needs
+# post-update takes args, pre/post-receive take stdin
+type=args
+stdin=''
+[ $0 != hooks/post-update ] && {
+ type=stdin
+ stdin=`cat`
+}
+
+for h in $0.*; do
+ [ -x $h ] || continue
+ if [ $type = args ]
+ then
+ $h $@ || { [ $0 = hooks/pre-receive ] && exit 1; }
+ else
+ echo "$stdin" | $h || { [ $0 = hooks/pre-receive ] && exit 1; }
+ fi
+done
diff --git a/roles/wiki/templates/post-update.h00-ikiwiki-wrapper b/roles/wiki/templates/post-update.h00-ikiwiki-wrapper
new file mode 100755
index 0000000..684ac28
--- /dev/null
+++ b/roles/wiki/templates/post-update.h00-ikiwiki-wrapper
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# bring the mirror up to date with this repo
+cd "{{ ikiwiki_src_dir }}"
+git fetch --prune
+exec {{ ikiwiki_path }}/hooks/emacsconf