summaryrefslogtreecommitdiff
path: root/localikiwikicreatesite
diff options
context:
space:
mode:
authorroot <root@mail.bitbase.dk>2008-11-03 22:41:47 +0100
committerroot <root@mail.bitbase.dk>2008-11-03 22:41:47 +0100
commit1307225b8245032b69a9475ff7f6da3eea038946 (patch)
treee897dd810ea6c212f0e51dcb678bce001c56e8e2 /localikiwikicreatesite
parent4bded288860ac055c0aa6350a7382d854ef01959 (diff)
Fix adjusting non-default configs..
Diffstat (limited to 'localikiwikicreatesite')
-rwxr-xr-xlocalikiwikicreatesite38
1 files changed, 22 insertions, 16 deletions
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