#! /bin/sh
# A script to check gup consistency

. /var/lib/news/gup/gupconfig
verify_file () {
	[ -f "$1" ] && return
	echo "linking $1 -> $2"
	ln -sf $1 $2
}
for h in $sitesdir/* ; do
  site=`basename $h`
  echo $site
  verify_file $h/header $defhdr			# header
  if [ ! -f $h/groups ]; then			# body
    echo "copying basic groups entry (performing customization) -> $h/groups"
    sed -e "s/HOST/$site/g" $defgroup >$h/groups
  fi
  verify_file $h/trailer $deftrail		# trailer
  verify_file $h/exclude $defexcl		# exclusions
done
chown $gup_uid $sitesdir/*/groups
