2 $ENV{PATH}="/usr/local/bin:/usr/bin:/bin";
3 delete @ENV{qw{IFS CDPATH ENV BASH_ENV}};
8 use lib '.'; # For use without installation, removed by Makefile.
12 die "usage: ikiwiki [options] source dest\n";
15 sub getconfig () { #{{{
16 if (! exists $ENV{WRAPPED_OPTIONS}) {
17 %config=defaultconfig();
18 eval q{use Getopt::Long};
19 Getopt::Long::Configure('pass_through');
21 "setup|s=s" => \$config{setup},
22 "wikiname=s" => \$config{wikiname},
23 "verbose|v!" => \$config{verbose},
24 "rebuild!" => \$config{rebuild},
25 "refresh!" => \$config{refresh},
26 "wrappers!" => \$config{wrappers},
27 "getctime" => \$config{getctime},
28 "wrappermode=i" => \$config{wrappermode},
29 "rcs=s" => \$config{rcs},
30 "no-rcs" => sub { $config{rcs}="" },
31 "anonok!" => \$config{anonok},
32 "rss!" => \$config{rss},
33 "cgi!" => \$config{cgi},
34 "discussion!" => \$config{discussion},
35 "w3mmode!" => \$config{w3mmode},
36 "notify!" => \$config{notify},
37 "url=s" => \$config{url},
38 "cgiurl=s" => \$config{cgiurl},
39 "historyurl=s" => \$config{historyurl},
40 "diffurl=s" => \$config{diffurl},
41 "svnrepo" => \$config{svnrepo},
42 "svnpath" => \$config{svnpath},
43 "adminemail=s" => \$config{adminemail},
44 "timeformat=s" => \$config{timeformat},
46 $config{wiki_file_prune_regexp}=qr/$config{wiki_file_prune_regexp}|$_[1]/;
48 "adminuser=s@" => sub {
49 push @{$config{adminuser}}, $_[1]
51 "templatedir=s" => sub {
52 $config{templatedir}=possibly_foolish_untaint($_[1])
54 "underlaydir=s" => sub {
55 $config{underlaydir}=possibly_foolish_untaint($_[1])
58 $config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
61 push @{$config{plugin}}, $_[1];
63 "disable-plugin=s@" => sub {
64 $config{plugin}=[grep { $_ ne $_[1] } @{$config{plugin}}];
67 push @{$config{pingurl}}, $_[1];
71 if (! $config{setup}) {
73 usage() unless @ARGV == 2;
74 $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
75 $config{destdir} = possibly_foolish_untaint(shift @ARGV);
80 # wrapper passes a full config structure in the environment
82 eval possibly_foolish_untaint($ENV{WRAPPED_OPTIONS});
84 error("WRAPPED_OPTIONS: $@");
100 elsif ($config{setup}) {
101 require IkiWiki::Setup;
104 elsif ($config{wrapper}) {
106 require IkiWiki::Wrapper;
112 require IkiWiki::Render;
115 rcs_notify() if $config{notify};