# Script to build ntfs-3g for several distributions using osc, the opensuse
# buildservice client. Needs to be started from the checked-out directory
# of a project which provides needed packages, e.g. osc co home:benkai:ntfs/NTFS-3g
trap 2 exit
set -ex
#export BUILD_ROOT=/home/abuild/ntfs-3g-root
unset BUILD_DIST
export BUILD_ROOT=/dev/shm/ntfs-3g-root
while read platform arch; do
	outdir=RPMS/$platform
	if [ -d $outdir/$arch ]; then
		echo "$outdir/$arch exist, next!"
		continue
	fi
	echo $platform $arch
	rm -rf $BUILD_ROOT
	time osc build --no-verify --clean $platform $arch ntfs-3g.spec
	mkdir -p $outdir/$arch-tmp
	mv $BUILD_ROOT/usr/src/*/RPMS/*/*.rpm $outdir/$arch-tmp
	mv $outdir/$arch-tmp $outdir/$arch
done <<END
CentOS_5        i586
CentOS_5        x86_64
Fedora_7        i586
Fedora_7        x86_64
Fedora_8        i586
Fedora_8        x86_64
Fedora_Extras_6 i586
Fedora_Extras_6 x86_64
Mandriva_2007   i586
Mandriva_2007   x86_64
Mandriva_2008   i586
Mandriva_2008   x86_64
openSUSE_10.2   i586
openSUSE_10.2   x86_64
openSUSE_10.3   i586
openSUSE_10.3   x86_64
openSUSE_Factory i586
openSUSE_Factory x86_64
SLES_9          i586
SLES_9          x86_64
SLE_10          i586
SLE_10          x86_64
SUSE_Linux_10.1 i586
SUSE_Linux_10.1 x86_64
Fedora_Core_6   i586
Fedora_Core_6   x86_64
END
