changeset 720:74850275fe41

Make "wait4background" with no arguments wait for all background tasks.
author Rob Landley <rob@landley.net>
date Sun, 26 Apr 2009 14:19:21 -0500
parents 428df726cf7f
children f0ede6d6c952
files sources/functions.sh system-image.sh
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sources/functions.sh	Fri Apr 24 22:33:31 2009 -0500
+++ b/sources/functions.sh	Sun Apr 26 14:19:21 2009 -0500
@@ -343,14 +343,17 @@
   echo -en "\033]2;$ARCH_NAME $STAGE_NAME $PACKAGE\007"
 }
 
-# usage: wait4background 0
+# usage: wait4background [count]
 
 function wait4background()
 {
+  local COUNT="$1"
   local EXCLUDE="$2"
+
+  [ -z "$COUNT" ] && COUNT=0
   [ -z "$EXCLUDE" ] && EXCLUDE="thisdoesnotmatchanything"
   # Wait for background tasks to finish
-  while [ $(jobs | grep -v "$EXCLUDE" | wc -l) -gt $1 ]
+  while [ $(jobs | grep -v "$EXCLUDE" | wc -l) -gt $COUNT ]
   do
     sleep 1
     # Without this next line, bash never notices a change in the number of jobs.
--- a/system-image.sh	Fri Apr 24 22:33:31 2009 -0500
+++ b/system-image.sh	Sun Apr 26 14:19:21 2009 -0500
@@ -80,7 +80,7 @@
 
   # Wait for initial kernel build to finish.
 
-  wait4background 0
+  wait4background
 
   # This is a repeat of an earlier make invocation, but if we try to
   # consolidate them the dependencies build unnecessary prereqisites
@@ -144,7 +144,7 @@
 # Wait for kernel build to finish (may be a NOP)
 
 echo Image generation complete.
-wait4background 0
+wait4background
 trap "" EXIT
 
 # Install kernel