pf-tools/pf-tools: addfile show now same behaviour than create f...

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Tue Sep 2 16:21:20 UTC 2014


details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/128869957697
changeset: 1328:128869957697
user:      shad
date:      Tue Sep 02 13:41:53 2014 +0200
description:
addfile show now same behaviour than create file, ie: creates directories if they did not exist

diffstat:

 lib/PFTools/Update/ADDFILE.pm    |  3 ++-
 lib/PFTools/Update/CREATEFILE.pm |  7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r b5579500e675 -r 128869957697 lib/PFTools/Update/ADDFILE.pm
--- a/lib/PFTools/Update/ADDFILE.pm	Fri Aug 29 14:29:06 2014 +0200
+++ b/lib/PFTools/Update/ADDFILE.pm	Tue Sep 02 13:41:53 2014 +0200
@@ -113,7 +113,8 @@
     }
 
     if ( !-f $tmp ) {
-        carp colored( qq{ERROR: Unable to open filtered $tmp}, q{bold red on_white} );
+        carp colored( qq{ERROR: Unable to open filtered $tmp},
+            q{bold red on_white} );
         return;
     }
 
diff -r b5579500e675 -r 128869957697 lib/PFTools/Update/CREATEFILE.pm
--- a/lib/PFTools/Update/CREATEFILE.pm	Fri Aug 29 14:29:06 2014 +0200
+++ b/lib/PFTools/Update/CREATEFILE.pm	Tue Sep 02 13:41:53 2014 +0200
@@ -92,8 +92,11 @@
         }
         do_on_config( $ref_section, $options, $hash_subst ) or return;
         do_before_change( $ref_section, $options, $hash_subst ) or return;
-        if ( !$options->{'simul'} && !copy( $tmp, $dest ) ) {
-            carp qq{ERROR: Unable to create $dest with $tmp};
+        if ( !$options->{'simul'}
+            && ( !mk_dest_dir($dest) || !copy( $tmp, $dest ) ) )
+        {
+            carp colored( qq{ERROR: Unable to create $dest with $tmp},
+                q{bold red on_white} );
             return;
         }
         do_chownmod( $ref_section, $dest, $options ) or return;



More information about the pf-tools-commits mailing list