#!/sbin/sh
 
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)lu_init_sync_stop.sh	1.1	07/03/02 SMI"
#
# set up the current mount point
# For global zone it is /
# For non global zone it is /b within the scratch zone
#
CURRBE_MNTPT="$1"
	 
#
# set up the new (next) mount point
# for global zone it is where the next BE is mounted.
# for non global zone it is /a within the scratch zone.
#
NEXTBEMNTPT="$2"

. /etc/default/lu
. /$LUBIN/lulib

logdir=`dirname $LU_SYNC_LOG_FILE`
[ -d "$NEXTBEMNTPT/$logdir" ] || \
    /usr/bin/mkdir -m 755 -p "$NEXTBEMNTPT/$logdir"

exec >>"$NEXTBEMNTPT/$LU_SYNC_LOG_FILE" 2>&1

# Compute source and target synchronization file values if required.

if /bin/grep '^<beSyncList type="initial" ' $NEXTBEMNTPT/$LU_DB_LOCAL > \
    /dev/null 2>&1; then
	$LUETCBIN/lusync -u -d "$NEXTBEMNTPT/$LU_DB_LOCAL" \
	    -m "$CURRBE_MNTPT/" -t source -s "$NEXTBEMNTPT/$LU_SYNCLIST"
	$LUETCBIN/lusync -u -d "$NEXTBEMNTPT/$LU_DB_LOCAL" \
	    -m "$NEXTBEMNTPT/" -t target -s "$NEXTBEMNTPT/$LU_SYNCLIST"
fi

exit 0
