#!/bin/sh
# Portable System Interface Copyright (c) 1997-1998 Tycho Softworks.
# $Id: instsvc 1.1 Tue, 23 Jun 1998 11:38:33 -0400 dyfet $

etc='/etc'
prefix=$1
shift

if [ ! -d "$etc" ] ; then
	etc=''
	if [ -d /config ] ; then
		etc='/config'
	fi
fi

if test -z "$etc" ; then
	exit 0
fi

svc=$etc/$1
service=$1
shift
base=$1
shift
line=$base" $*"

grep "^$base" <$svc >/dev/null
if test $? = 1 ; then
	echo "Adding $base to $svc"
	install -d $prefix
	if test ! -f $prefix/$service ; then
		cp -f $svc $prefix/$service
	fi
	echo $line >>$prifix/$service
fi

