#!/bin/sh
#
# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)S31_fix_net.sh	1.1	08/05/06 SMI"
#
# 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.
#

if [ "$ZONE_STACK_TYPE" = "shared" ]; then
	exit 0;
fi

NETIF_CNT=`ls /etc/hostname.* | wc -l`
if [ $NETIF_CNT -ne 1 ]; then
	echo "Cannot update /etc/hostname.{net} file"
	exit 0 
fi

if [ -z "$ZONE_NETIF" ]; then
	echo "Cannot update /etc/hostname.{net} file"
	exit 0 
fi

OLD_HOSTNET=`ls /etc/hostname.*`
if [ "$OLD_HOSTNET" != "/etc/hostname.$ZONE_NETIF" ]; then
	mv $OLD_HOSTNET /etc/hostname.$ZONE_NETIF
fi

exit 0
