2 $ENV{PATH}="/usr/local/bin:/usr/bin:/bin";
3 delete @ENV{qw{IFS CDPATH ENV BASH_ENV}};
9 use lib '.'; # For use in nonstandard directory, munged by Makefile.
13 die gettext("usage: ikiwiki [options] source dest"), "\n";
16 sub getconfig () { #{{{
17 if (! exists $ENV{WRAPPED_OPTIONS}) {
18 %config=defaultconfig();
19 eval q{use Getopt::Long};
20 Getopt::Long::Configure('pass_through');
22 "setup|s=s" => \$config{setup},
23 "wikiname=s" => \$config{wikiname},
24 "verbose|v!" => \$config{verbose},
25 "syslog!" => \$config{syslog},
26 "rebuild!" => \$config{rebuild},
27 "refresh!" => \$config{refresh},
28 "render=s" => \$config{render},
29 "wrappers!" => \$config{wrappers},
30 "getctime" => \$config{getctime},
31 "wrappermode=i" => \$config{wrappermode},
32 "rcs=s" => \$config{rcs},
33 "no-rcs" => sub { $config{rcs}="" },
34 "anonok!" => \$config{anonok},
35 "cgi!" => \$config{cgi},
36 "discussion!" => \$config{discussion},
37 "w3mmode!" => \$config{w3mmode},
38 "notify!" => \$config{notify},
39 "url=s" => \$config{url},
40 "cgiurl=s" => \$config{cgiurl},
41 "historyurl=s" => \$config{historyurl},
42 "diffurl=s" => \$config{diffurl},
43 "svnrepo" => \$config{svnrepo},
44 "svnpath" => \$config{svnpath},
45 "adminemail=s" => \$config{adminemail},
46 "timeformat=s" => \$config{timeformat},
47 "sslcookie!" => \$config{sslcookie},
48 "httpauth!" => \$config{httpauth},
49 "userdir=s" => \$config{userdir},
51 push @{$config{wiki_file_prune_regexps}}, $_[1];
53 "adminuser=s@" => sub {
54 push @{$config{adminuser}}, $_[1]
56 "templatedir=s" => sub {
57 $config{templatedir}=possibly_foolish_untaint($_[1])
59 "underlaydir=s" => sub {
60 $config{underlaydir}=possibly_foolish_untaint($_[1])
63 $config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
66 push @{$config{plugin}}, $_[1];
68 "disable-plugin=s@" => sub {
69 push @{$config{disable_plugins}}, $_[1];
72 push @{$config{pingurl}}, $_[1];
75 print "ikiwiki version $IkiWiki::version\n";
80 if (! $config{setup} && ! $config{render}) {
82 usage() unless @ARGV == 2;
83 $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
84 $config{destdir} = possibly_foolish_untaint(shift @ARGV);
89 # wrapper passes a full config structure in the environment
91 eval possibly_foolish_untaint($ENV{WRAPPED_OPTIONS});
93 error("WRAPPED_OPTIONS: $@");
105 require IkiWiki::CGI;
108 elsif ($config{setup}) {
109 require IkiWiki::Setup;
112 elsif ($config{wrapper}) {
114 require IkiWiki::Wrapper;
117 elsif ($config{render}) {
118 require IkiWiki::Render;
119 commandline_render();
124 require IkiWiki::Render;
127 rcs_notify() if $config{notify};