Index: trunk/technical/common/build/build.sh
===================================================================
--- trunk/technical/common/build/build.sh	(revision 625)
+++ trunk/technical/common/build/build.sh	(revision 668)
@@ -1,2 +1,3 @@
+
 #!/bin/bash
 # Remote build script (iboernig@suse.de)
@@ -23,16 +24,50 @@
 #   kopiert. Vorgabe ist /tmp/smartclient_build
 
-SSH_VERSION="1"
-BUILDHOST="oldwotan"
-FQBUILDHOST="$BUILDHOST.suse.de"
-BUILDTEMP=abuildtmp
+CONFIG_FILE=/usr/local/etc/build
+#SSH_VERSION="1"
+#BUILDHOST="oldwotan"
+#FQBUILDHOST="$BUILDHOST.suse.de"
+#BUILDTEMP=abuildtmp
 BUILDUSER=$USER
+BUILDTEMP=/tmp/abuildtmp/$BUILDUSER
+
+BUILDSCRIPT=$BUILDTEMP/buildscript.$$
 
 [ -z "$BUILD_MODE" ] && BUILD_MODE="--verify"
-[ -z "$BUILD_DIST" ] && BUILD_DIST="sles7-i386+update"
-[ -z "$BUILD_ROOT" ] && BUILD_ROOT="/abuild/buildsystem.$BUILDHOST.$USER.$BUILD_DIST.smartclient"
+[ -z "$BUILD_DIST" ] && BUILD_DIST="sles8-i386+update"
+[ -z "$BUILD_ROOT" ] && BUILD_ROOT="/var/tmp/buildsystem.$USER.$BUILD_DIST"
 [ -z "$BUILD_PREPARE_SPEC" ] && BUILD_PREPARE_SPEC="no"
 
-[ -z $DEST_DIR ] && DEST_DIR="/tmp/smartclient_build/"
+[ -z $DEST_DIR ] && DEST_DIR="/tmp/build.$BUILDUSER"
+
+if [ -r $CONFIG_FILE ]; then
+	source $CONFIG_FILE
+	MOD_BUILD_DIST=`echo $BUILD_DIST | sed "s/[-+.]/_/g"`
+	#echo MOD_BUILD_DIST: $MOD_BUILD_DIST
+	#RPMS_PATHS=$[BUILD_RPMS_$MOD_BUILD_DIST]
+	#echo RPMS_PATHS: $RPM_PATHS
+	#if [ -n "$[BUILD_RPMS_$MOD_BUILD_DIST]" ]; then
+	#	BUILD_RPMS=$[BUILD_RPMS_$MOD_BUILD_DIST]
+	#fi
+	#echo OUTPUT: $[BUILD_RPMS_$MOD_BUILD_DIST]
+	#:$BUILD_RPMS
+	case "$BUILD_DIST" in
+		"9.0-i386")	
+			BUILD_RPMS_TEST=$BUILD_RPMS_9_0_i386 ;;
+		"sles8-i386")	
+			BUILD_RPMS_TEST=$BUILD_RPMS_sles8_i386 ;;
+		"sles8-i386+update")	
+			BUILD_RPMS_TEST=$BUILD_RPMS_sles8_i386_update ;;
+	esac
+	if [ "$BUILD_RPMS_TEST" ]; then
+		if [ "$BUILD_RPMS" ]; then
+			BUILD_RPMS=$BUILD_RPMS:$BUILD_RPMS_TEST
+		else
+			BUILD_RPMS=$BUILD_RPMS_TEST
+		fi
+	fi
+fi
+
+echo BUILD_RPMS: $BUILD_RPMS
 
 ERROR=0
@@ -58,45 +93,57 @@
 
 # Cleaning up and install tempdir
-ssh -${SSH_VERSION} ${FQBUILDHOST} "\
-	rm -r ${BUILDTEMP}/src/${PACKAGE}; \
-	mkdir -p ${BUILDTEMP}/src/${PACKAGE} ${BUILDTEMP}/${BUILD_DIST}";
+#ssh -${SSH_VERSION} ${FQBUILDHOST} "\
+	rm -rf ${BUILDTEMP}/src/${PACKAGE}; \
+	mkdir -p ${BUILDTEMP}/src/${PACKAGE} ${BUILDTEMP}/${BUILD_DIST};
 
-scp -oProtocol=$SSH_VERSION $SRC_FILES ${FQBUILDHOST}:${BUILDTEMP}/src/${PACKAGE}
+#scp -oProtocol=$SSH_VERSION $SRC_FILES ${FQBUILDHOST}:${BUILDTEMP}/src/${PACKAGE}
+cp -a $SRC_FILES ${BUILDTEMP}/src/${PACKAGE}
 
 if [ "$1" ]; then
