]> sipb.mit.edu Git - ikiwiki.git/commitdiff
ikiwiki-transition: If passed a nonexistant srcdir, or one not containing .ikiwiki...
authorJoey Hess <joey@gnu.kitenet.net>
Thu, 7 May 2009 00:46:26 +0000 (20:46 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Thu, 7 May 2009 00:46:26 +0000 (20:46 -0400)
debian/changelog
ikiwiki-transition

index d4fe91b8899183c1fd139ffa464b8a0404f1e893..36f4c16fdac7fcfa57768fc936fddbfd4391b115 100644 (file)
@@ -1,3 +1,10 @@
+ikiwiki (3.13) UNRELEASED; urgency=low
+
+  * ikiwiki-transition: If passed a nonexistant srcdir, or one not
+    containing .ikiwiki, abort with an error rather than creating it.
+
+ -- Joey Hess <joeyh@debian.org>  Wed, 06 May 2009 20:45:44 -0400
+
 ikiwiki (3.12) unstable; urgency=low
 
   * Re-enable python-support and add python:Depends to control file.
index f17868d736e421c2997e32feb8dfb1466cc920c5..ce180730962bada4fa7d8dc08507e54e9550dcc0 100755 (executable)
@@ -73,11 +73,7 @@ sub prefix_directives {
 }
 
 sub indexdb {
-       my $dir=shift;
-       if (! defined $dir) {
-               usage();                
-       }
-       $config{wikistatedir}=$dir."/.ikiwiki";
+       setstatedir(shift);
 
        # Note: No lockwiki here because ikiwiki already locks it
        # before calling this.  
@@ -96,11 +92,7 @@ sub indexdb {
 }
 
 sub hashpassword {
-       my $dir=shift;
-       if (! defined $dir) {
-               usage();                
-       }
-       $config{wikistatedir}=$dir."/.ikiwiki";
+       setstatedir(shift);
 
        eval q{use IkiWiki::UserInfo};
        eval q{use Authen::Passphrase::BlowfishCrypt};
@@ -221,11 +213,7 @@ sub moveprefs {
 }
 
 sub deduplinks {
-       my $dir=shift;
-       if (! defined $dir) {
-               usage();                
-       }
-       $config{wikistatedir}=$dir."/.ikiwiki";
+       setstatdir(shift);
        IkiWiki::loadindex();
        foreach my $page (keys %links) {
                my %l;
@@ -235,6 +223,24 @@ sub deduplinks {
        IkiWiki::saveindex();
 }
 
+sub setstatedir {
+       my $dir=shift;
+
+       if (! defined $dir) {
+               usage();                
+       }
+
+       if (! -d $dir) {
+               error("ikiwiki-transition: $dir does not exist");
+       }
+
+       $config{wikistatedir}=$dir."/.ikiwiki";
+
+       if (! -d $config{wikistatedir}) {
+               error("ikiwiki-transition: $config{wikistatedir} does not exist");
+       }
+}
+
 sub usage {
        print STDERR "Usage: ikiwiki-transition type ...\n";
        print STDERR "Currently supported transition subcommands:\n";