2 $ENV{PATH}="/usr/local/bin:/usr/bin:/bin";
3 delete @ENV{qw{IFS CDPATH ENV BASH_ENV}};
6 our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
10 use lib '.'; # For use without installation, removed by Makefile.
14 die "usage: ikiwiki [options] source dest\n";
17 sub getconfig () { #{{{
18 if (! exists $ENV{WRAPPED_OPTIONS}) {
19 %config=defaultconfig();
20 eval q{use Getopt::Long};
21 Getopt::Long::Configure('pass_through');
23 "setup|s=s" => \$config{setup},
24 "wikiname=s" => \$config{wikiname},
25 "verbose|v!" => \$config{verbose},
26 "rebuild!" => \$config{rebuild},
27 "refresh!" => \$config{refresh},
28 "wrappers!" => \$config{wrappers},
29 "getctime" => \$config{getctime},
30 "wrappermode=i" => \$config{wrappermode},
31 "rcs=s" => \$config{rcs},
32 "no-rcs" => sub { $config{rcs}="" },
33 "anonok!" => \$config{anonok},
34 "rss!" => \$config{rss},
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},
48 $config{wiki_file_prune_regexp}=qr/$config{wiki_file_prune_regexp}|$_[1]/;
50 "adminuser=s@" => sub {
51 push @{$config{adminuser}}, $_[1]
53 "templatedir=s" => sub {
54 $config{templatedir}=possibly_foolish_untaint($_[1])
56 "underlaydir=s" => sub {
57 $config{underlaydir}=possibly_foolish_untaint($_[1])
60 $config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
63 push @{$config{plugin}}, $_[1];
65 "disable-plugin=s@" => sub {
66 $config{plugin}=[grep { $_ ne $_[1] } @{$config{plugin}}];
69 push @{$config{pingurl}}, $_[1];
72 print "ikiwiki version $version\n";
77 if (! $config{setup}) {
79 usage() unless @ARGV == 2;
80 $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
81 $config{destdir} = possibly_foolish_untaint(shift @ARGV);
86 # wrapper passes a full config structure in the environment
88 eval possibly_foolish_untaint($ENV{WRAPPED_OPTIONS});
90 error("WRAPPED_OPTIONS: $@");
103 require IkiWiki::CGI;
106 elsif ($config{setup}) {
107 require IkiWiki::Setup;
110 elsif ($config{wrapper}) {
112 require IkiWiki::Wrapper;
118 require IkiWiki::Render;
121 rcs_notify() if $config{notify};