head	1.1;
access;
symbols;
locks; strict;
comment	@# @;


1.1
date	2001.04.25.03.43.26;	author garbled;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Whew.  Add an entire networking configuration tree for sushi.  This gives
sushi the ability to do the following tasks:
Edit /etc/exports
Edit /etc/hosts
Change the hostname
Modify NIC configuration
Change the default route
Setup YP/NIS.
@
text
@#!/bin/sh
# $NetBSD$

IFS=" "
EXPORTS=`cat /etc/exports`
echo $EXPORTS | grep -v "^$1" | grep -v '^$' >/etc/exports
LINE="$1"

if [ "$2" = "YES" ]; then
	LINE=`echo "$LINE -alldirs"`
fi
if [ "$3" = "YES" ]; then
	LINE=`echo "$LINE -maproot=$4"`
	if [ "$5" != " " ]; then
		GROUPS=`echo "$5" | sed -e 's/,/:/g'`
		LINE=`echo "$LINE"":$GROUPS"`
	fi
fi
if [ "$6" = "YES" ]; then
	LINE=`echo "$LINE -ro"`
fi
if [ "$7" = "YES" ]; then
	LINE=`echo "$LINE -noresvport"`
fi
if [ "$8" = "YES" ]; then
	LINE=`echo "$LINE -noresvmnt"`
fi
if [ "$9" != " " ]; then
	LINE=`echo "$LINE -network $9"`
fi
if [ "$10" != " " ]; then
	LINE=`echo "$LINE -mask $10"`
fi
if [ "$11" != " " ]; then
	LINE=`echo "$LINE $11"`
fi

echo $LINE >>/etc/exports

if [ "$?" = "0" ]; then
	echo "Added or modified $1 in /etc/exports"
else
	echo "Failed to modify /etc/exports"
fi

if [ "$12" = "YES" ]; then
	if [ -f "/var/run/mountd.pid" ]; then
		kill -HUP `cat /var/run/mountd.pid`
		echo "Restarted mountd."
	else
		echo "Mountd not running, cannot refresh."
	fi
fi
@
