#!/bin/sh 
#
#ident	"@(#)postpatch	1.8	05/04/13 SMI"
#
# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

PATH="/usr/bin:/usr/sbin:${PATH}"; export PATH


not_installed() {
	driver=$1
	grep "^${driver} " ${ROOTDIR}/etc/name_to_major > /dev/null 2>&1
	return $?
}

CheckZones()
{
	if [ "$ROOTDIR" = "/" -a -x /usr/bin/zonename ]; then
		ZONENAME=`/usr/bin/zonename`
		if [ ${ZONENAME} = "global" ]; then
			GLOBAL_ZONE=true
		else
			GLOBAL_ZONE=false
		fi
	else
		# Unable to determine zone
		GLOBAL_ZONE=true
	fi
}


GlobalZones()
{
 # Add any global zone specific stuff here
 # ie add_drv, or mucking about with /etc/system, or similar

	EXIT=0

	not_installed us ||
	    add_drv -b ${ROOTDIR} -i 'SUNW,UltraSPARC-III "SUNW,UltraSPARC-III+" SUNW,UltraSPARC-IIIi "SUNW,UltraSPARC-IIIi+" SUNW,UltraSPARC-IIe' -n us || \
	    EXIT=1

	exit ${EXIT}
}


NonGlobalZones()
{
# Any local zone stuff here,
# typically this fuction is not used 
	return 0
}


# Main

CheckZones

if [ "${GLOBAL_ZONE}" = "true" ]; then
	GlobalZones
else
	NonGlobalZones
fi

exit 0


