+
+rm -f *.log
+
+# copy tars to centos build hosts
+for dist in ${CENTOS_DIST}; do
+ arch=amd64
+ prodver=${PRODUCT}-${VERSION}
+ tarname=${prodver}.tar.gz
+ if test ! -f ../${tarname}; then
+ echo "$tarname: missing"
+ exit 1
+ fi
+
+ if ssh $dist "test -f .rpmmacros && test -d rpmbuild/SOURCES && test -d rpmbuild/RPMS && test -d rpmbuild/SRPMS"; then
+ :
+ else
+ echo "Host $dist does not seem to be prepared with rpmbuild directories"
+ exit 1
+ fi
+
+ if scp ../${tarname} $dist:rpmbuild/SOURCES/ ; then
+ :
+ else
+ echo "Could not copy $tarname to $dist"
+ exit 1
+ fi
+ if ssh $dist "cd rpmbuild/SOURCES && rm -fr $prodver && tar zxf $tarname && cd ${prodver} && rpmbuild -ba ${PRODUCT}.spec" >${dist}-${arch}.log 2>&1; then
+ :
+ else
+ echo "FAILED: See ${dist}-${arch}.log"
+ exit 1
+ fi
+done
+
+# call our privileged wrapper to clean the directories, no --dsc option
+for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
+ for arch in ${USE_ARCHS}; do
+ sudo -n $PBUILDROOT --home=${HOME_EXPORT} --dist=$dist --arch=$arch
+ if test $? -ne 0; then
+ echo "FAILED"
+ echo "Run id-pbuild.sh using sudo or add yourself to /etc/sudoers:"
+ echo "${USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh"
+ exit 1
+ fi
+ done
+done
+
+# call our privileged wrapper to do the real work, with --dsc option