#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)preremove	1.7	07/05/14 SMI"
#

KEYLOCALE='ja'
LIBFILES='libolgx.so.103.3 libxview.so.103.5'

PKGCOND=/usr/bin/pkgcond
is_srngz=99

if [ -x $PKGCOND ]; then
     $PKGCOND -v is_sparse_root_nonglobal_zone > /dev/null 2>&1
     is_srngz=$?
fi

test_writable() {
	if [ $is_srngz -ne 99 ]; then
		$PKGCOND is_path_writable $1 && return $?
	else
		/usr/bin/touch $1/.test.$$ > /dev/null 2>&1
		if [ $? !=  0 ]; then
			return 1
		else
			rm -f  $1/.test.$$ > /dev/null 2>&1
			return 0
		fi
	fi
} 

if [ -d $BASEDIR/usr/4lib ]; then
    test_writable $BASEDIR/usr/4lib > /dev/null 2>&1
    if [ $? = 0 ]; then
	cd $BASEDIR/usr/4lib
	for file in $LIBFILES
	do
	    ls -l $file 2> /dev/null | \
		grep "locale/$KEYLOCALE/" >/dev/null 2>&1
	    if [ $? = 0 ]; then
		rm -f $file
	    fi
	done
    fi
fi
exit 0
