2 $ENV{PATH}="/usr/local/bin:/usr/bin:/bin";
7 use lib '.'; # For use without installation, removed by Makefile.
11 die "usage: ikiwiki [options] source dest\n";
14 sub getconfig () { #{{{
15 if (! exists $ENV{WRAPPED_OPTIONS}) {
17 wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.html?$|\.rss$)},
18 wiki_link_regexp => qr/\[\[(?:([^\s\]\|]+)\|)?([^\s\]]+)\]\]/,
19 wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]*)\]\]/,
20 wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/,
23 default_pageext => ".mdwn",
43 templatedir => "/usr/share/ikiwiki/templates",
44 underlaydir => "/usr/share/ikiwiki/basewiki",
48 plugin => [qw{inline}],
52 eval q{use Getopt::Long};
54 "setup|s=s" => \$config{setup},
55 "wikiname=s" => \$config{wikiname},
56 "verbose|v!" => \$config{verbose},
57 "rebuild!" => \$config{rebuild},
58 "refresh!" => \$config{refresh},
59 "getctime" => \$config{getctime},
60 "wrappermode=i" => \$config{wrappermode},
61 "rcs=s" => \$config{rcs},
62 "no-rcs" => sub { $config{rcs}="" },
63 "anonok!" => \$config{anonok},
64 "rss!" => \$config{rss},
65 "cgi!" => \$config{cgi},
66 "notify!" => \$config{notify},
67 "sanitize!" => \$config{sanitize},
68 "url=s" => \$config{url},
69 "cgiurl=s" => \$config{cgiurl},
70 "historyurl=s" => \$config{historyurl},
71 "diffurl=s" => \$config{diffurl},
72 "svnrepo" => \$config{svnrepo},
73 "svnpath" => \$config{svnpath},
74 "adminemail=s" => \$config{adminemail},
76 $config{wiki_file_prune_regexp}=qr/$config{wiki_file_prune_regexp}|$_[1]/;
78 "adminuser=s@" => sub {
79 push @{$config{adminuser}}, $_[1]
81 "templatedir=s" => sub {
82 $config{templatedir}=possibly_foolish_untaint($_[1])
84 "underlaydir=s" => sub {
85 $config{underlaydir}=possibly_foolish_untaint($_[1])
88 $config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
91 push @{$config{plugin}}, $_[1];
95 if (! $config{setup}) {
96 usage() unless @ARGV == 2;
97 $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
98 $config{destdir} = possibly_foolish_untaint(shift @ARGV);
103 # wrapper passes a full config structure in the environment
105 eval possibly_foolish_untaint($ENV{WRAPPED_OPTIONS});
107 error("WRAPPED_OPTIONS: $@");
119 require IkiWiki::CGI;
122 elsif ($config{setup}) {
123 require IkiWiki::Setup;
126 elsif ($config{wrapper}) {
128 require IkiWiki::Wrapper;
134 require IkiWiki::Render;
136 rcs_getctime() if $config{getctime};
138 rcs_notify() if $config{notify};