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 "getctime" => \$config{getctime},
32 "wrappermode=i" => \$config{wrappermode},
33 "numbacklinks=i" => \$config{numbacklinks},
34 "rcs=s" => \$config{rcs},
35 "no-rcs" => sub { $config{rcs}="" },
36 "cgi!" => \$config{cgi},
37 "discussion!" => \$config{discussion},
38 "w3mmode!" => \$config{w3mmode},
39 "notify!" => \$config{notify},
40 "url=s" => \$config{url},
41 "cgiurl=s" => \$config{cgiurl},
42 "historyurl=s" => \$config{historyurl},
43 "diffurl=s" => \$config{diffurl},
44 "svnrepo" => \$config{svnrepo},
45 "svnpath" => \$config{svnpath},
46 "adminemail=s" => \$config{adminemail},
47 "timeformat=s" => \$config{timeformat},
48 "sslcookie!" => \$config{sslcookie},
49 "httpauth!" => \$config{httpauth},
50 "userdir=s" => \$config{userdir},
52 push @{$config{wiki_file_prune_regexps}}, $_[1];
54 "adminuser=s@" => sub {
55 push @{$config{adminuser}}, $_[1]
57 "templatedir=s" => sub {
58 $config{templatedir}=possibly_foolish_untaint($_[1])
60 "underlaydir=s" => sub {
61 $config{underlaydir}=possibly_foolish_untaint($_[1])
64 $config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
67 push @{$config{plugin}}, $_[1];
69 "disable-plugin=s@" => sub {
70 push @{$config{disable_plugins}}, $_[1];
73 push @{$config{pingurl}}, $_[1];
76 print "ikiwiki version $IkiWiki::version\n";
81 if (! $config{setup} && ! $config{render}) {
83 usage() unless @ARGV == 2;
84 $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
85 $config{destdir} = possibly_foolish_untaint(shift @ARGV);
90 # wrapper passes a full config structure in the environment
92 eval possibly_foolish_untaint($ENV{WRAPPED_OPTIONS});
94 error("WRAPPED_OPTIONS: $@");
106 require IkiWiki::CGI;
109 elsif ($config{setup}) {
110 require IkiWiki::Setup;
113 elsif ($config{wrapper}) {
115 require IkiWiki::Wrapper;
118 elsif ($config{render}) {
119 require IkiWiki::Render;
120 commandline_render();
122 elsif ($config{post_commit} && ! commit_hook_enabled()) {
123 if ($config{notify}) {
131 require IkiWiki::Render;
134 rcs_notify() if $config{notify};