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};
18 Getopt::Long::Configure('pass_through');
20 "setup|s=s" => \$config{setup},
21 "wikiname=s" => \$config{wikiname},
22 "verbose|v!" => \$config{verbose},
23 "rebuild!" => \$config{rebuild},
24 "refresh!" => \$config{refresh},
25 "getctime" => \$config{getctime},
26 "wrappermode=i" => \$config{wrappermode},
27 "rcs=s" => \$config{rcs},
28 "no-rcs" => sub { $config{rcs}="" },
29 "anonok!" => \$config{anonok},
30 "rss!" => \$config{rss},
31 "cgi!" => \$config{cgi},
32 "discussion!" => \$config{discussion},
33 "w3mmode!" => \$config{w3mmode},
34 "notify!" => \$config{notify},
35 "url=s" => \$config{url},
36 "cgiurl=s" => \$config{cgiurl},
37 "historyurl=s" => \$config{historyurl},
38 "diffurl=s" => \$config{diffurl},
39 "svnrepo" => \$config{svnrepo},
40 "svnpath" => \$config{svnpath},
41 "adminemail=s" => \$config{adminemail},
42 "timeformat=s" => \$config{timeformat},
44 $config{wiki_file_prune_regexp}=qr/$config{wiki_file_prune_regexp}|$_[1]/;
46 "adminuser=s@" => sub {
47 push @{$config{adminuser}}, $_[1]
49 "templatedir=s" => sub {
50 $config{templatedir}=possibly_foolish_untaint($_[1])
52 "underlaydir=s" => sub {
53 $config{underlaydir}=possibly_foolish_untaint($_[1])
56 $config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
59 push @{$config{plugin}}, $_[1];
61 "disable-plugin=s@" => sub {
62 $config{plugin}=[grep { $_ ne $_[1] } @{$config{plugin}}];
65 push @{$config{pingurl}}, $_[1];
69 if (! $config{setup}) {
71 run_hooks(getopt => sub { shift->() });
72 if (grep /^-/, @ARGV) {
73 print STDERR "Unknown option: $_\n"
74 foreach grep /^-/, @ARGV;
77 usage() unless @ARGV == 2;
78 $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
79 $config{destdir} = possibly_foolish_untaint(shift @ARGV);
84 # wrapper passes a full config structure in the environment
86 eval possibly_foolish_untaint($ENV{WRAPPED_OPTIONS});
88 error("WRAPPED_OPTIONS: $@");
101 require IkiWiki::CGI;
104 elsif ($config{setup}) {
105 require IkiWiki::Setup;
108 elsif ($config{wrapper}) {
110 require IkiWiki::Wrapper;
116 require IkiWiki::Render;
119 rcs_notify() if $config{notify};