#!/bin/sh

etc='/etc'

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

if [ -z "$etc" ] ; then
	exit 0
fi

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

grep "^$base" <$svc >/dev/null
if [ $? = 1 ] ; then
	echo "Adding $base to $svc"
	echo $line >>$svc
fi

