#!/bin/ksh

## Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
## Use is subject to license terms.

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

Check_miniroot()
# If miniroot patching is not safe, then  returns 1
#
# returns 1 if variable $PKGDBARG contains -C and $PKG_NONABI_SYMLINKS is not
# true returns 0 otherwise
{
	if [ ! -z "$PKGDBARG" ]; then
		echo $PKGDBARG | grep "^\-C" > /dev/null 2>&1
		if [ $? -eq 0 ] ; then
				if [ X"$PKG_NONABI_SYMLINKS" != X"true" ]; then
				return 1
			fi
		fi
	fi
	return 0
}

### Main ###

ZONENAME=global

if Check_miniroot; then
   : # we are ok, PKG_NONABI_SYMLINKS is set up
else
   echo "ERROR: PKG_NONABI_SYMLINKS must be set to true for patchadd -C"
   exit 1
fi

exit 0
