[Fai-commit] r5426 - in trunk: bin debian

Thomas Lange lange at alioth.debian.org
Fri Jul 17 18:03:46 UTC 2009


Author: lange
Date: 2009-07-17 18:03:44 +0000 (Fri, 17 Jul 2009)
New Revision: 5426

Modified:
   trunk/bin/ainsl
   trunk/debian/changelog
Log:
ainsl: create missing path elements if -a is used (closes: #447199)

Modified: trunk/bin/ainsl
===================================================================
--- trunk/bin/ainsl	2009-07-17 17:38:57 UTC (rev 5425)
+++ trunk/bin/ainsl	2009-07-17 18:03:44 UTC (rev 5426)
@@ -36,6 +36,7 @@
 
 my $filename;
 my $verbose;
+my $debug;
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub usage {
@@ -66,6 +67,17 @@
 sub autocreate {
 
   -f $filename && return;
+
+  # create missing parts of a path. Could be replaced by File::Path
+  my $path;
+  while ($filename =~ m#([^/]+)/#g) {
+    $path.="/$1";
+    -d $path && next;
+    print "ainsl: create $path\n" if $debug;
+    $opt_n && next;
+    mkdir $path || die "ainsl: can't create $path $!";
+  }
+
   print "ainsl: create $filename\n" if $verbose;
   $opt_n && return;
   open (FILE,">$filename") || die "ainsl: can't create $filename $!";
@@ -76,7 +88,7 @@
 
 $opt_h && usage(0);
 $verbose = $opt_v || $ENV{verbose} || 0;
-my $debug   = $opt_D || $ENV{debug}   || 0;
+$debug   = $opt_D || $ENV{debug}   || 0;
 
 $filename = shift;
 my $line     = shift;

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2009-07-17 17:38:57 UTC (rev 5425)
+++ trunk/debian/changelog	2009-07-17 18:03:44 UTC (rev 5426)
@@ -8,8 +8,9 @@
   * fcopy.8: improve info for calling postinst
   * fai-guide.sgml: add hint how to define classes on the kernel command
     line (closes: #497548)
+  * ainsl: create missing path elements if -a is used (closes: #447199)
 
- -- Thomas Lange <lange at debian.org>  Fri, 17 Jul 2009 18:42:25 +0200
+ -- Thomas Lange <lange at debian.org>  Fri, 17 Jul 2009 20:03:00 +0200
 
 fai (3.2.20) unstable; urgency=low
 




More information about the Fai-commit mailing list