summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Setup/Automator.pm15
-rw-r--r--auto-blog.setup15
-rw-r--r--auto.setup15
-rw-r--r--debian/changelog2
4 files changed, 28 insertions, 19 deletions
diff --git a/IkiWiki/Setup/Automator.pm b/IkiWiki/Setup/Automator.pm
index 742d67666..d1594d7ea 100644
--- a/IkiWiki/Setup/Automator.pm
+++ b/IkiWiki/Setup/Automator.pm
@@ -24,15 +24,20 @@ sub prettydir ($) {
return $dir;
}
-sub import (@) {
- my $this=shift;
- IkiWiki::Setup::merge({@_});
+sub sanitize_wikiname ($) {
+ my $wikiname=shift;
# Sanitize this to avoid problimatic directory names.
- $config{wikiname}=~s/[^-A-Za-z0-9_]//g;
- if (! length $config{wikiname}) {
+ $wikiname=~s/[^-A-Za-z0-9_]//g;
+ if (! length $wikiname) {
error gettext("you must enter a wikiname (that contains alphanumerics)");
}
+ return $wikiname;
+}
+
+sub import (@) {
+ my $this=shift;
+ IkiWiki::Setup::merge({@_});
# Avoid overwriting any existing files.
foreach my $key (qw{srcdir destdir repository dumpsetup}) {
diff --git a/auto-blog.setup b/auto-blog.setup
index 3ef734b39..cf77b3bf7 100644
--- a/auto-blog.setup
+++ b/auto-blog.setup
@@ -15,6 +15,7 @@ require IkiWiki::Setup::Automator;
our $wikiname=IkiWiki::Setup::Automator::ask(
gettext("What will the blog be named?"), gettext("blog"));
+our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
our $rcs=IkiWiki::Setup::Automator::ask(
gettext("What revision control system to use?"), "git");
our $admin=IkiWiki::Setup::Automator::ask(
@@ -27,13 +28,13 @@ IkiWiki::Setup::Automator->import(
wikiname => $wikiname,
adminuser => [$admin],
rcs => $rcs,
- srcdir => "$ENV{HOME}/$wikiname",
- destdir => "$ENV{HOME}/public_html/$wikiname",
- repository => "$ENV{HOME}/$wikiname.".($rcs eq "monotone" ? "mtn" : $rcs),
- dumpsetup => "$ENV{HOME}/$wikiname.setup",
- url => "http://$domain/~$ENV{USER}/$wikiname",
- cgiurl => "http://$domain/~$ENV{USER}/$wikiname/ikiwiki.cgi",
- cgi_wrapper => "$ENV{HOME}/public_html/$wikiname/ikiwiki.cgi",
+ srcdir => "$ENV{HOME}/$wikiname_short",
+ destdir => "$ENV{HOME}/public_html/$wikiname_short",
+ repository => "$ENV{HOME}/$wikiname_short.".($rcs eq "monotone" ? "mtn" : $rcs),
+ dumpsetup => "$ENV{HOME}/$wikiname_short.setup",
+ url => "http://$domain/~$ENV{USER}/$wikiname_short",
+ cgiurl => "http://$domain/~$ENV{USER}/$wikiname_short/ikiwiki.cgi",
+ cgi_wrapper => "$ENV{HOME}/public_html/$wikiname_short/ikiwiki.cgi",
adminemail => "$ENV{USER}\@$domain",
add_plugins => [qw{goodstuff websetup comments blogspam}],
disable_plugins => [qw{}],
diff --git a/auto.setup b/auto.setup
index b3d2513d9..dc2b19992 100644
--- a/auto.setup
+++ b/auto.setup
@@ -14,6 +14,7 @@ require IkiWiki::Setup::Automator;
our $wikiname=IkiWiki::Setup::Automator::ask(
gettext("What will the wiki be named?"), gettext("wiki"));
+our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
our $rcs=IkiWiki::Setup::Automator::ask(
gettext("What revision control system to use?"), "git");
our $admin=IkiWiki::Setup::Automator::ask(
@@ -26,13 +27,13 @@ IkiWiki::Setup::Automator->import(
wikiname => $wikiname,
adminuser => [$admin],
rcs => $rcs,
- srcdir => "$ENV{HOME}/$wikiname",
- destdir => "$ENV{HOME}/public_html/$wikiname",
- repository => "$ENV{HOME}/$wikiname.".($rcs eq "monotone" ? "mtn" : $rcs),
- dumpsetup => "$ENV{HOME}/$wikiname.setup",
- url => "http://$domain/~$ENV{USER}/$wikiname",
- cgiurl => "http://$domain/~$ENV{USER}/$wikiname/ikiwiki.cgi",
- cgi_wrapper => "$ENV{HOME}/public_html/$wikiname/ikiwiki.cgi",
+ srcdir => "$ENV{HOME}/$wikiname_short",
+ destdir => "$ENV{HOME}/public_html/$wikiname_short",
+ repository => "$ENV{HOME}/$wikiname_short.".($rcs eq "monotone" ? "mtn" : $rcs),
+ dumpsetup => "$ENV{HOME}/$wikiname_short.setup",
+ url => "http://$domain/~$ENV{USER}/$wikiname_short",
+ cgiurl => "http://$domain/~$ENV{USER}/$wikiname_short/ikiwiki.cgi",
+ cgi_wrapper => "$ENV{HOME}/public_html/$wikiname_short/ikiwiki.cgi",
adminemail => "$ENV{USER}\@$domain",
add_plugins => [qw{goodstuff websetup}],
disable_plugins => [qw{}],
diff --git a/debian/changelog b/debian/changelog
index be7c97119..bcdbd865c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ ikiwiki (3.14159265) UNRELEASED; urgency=low
* Updated Czech translation from Miroslav Kure. Closes: #546223
* rsync: New plugin that allows pushing the destdir to a remote host
via rsync or similar. Thanks, Amitai Schlair.
+ * auto.setup, auto-blog.setup: Fix sanitization of entered wikiname.
+ Closes: #547378
-- Joey Hess <joeyh@debian.org> Wed, 02 Sep 2009 15:01:27 -0400