[Fai-commit] r4468 - trunk/bin

lange at alioth.debian.org lange at alioth.debian.org
Sat Aug 4 13:06:54 UTC 2007


Author: lange
Date: 2007-08-04 13:06:54 +0000 (Sat, 04 Aug 2007)
New Revision: 4468

Modified:
   trunk/bin/install_packages
Log:
grab error codes when executing commands, exit with 3 when errors occured


Modified: trunk/bin/install_packages
===================================================================
--- trunk/bin/install_packages	2007-08-03 16:57:20 UTC (rev 4467)
+++ trunk/bin/install_packages	2007-08-04 13:06:54 UTC (rev 4468)
@@ -25,7 +25,7 @@
 # MA 02111-1307, USA.
 #*********************************************************************
 
-my $version = "Version 4.0, 12-jul-2007";
+my $version = "Version 4.1, 4-aug-2007";
 $0=~ s#.+/##; # remove path from program name
 
 # import variables: $verbose, $MAXPACKAGES, $classes, $FAI, $FAI_ROOT
@@ -57,6 +57,7 @@
 my $cache;  # instance of AptPkg::Cache
 my @unknown; # unknown packages
 my @known;   # list of all known packages
+my $execerrors; # counts execution errors
 my $downloaddir="/var/cache/apt/archives/partial/"; # where to download packages that gets only unpacked
 
 # PRELOAD feature from Thomas Gebhardt  <gebhardt at hrz.uni-marburg.de>
@@ -239,6 +240,11 @@
   execute("$rootcmd $command{clean}");
 }
 
+if ($execerrors) {
+  warn "$execerrors errors during executing of commands\n";
+  exit 3;
+}
+
 exit 0; # end of program
 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub readconfig {
@@ -299,6 +305,9 @@
   # @cmds should me more efficient
   $error = system @cmds;
   warn "ERROR: $error $?\n" if $error;
+  my $rc = $?>>8;
+  warn "ERROR: $cmds[0] return code $rc\n" if $rc;
+  $execerrors++ if $rc;
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub dselectupgrade {




More information about the Fai-commit mailing list