#!/bin/ksh -p

# This script checks for TWO things:
#  1. Is the catalog newer than a month old
#  2. does it have our special extra comment-line in it?
# If the answer to either is "no", update the catalog file
#

url="$1"
site=${url##*//}
site=${site%%/*}
fname=/var/pkg-get/catalog-$site
old=`find $fname -mtime +30 -print 2>/dev/null`

if [ "$old" != "" ] ; then
	print Updating catalog for $site
	$MENUDIR/grabcatalog $url
	exit 0
fi

grep -l '#PKGADM' $fname
if [ $? -ne 0 ] ; then
	print Updating catalog for $site
	$MENUDIR/grabcatalog $url
	exit 0
fi