-	ssh -${SSH_VERSION} ${FQBUILDHOST} "\
-		cd ${BUILDTEMP}/src/${PACKAGE}; rpm2cpio $1 | cpio -i";
+	# extract RPM in a tempoary directory
+	#ssh -${SSH_VERSION} ${FQBUILDHOST} "\
+		cd ${BUILDTEMP}/src/${PACKAGE}; rpm2cpio $1 | cpio -i		
 fi
 
 # create buildscript
 
-cat > /tmp/tmpscript.$$ <<EOF
+cat > $BUILDSCRIPT <<EOF
 #!/bin/bash
 # local buildscript
-. /work/src/bin/.profile
+#. /work/src/bin/.profile
 export BUILD_ROOT=$BUILD_ROOT
 export BUILD_DIST=$BUILD_DIST
+export BUILD_RPMS=${BUILDTEMP}/${BUILD_DIST}:$BUILD_RPMS
 export BUILD_PREPARE_SPEC=$BUILD_PREPARE_SPEC
 
-cd ~${BUILDUSER}/${BUILDTEMP}/src/${PACKAGE}
-build $BUILD_MODE --prefer-rpms ~${BUILDUSER}/${BUILDTEMP}/${BUILD_DIST}
+cd ${BUILDTEMP}/src/${PACKAGE}
+#build $BUILD_MODE --prefer-rpms ${BUILDTEMP}/${BUILD_DIST}
+build $BUILD_MODE
 EOF
+chmod a+x $BUILDSCRIPT
 
 #cat /tmp/tmpscript.$$
 
-scp -oProtocol=$SSH_VERSION /tmp/tmpscript.$$ ${FQBUILDHOST}:${BUILDTEMP}/src/${PACKAGE}/buildscript
-rm /tmp/tmpscript.$$
+#scp -oProtocol=$SSH_VERSION /tmp/tmpscript.$$ ${FQBUILDHOST}:${BUILDTEMP}/src/${PACKAGE}/buildscript
+#rm /tmp/tmpscript.$$
 
 # build and file rpms
-ssh -oProtocol=$SSH_VERSION root@${FQBUILDHOST} \
-	. ~$BUILDUSER/${BUILDTEMP}/src/${PACKAGE}/buildscript
-ssh -oProtocol=$SSH_VERSION ${FQBUILDHOST} \
-	"rm -f ${BUILDTEMP}/${BUILD_DIST}/${PACKAGE}-*.*.rpm;\
-	cp ${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${BUILDTEMP}/${BUILD_DIST}/"
+#ssh -oProtocol=$SSH_VERSION root@${FQBUILDHOST} \
+#	. ~$BUILDUSER/${BUILDTEMP}/src/${PACKAGE}/buildscript
+
+sudo su -c $BUILDSCRIPT
+rm -f $BUILDSCRIPT
+
+#ssh -oProtocol=$SSH_VERSION ${FQBUILDHOST} \
+	rm -f ${BUILDTEMP}/${BUILD_DIST}/${PACKAGE}-*.*.rpm
+	cp -a ${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${BUILDTEMP}/${BUILD_DIST}
 
 mkdir -p ${DEST_DIR}/src
 # delete all old versions of this package
 rm -f ${DEST_DIR}/src/${PACKAGE}-*.src.rpm
-if !(scp -oProtocol=$SSH_VERSION root@${FQBUILDHOST}:${BUILD_ROOT}/usr/src/packages/SRPMS/${PACKAGE}-${VERSION}-*.src.rpm ${DEST_DIR}/src ); then 
+#if !(scp -oProtocol=$SSH_VERSION root@${FQBUILDHOST}:${BUILD_ROOT}/usr/src/packages/SRPMS/${PACKAGE}-${VERSION}-*.src.rpm ${DEST_DIR}/src ); then 
+	#ERROR=1
+#fi
+if !(cp -a ${BUILD_ROOT}/usr/src/packages/SRPMS/${PACKAGE}-${VERSION}-*.src.rpm ${DEST_DIR}/src 2> /dev/null); then 
 	ERROR=1
 fi
@@ -105,5 +152,8 @@
 # delete all old versions of this package
 rm -f ${DEST_DIR}/${BUILD_DIST}/${PACKAGE}-*.rpm
-if !(scp -oProtocol=$SSH_VERSION root@${FQBUILDHOST}:${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${DEST_DIR}/${BUILD_DIST} ); then 
+#if !(scp -oProtocol=$SSH_VERSION #root@${FQBUILDHOST}:${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${DEST_DIR}/${BUILD_DIST} ); then 
+#	ERROR=2
+#fi
+if !(cp -a ${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${DEST_DIR}/${BUILD_DIST} ); then 
 	ERROR=2
 fi
