#!/bin/bash

. /usr/lib/frugalware/fwmakepkg

if [ "$1" == "--help" ]; then
	echo "packages in wrong directory"
	exit 1
fi

cd ..

for i in `find source -name FrugalBuild`
do
	cd `dirname $i`
	startdir=`pwd`
	unset groups
	for j in `set|egrep '^(_F_|USE_)'|sed 's/\(=.*\| ()\)//'`; do unset $j; done
	source ./FrugalBuild
	if [ "$groups" != `pwd|sed 's|.*/\([^/]*\)/[^/]*|\1|'` ]; then
		echo "`dirname $i`: should be moved to $groups (`grep Maintainer FrugalBuild |sed 's/.*: //'`)"
	fi
	cd - >/dev/null
done
