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 "post-commit" => \$config{post_commit},
29 "render=s" => \$config{render},
30 "wrappers!" => \$config{wrappers},
31 "usedirs!" => \$config{usedirs},
32 "getctime" => \$config{getctime},
33 "wrappermode=i" => \$config{wrappermode},
34 "numbacklinks=i" => \$config{numbacklinks},
35 "rcs=s" => \$config{rcs},
36 "no-rcs" => sub { $config{rcs}="" },
37 "cgi!" => \$config{cgi},
38 "discussion!" => \$config{discussion},
39 "w3mmode!" => \$config{w3mmode},
40 "notify!" => \$config{notify},
41 "url=s" => \$config{url},
42 "cgiurl=s" => \$config{cgiurl},
43 "historyurl=s" => \$config{historyurl},
44 "diffurl=s" => \$config{diffurl},
45 "svnrepo" => \$config{svnrepo},
46 "svnpath" => \$config{svnpath},
47 "adminemail=s" => \$config{adminemail},
48 "timeformat=s" => \$config{timeformat},
49 "sslcookie!" => \$config{sslcookie},
50 "httpauth!" => \$config{httpauth},
51 "userdir=s" => \$config{userdir},
52 "htmlext=s" => \$config{htmlext},
54 push @{$config{wiki_file_prune_regexps}}, $_[1];
56 "adminuser=s@" => sub {
57 push @{$config{adminuser}}, $_[1]
59 "templatedir=s" => sub {
60 $config{templatedir}=possibly_foolish_untaint($_[1])
62 "underlaydir=s" => sub {
63 $config{underlaydir}=possibly_foolish_untaint($_[1])
66 $config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
69 push @{$config{plugin}}, $_[1];
71 "disable-plugin=s@" => sub {
72 push @{$config{disable_plugins}}, $_[1];
75 push @{$config{pingurl}}, $_[1];
78 print "ikiwiki version $IkiWiki::version\n";
83 if (! $config{setup} && ! $config{render}) {
85 usage() unless @ARGV == 2;
86 $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
87 $config{destdir} = possibly_foolish_untaint(shift @ARGV);
92 # wrapper passes a full config structure in the environment
94 eval possibly_foolish_untaint($ENV{WRAPPED_OPTIONS});
96 error("WRAPPED_OPTIONS: $@");
108 require IkiWiki::CGI;
111 elsif ($config{setup}) {
112 require IkiWiki::Setup;
115 elsif ($config{wrapper}) {
117 require IkiWiki::Wrapper;
120 elsif ($config{render}) {
121 require IkiWiki::Render;
122 commandline_render();
124 elsif ($config{post_commit} && ! commit_hook_enabled()) {
125 if ($config{notify}) {
133 require IkiWiki::Render;
136 rcs_notify() if $config{notify};