#!/bin/sh
#
# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)S32_fix_nfs.sh	1.1	08/05/06 SMI"
#

# Comment out all of the shares since the zone cannot be an NFS server.
#
# As part of the p2v module interface there are environment variables set for
# this script (e.g. FILEDIR - path to brand-specific file repository).
# See the p2v script for a full list of variables.
#

nawk '{
	if (substr($1, 0, 1) == "#") {
		print $0
	} else {
		print "#", $0
		modified=1
	}
}
END {
	if (modified == 1) {
		printf("# Modified by p2v ")
		system("/usr/bin/date")
		exit 0
	}
	exit 1
}' /etc/dfs/dfstab >/tmp/dfstab.$$

if [ $? -eq 0 ]; then
	if [ ! -f /etc/dfs/dfstab.pre_p2v ]; then
		cp -p /etc/dfs/dfstab /etc/dfs/dfstab.pre_p2v
	fi
	cp /tmp/dfstab.$$ /etc/dfs/dfstab
fi
rm -f /tmp/dfstab.$$

if [ ! -f /etc/dfs/sharetab.pre_p2v -a -f /etc/dfs/sharetab ]; then
	cp -p /etc/dfs/sharetab /etc/dfs/sharetab.pre_p2v
fi
cat /dev/null >/etc/dfs/sharetab
