[Fai-commit] r6007 - in branches/stable/3.4: bin debian

Michael Prokop mika at alioth.debian.org
Tue Aug 17 12:56:06 UTC 2010


Author: mika
Date: 2010-08-17 12:56:06 +0000 (Tue, 17 Aug 2010)
New Revision: 6007

Modified:
   branches/stable/3.4/bin/fcopy
   branches/stable/3.4/debian/changelog
Log:
fcopy: do not copy file if preinst script fails (closes: #573044) thanks to Andreas Schuldei for the patch


Conflicts:

	debian/changelog

Signed-off-by: Michael Prokop <mika at grml.org>

Modified: branches/stable/3.4/bin/fcopy
===================================================================
--- branches/stable/3.4/bin/fcopy	2010-08-17 12:56:02 UTC (rev 6006)
+++ branches/stable/3.4/bin/fcopy	2010-08-17 12:56:06 UTC (rev 6007)
@@ -142,8 +142,12 @@
       warn "preinst script found, copying $sourcefile to $tmpfile" if $debug;
       ewarn("copying $sourcefile for preinst processing failed !") unless
         _copy($sourcefile,$tmpfh);
-      runscript("preinst",$ps,$tmpfile,$class);
-    };
+      if (runscript("preinst",$ps,$tmpfile,$class)) {
+	ewarn("preinst for $sourcefile failed; not proceeding");
+	_unlink($tmpfile);
+	return 0;
+      }
+    }
 
     if ( compare($tmpfile,$destfile)) {
       $logcomment="\t# new (literal)";
@@ -217,14 +221,20 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub runscript {
 
+  # returns 0 on success, 1 if the script failed
+
   my ($scriptname,$sourcefile,$destfile,$class) = @_;
-  return unless -x "$sourcefile/$scriptname";
+  return 1 unless -x "$sourcefile/$scriptname";
   warn "executing $sourcefile/$scriptname $class $destfile\n" if $debug;
-  return if $dryrun; # do not execute if -n or FCOPY_DRYRUN was given
+  return 0 if $dryrun; # do not execute if -n or FCOPY_DRYRUN was given
   system "$sourcefile/$scriptname $class $destfile";
   my $rc = $?>>8;
-  warn "ERROR: $scriptname returned code $rc\n" if $rc;
-  $error=1 if $rc;
+  if ($rc) {
+    warn "ERROR: $scriptname returned code $rc\n";
+    $error=1;
+    return 1;
+  }
+  return 0;
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub name2num {

Modified: branches/stable/3.4/debian/changelog
===================================================================
--- branches/stable/3.4/debian/changelog	2010-08-17 12:56:02 UTC (rev 6006)
+++ branches/stable/3.4/debian/changelog	2010-08-17 12:56:06 UTC (rev 6007)
@@ -59,6 +59,9 @@
   * fai-cd: add grub2 support (thanks to Sebastian Hetze for the patch)
     remove test which is already done before
   * fai-cd.8: add option -G
+  * make-fai-nfsroot: remove variable $FAI_BOOT
+  * fcopy: do not copy file if preinst script fails (closes: #573044)
+    thanks to Andreas Schuldei for the patch
   
   [ Michael Tautschnig ]
   * control: Move setup-storage to its own package (fai-setup-storage). Thanks




More information about the Fai-commit mailing list