From 1c4d4e1e0474b6ffd3b8e0213d8a4804a3597e34 Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 13 Mar 2006 19:53:13 +0000 Subject: [PATCH] improved setup file more --- doc/ikiwiki.setup | 42 ++++++++++++++++++------------------------ doc/setup.mdwn | 13 +++++++------ ikiwiki | 17 +++++++++++------ 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup index 9592d36f5..e8048c3b0 100644 --- a/doc/ikiwiki.setup +++ b/doc/ikiwiki.setup @@ -1,12 +1,11 @@ #!/usr/bin/perl # Configuration file for ikiwiki. -# Passing this to ikiwiki --setup will make ikiwiki generate tw +# Passing this to ikiwiki --setup will make ikiwiki generate two # wrapper programs, one for cgi and one for a subversion post-commit hook. # # Remember to re-run ikiwiki --setup any time you edit this file. -%config=(%config, - +%setup=( wikiname => "MyWiki", # Be sure to customise these.. @@ -22,26 +21,21 @@ svn => 1, svnrepo => "/svn/wiki", - # Whether to enable a cgi wrapper. - cgiwrapper => 0, - # Can anonymous web users edit pages? - #anonok => 1, - -); - -gen_wrapper(%config, + # The svn wrapper. + svnwrapper => { + # Note that this will overwrite any exsting post-commit hoo + # script, which may not be what you want. + wrapper => "$config{svnrepo}/hooks/post-commit", + wrappermode => 04755, + }, - cgi => 1, - wrapper => "$config{destdir}/ikiwiki.cgi", - wrappermode => 06755, - -) if $config{cgiwrapper}; - -gen_wrapper(%config, - - # Note that this will overwrite any exsting post-commit hoo - # script, which may not be what you want. - wrapper => "$config{svnrepo}/hooks/post-commit", - wrappermode => 04755, + # The cgi wrapper. + #cgiwrapper => { + # cgi => 1, + # wrapper => "/var/www/wiki/ikiwiki.cgi", + # wrappermode => 06755, + #}, -) if $config{svn}; + # Can anonymous web users edit pages? + #anonok => 1, +); diff --git a/doc/setup.mdwn b/doc/setup.mdwn index cc830c0b9..d72cac71a 100644 --- a/doc/setup.mdwn +++ b/doc/setup.mdwn @@ -54,16 +54,17 @@ optional support for commits from the web. directories, and read through and configure the rest of the file to your liking. - Note that the default file will enable a [[post-commit]] hook to - update the wiki, but has cgi support turned off. + Note that the default file has a block to configure a svnwraper. This + sets up a [[post-commit]] hook to update the wiki. - When you're satisfied, run `ikiwiki --setup ikiwiki.setup`, and it will - generate the subversion [[post-commit]] hook and update your wiki. + When you're satisfied, run `ikiwiki --setup ikiwiki.setup`, and it + will set everything up and update your wiki. 8. Set up [[CGI]] to allow editing the wiki from the web. - Just edit ikiwiki.setup, change cgiwrapper to 1, and optioanlly anonok - to 1, run `ikiwiki --setup ikiwiki.setup`, and you're done! + Just edit ikiwiki.setup, uncomment the block for the cgiwrapper, make + sure the filename for the cgi wrapper is ok, run + `ikiwiki --setup ikiwiki.setup`, and you're done! 9. Add [[PageHistory]] links to the top of pages. This requires you to have setup [[ViewCVS]] or something similar to access your [[Subversion]] diff --git a/ikiwiki b/ikiwiki index ea3833a37..add627739 100755 --- a/ikiwiki +++ b/ikiwiki @@ -1158,15 +1158,20 @@ sub setup () { # {{{ my $code=; ($code)=$code=~/(.*)/s; close IN; + + my (%setup); eval $code; error($@) if $@; - print "$config{wikiname} setup complete, now forcing a rebuild.\n"; - $config{cgi}=0; - $config{rebuild}=1; - foreach my $c (keys %config) { - $config{$c}=possibly_foolish_untaint($config{$c}) - if defined $config{$c}; + + gen_wrapper(%config, %setup, %{$setup{cgiwrapper}}) if $setup{cgiwrapper}; + gen_wrapper(%config, %setup, %{$setup{svnwrapper}}) if $setup{svnwrapper}; + + print "$setup{wikiname} setup complete, now forcing a rebuild\n"; + foreach my $c (keys %setup) { + $config{$c}=possibly_foolish_untaint($setup{$c}) + if defined $setup{$c} && ! ref $setup{$c}; } + $config{rebuild}=1; refresh(); saveindex(); exit; -- 2.44.0