Index: builder/runrooted
===================================================================
--- builder/runrooted	(revision c6da4cbb9d080b79c1d502ae53869335e9f49131)
+++ builder/runrooted	(revision 0c256154a9cdfa65d791b0a83f60f3eb42d67011)
@@ -223,17 +223,9 @@
 mv $WORKDIR/*.version $DIR || exit 1
 
-#copy check if pkg file is different and update build number when needed
+#move packages from buildroot to workdir
 for PKG in $WORKDIR/*.pkg; do
 	NAME=`basename $PKG|sed 's/.pkg$//g'`
 	if ! cmp $PKG $DIR/$NAME.pkg; then
-		BUILD=`cat $DIR/$NAME.build 2>/dev/null`
-		if [ "$BUILD" == "" ]; then
-			BUILD=1
-		else
-			(( BUILD=BUILD+1 ))
-		fi
-		echo "$PKG was rebuilded, build $BUILD"
 		mv $PKG $DIR || exit 1
-		echo $BUILD > $DIR/$NAME.build || exit 1
 	fi
 done
Index: npl/kernel/initrd/initrd.build
===================================================================
--- npl/kernel/initrd/initrd.build	(revision c6da4cbb9d080b79c1d502ae53869335e9f49131)
+++ npl/kernel/initrd/initrd.build	(revision 0c256154a9cdfa65d791b0a83f60f3eb42d67011)
@@ -1,1 +1,1 @@
-6549
+6550
Index: npl/rebuildcheck
===================================================================
--- npl/rebuildcheck	(revision c6da4cbb9d080b79c1d502ae53869335e9f49131)
+++ npl/rebuildcheck	(revision 0c256154a9cdfa65d791b0a83f60f3eb42d67011)
@@ -47,5 +47,5 @@
 {
 	DIR=$1
-	MD5=`ls -lR "$DIR"|md5sum` 
+	MD5=`ls -lR "$DIR"|md5sum`
 	! grep -x "$MD5" "$DIR/.signature" &>/dev/null
 }
@@ -81,7 +81,7 @@
 if ! [ "$ignoremd5" ]; then
 	pushd "$DIR" >/dev/null || exit 1
-	find . -type f | 
+	find . -type f |
 		#negeer bepaalde files
-		egrep -v $IGNORE_REGEX | 
+		egrep -v $IGNORE_REGEX |
 		while read FILE; do
 			MD5=`md5sum "$FILE"`
@@ -91,11 +91,11 @@
 				exit 2 #exit 2, rebuild dus
 			fi
-		done 
+		done
 	RET=$?
 	popd >/dev/null
-	
-	if [ "$RET" == "2" ]; then 
+
+	if [ "$RET" == "2" ]; then
 		REBUILD=1
-	elif [ "$RET" != "0" ]; then 
+	elif [ "$RET" != "0" ]; then
 		msg "ERROR!"
 		exit 1
@@ -127,10 +127,10 @@
 
 
-#if we need to rebuild because of a DEPERROR, check our direct dependencys first so that we rebuild the 
+#if we need to rebuild because of a DEPERROR, check our direct dependencys first so that we rebuild the
 #"deepest" stuff first.
 if ! [ "$ignoredep" ] && [ "$DEPERROR" == "1" ]; then
 	for DEP in $DEPS; do
 		#zoek de buildbase op, als deze er al is
-		if BUILDBASE=`./findbuild "$DEP"` 2>/dev/null; then 
+		if BUILDBASE=`./findbuild "$DEP"` 2>/dev/null; then
 			msg "Dependency check $DEP"
 			#note: niet de parameters meegeven, anders gaat hij alles rebuilden bij een force
@@ -169,10 +169,10 @@
 		if grep '#NOBUILDROOT' "$BUILDFILE" >/dev/null; then
 			msg "Building package without buildroot!"
-			( 
+			(
 				cd `dirname $BUILDFILE` || exit 1
 				$BUILDFILE $* || exit 1
 			) || fatal
 		else
-			( 
+			(
 				cd ../builder
 				./runrooted "$BUILDFILE" $*
@@ -193,24 +193,42 @@
 				echo
 				echo "################## DIFF of $PKG:"
-				./diffpkg $PKG 
+				./diffpkg $PKG
 				echo "################## end of DIFF $PKG "
 			fi
 		done
+
+		msg "Updating build numbers for $BUILDFILE..."
+		pushd $DIR > /dev/null
+		for PKG in *.pkg; do
+			BUILD_FILE=`echo "$PKG"| sed 's/.pkg$//'`.build
+			BUILD=`cat $BUILD_FILE 2>/dev/null`
+			if [ "$BUILD" == "" ]; then
+				BUILD=1
+			else
+				(( BUILD=BUILD+1 ))
+			fi
+			echo $BUILD > $BUILD_FILE || exit 1
+		done
+		popd >/dev/null
+
 	else
 		msg "Not building, only updating md5 sums.."
 	fi
-	
+
+
+
+
 	msg "Updating md5 for $BUILDFILE..."
 	#bepaal en bewaar major versies waartegen we gebuild hebben
 	rm $MD5FILE &>/dev/null
 	pushd $DIR >/dev/null
-	find . -type f| sort | 
+	find . -type f| sort |
 		#negeer bepaalde files
-		egrep -v $IGNORE_REGEX | 
+		egrep -v $IGNORE_REGEX |
 		while read FILE; do
 			md5sum "$FILE" >> $MD5FILE
 		done
 	popd > /dev/null
-		
+
 	msg "Updating dependency information for $BUILDFILE..."
 	DEPVERFILE=`echo $BUILDFILE | sed 's/.SlackBuild$//g'`.depver
@@ -235,4 +253,2 @@
 #store_dir "$DIR"
 exit 0
-
-
