#!/bin/sh

# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
load_mod git

set_girar_host $1 && shift

if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
	echo "grpmbsh - multi repo rpmbsh analogue (build packages in hasher)"
	echo "Usage: grpmbsh [GIRAR] package1... package2..."
	# FIXME: concatenate grpmbsh and grpmbs
	#echo "Options:"
	#echo "    -a - build all packages in one task"
	#echo "    -u - build packages separately (one package per task)"
	#echo "    -f - force set tags (see rpmbs)"
	exit 1
fi

OPTIONS=
if [ "$1" = "-i" ] ; then
	OPTIONS="-i"
fi


for i in "$@" ; do
	docmd cd $i || fatal "Please run in dir with '$i' subdirectory."
	docmd rpmbsh $GIRARHOST $OPTIONS || fatal
	cd -
done
