From 7671b51616a25fa6cff9c26fe65d5f703ff94e21 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Mon, 17 Oct 2022 17:44:06 -0400 Subject: Get wiki role to push updates to the right place in docker Ikiwiki has this three-repo setup with post-update hooks --- roles/wiki/templates/emacsconf.setup | 2 +- roles/wiki/templates/htmlscrubber.pm | 4 ++-- roles/wiki/templates/post-update | 20 ++++++++++++++++++++ roles/wiki/templates/post-update.h00-ikiwiki-wrapper | 6 ++++++ 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100755 roles/wiki/templates/post-update create mode 100755 roles/wiki/templates/post-update.h00-ikiwiki-wrapper (limited to 'roles/wiki/templates') diff --git a/roles/wiki/templates/emacsconf.setup b/roles/wiki/templates/emacsconf.setup index ea9c4c8..81b089b 100644 --- a/roles/wiki/templates/emacsconf.setup +++ b/roles/wiki/templates/emacsconf.setup @@ -30,7 +30,7 @@ url: {{ ikiwiki_url }} reverse_proxy: 0 # filename of cgi wrapper to generate #cgi_wrapper: /home/ikiwiki/public_html/emacsconf/ikiwiki.cgi -cgi_wrapper: {{ ikiwiki_path }}/ikiwiki.cgi +cgi_wrapper: {{ ikiwiki_cgi_wrapper }} # mode for cgi_wrapper (can safely be made suid) cgi_wrappermode: 06755 # number of seconds to delay CGI requests when overloaded diff --git a/roles/wiki/templates/htmlscrubber.pm b/roles/wiki/templates/htmlscrubber.pm index 1ce95b2..caf78a1 100755 --- a/roles/wiki/templates/htmlscrubber.pm +++ b/roles/wiki/templates/htmlscrubber.pm @@ -93,8 +93,8 @@ sub scrubber { }], default => [undef, { ( map { $_ => 1 } qw{ - version xmlns x y fill font-size font-weight stroke stroke-width stroke-dasharray transform - data-start data-end data-video data-target data-tracks data-track + version xmlns x y fill font-size font-weight stroke stroke-width stroke-dasharray transform opacity + data-start data-end data-video data-target data-tracks data-track kind label srclang default abbr accept accept-charset accesskey align alt axis border cellpadding cellspacing 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 -- cgit v1.2.3