2 $ENV{PATH}="/usr/local/bin:/usr/bin:/bin";
7 use lib '.'; # For use without installation, removed by Makefile.
11 die "usage: ikiwiki [options] source dest\n";
14 sub getconfig () { #{{{
15 if (! exists $ENV{WRAPPED_OPTIONS}) {
16 %config=defaultconfig();
17 eval q{use Getopt::Long};
19 "setup|s=s" => \$config{setup},
20 "wikiname=s" => \$config{wikiname},
21 "verbose|v!" => \$config{verbose},
22 "rebuild!" => \$config{rebuild},
23 "refresh!" => \$config{refresh},
24 "getctime" => \$config{getctime},
25 "wrappermode=i" => \$config{wrappermode},
26 "rcs=s" => \$config{rcs},
27 "no-rcs" => sub { $config{rcs}="" },
28 "anonok!" => \$config{anonok},
29 "rss!" => \$config{rss},
30 "cgi!" => \$config{cgi},
31 "discussion!" => \$config{discussion},
32 "w3mmode!" => \$config{w3mmode},
33 "notify!" => \$config{notify},
34 "url=s" => \$config{url},
35 "cgiurl=s" => \$config{cgiurl},
36 "historyurl=s" => \$config{historyurl},
37 "diffurl=s" => \$config{diffurl},
38 "svnrepo" => \$config{svnrepo},
39 "svnpath" => \$config{svnpath},
40 "adminemail=s" => \$config{adminemail},
41 "timeformat=s" => \$config{timeformat},
43 $config{wiki_file_prune_regexp}=qr/$config{wiki_file_prune_regexp}|$_[1]/;
45 "adminuser=s@" => sub {
46 push @{$config{adminuser}}, $_[1]
48 "templatedir=s" => sub {
49 $config{templatedir}=possibly_foolish_untaint($_[1])
51 "underlaydir=s" => sub {
52 $config{underlaydir}=possibly_foolish_untaint($_[1])
55 $config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
58 push @{$config{plugin}}, $_[1];
60 "disable-plugin=s@" => sub {
61 $config{plugin}=[grep { $_ ne $_[1] } @{$config{plugin}}];
64 push @{$config{pingurl}}, $_[1];
68 if (! $config{setup}) {
69 usage() unless @ARGV == 2;
70 $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
71 $config{destdir} = possibly_foolish_untaint(shift @ARGV);
76 # wrapper passes a full config structure in the environment
78 eval possibly_foolish_untaint($ENV{WRAPPED_OPTIONS});
80 error("WRAPPED_OPTIONS: $@");
95 elsif ($config{setup}) {
96 require IkiWiki::Setup;
99 elsif ($config{wrapper}) {
101 require IkiWiki::Wrapper;
107 require IkiWiki::Render;
110 rcs_notify() if $config{notify};