#!/bin/ksh -p


if [ $# -ne 10 ] ; then
	print editadmin: expect admin-file values in the following order:
	print setuid action rdepend idepend conflict partial instance space
	print "   " basedir email
	exit
fi

if [ ! -d $MENUDIR ] ; then
	print ERROR: MENUDIR $MENUDIR does not exist
	exit 1
fi

print Changing $MENUDIR/pkg.admin
print check pkg.admin.default for default values

sed -e 's/^setuid=.*$/setuid='$1'/' \
    -e 's/^action=.*$/action='$2'/' \
    -e 's/^rdepend=.*$/rdepend='$3'/' \
    -e 's/^idepend=.*$/idepend='$4'/' \
    -e 's/^conflict=.*$/conflict='$5'/' \
    -e 's/^partial=.*$/partial='$6'/' \
    -e 's/^instance=.*$/instance='$7'/' \
    -e 's/^space=.*$/space='$8'/' \
    -e 's/^basedir=.*$/basedir='$9'/' \
    -e 's/^mail=.*$/mail='${10}'/' \
      $MENUDIR/pkg.admin.default > $MENUDIR/pkg.admin

print Done.
