From 1307225b8245032b69a9475ff7f6da3eea038946 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 3 Nov 2008 22:41:47 +0100 Subject: Fix adjusting non-default configs.. --- localikiwikicreatesite | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'localikiwikicreatesite') diff --git a/localikiwikicreatesite b/localikiwikicreatesite index 54a212f..5fe16aa 100755 --- a/localikiwikicreatesite +++ b/localikiwikicreatesite @@ -285,6 +285,7 @@ git_init_work "${project}_content" "$SRCDIR" "/.ikiwiki" fi ## Adjust backend to actual paths, and enable Git post-update wrapper +git_setenv_work "$CFGDIR" # TODO: Rewrite as semi-generic functions: #perl_param_enable_set "$CFGDIR/ikiwiki.setup" "srcdir" "$SRCDIR" #perl_param_enable_set "$CFGDIR/ikiwiki.setup" "destdir" "$DESTDIR" @@ -294,23 +295,28 @@ fi #perl_section_match_enable_param_set "$CFGDIR/ikiwiki.setup" "git post-update wrapper" "wrapper" "$DESTSRCDIR/${project}_content.git/hooks/post-update-$project" #perl_section_match_enable_param_match_enable "$CFGDIR/ikiwiki.setup" "git post-update wrapper" "wrappermode" "06755" #shell_line_match_enable_appendlinebefore "$DESTSRCDIR/${project}_content.git/hooks/post-update" "^exec" "hooks/post-update-$project\n" -perl -pi -e ' - s,^(\s*)#?(srcdir\s*=>\s*")[^"]*("\,\s*),$1$2'$SRCDIR'$3,; - s,^(\s*)#?(destdir\s*=>\s*")[^"]*("\,\s*),$1$2'$DESTDIR'$3,; - s,^(\s*)#?(url\s*=>\s*")[^"]*("\,\s*),$1$2http://'$host'$3,; - s,^(\s*)#?(cgiurl\s*=>\s*")([^"]*)("\,\s*),$1#$2$3$4,; - s,^(\s*)#?(rcs\s*=>\s*")(git)("\,\s*),$1$2$3$4,; - ' $CFGDIR/ikiwiki.setup -perl -0 -pi -e ' - s,#{([\s#]*The git post-update wrapper[^}]*\s*)#(\s*wrapper =>\s*")[^"]*("\,\s*[^}]*)#(\s*wrappermode =>[^}]*)#},{$1$2'$DESTSRCDIR/${project}_content.git/hooks/post-update-$project'$3$4},; - ' $CFGDIR/ikiwiki.setup -perl -0 -pi -e ' - s,\n(exec\s[^\n]*),\nhooks/post-update-'"$project"'\n\n$1,; - ' $DESTSRCDIR/${project}_content.git/hooks/post-update -git_setenv_work "$CFGDIR" -git add ikiwiki.setup -git commit -m "Adjust ikiwiki.setup to use actual paths, and add+enable Git post-update hooks" +for cfgfile in $CFGDIR/ikiwiki*.setup; do + perl -pi -e ' + s,^(\s*)#?(srcdir\s*=>\s*")[^"]*("\,\s*),$1$2'$SRCDIR'$3,; + s,^(\s*)#?(destdir\s*=>\s*")[^"]*("\,\s*),$1$2'$DESTDIR'$3,; + s,^(\s*)#?(url\s*=>\s*")[^"]*("\,\s*),$1$2http://'$host'$3,; + s,^(\s*)#?(cgiurl\s*=>\s*")([^"]*)("\,\s*),$1#$2$3$4,; + s,^(\s*)#?(rcs\s*=>\s*")(git)("\,\s*),$1$2$3$4,; + ' "$cfgfile" + perl -0 -pi -e ' + s,#{([\s#]*The git post-update wrapper[^}]*\s*)#(\s*wrapper =>\s*")[^"]*("\,\s*[^}]*)#(\s*wrappermode =>[^}]*)#},{$1$2'$DESTSRCDIR/${project}_content.git/hooks/post-update-$project'$3$4},; + ' "$cfgfile" + git add "$(basename "$cfgfile")" +done +git commit -m "Adjust config files to use actual paths, and enable Git hooks." git_unsetenv +# Attach hooks to general post-update hook +# FIXME: Attach localized before master configs, and admin before non-admin +for hookfile in $DESTSRCDIR/${project}_content.git/hooks/post-update-*; do + perl -0 -pi -e ' + s,\n(exec\s[^\n]*),\nhooks/'"$(basename "$hookfile")"'\n\n$1,; + ' $DESTSRCDIR/${project}_content.git/hooks/post-update +done ## Add Makefile for further customization if ! [ -e $CFGDIR/Makefile ]; then -- cgit v1.2.3