#!/bin/sh
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)preremove	1.2	07/03/02 SMI"
#

# Standard tool locations

RM="/usr/bin/rm"
MV="/usr/bin/mv"
GREP="/usr/bin/grep"

# These defines statements are for the editing of /etc/default/lu

DEFAULTLU_FILE="${PKG_INSTALL_ROOT}/etc/default/lu"
DEFAULTLU_BAK="/tmp/defaultlu.$$.bak"

# exit if the default lu file does not exist

[ ! -f ${DEFAULTLU_FILE} ] && exit 0

# Make a backup copy of the /etc/default/lu file - removing any existing
# entries for the lupi_zones plugin if they are present.
# Preserve permissions & ownership, so that pkgchk -n does not complain

cp -p $DEFAULTLU_FILE $DEFAULTLU_BAK
${GREP} -v '^LU_PLUGIN_EXEC_.*"lupi_zones.*"$' < ${DEFAULTLU_FILE} > ${DEFAULTLU_BAK}

# Update the real defaults file

${MV} -f ${DEFAULTLU_BAK} ${DEFAULTLU_FILE}

# results from this script are if the MV was successful (or not)
exit $?
