#! /bin/bash
#
# Copyright (c) Ensim Corporation 2000, 2001   All Rights Reserved.
#
# This software is furnished under a license and may be used and copied
# only  in  accordance  with  the  terms  of such  license and with the
# inclusion of the above copyright notice. This software or any other
# copies thereof may not be provided or otherwise made available to any
# other person. No title to and ownership of the software is hereby
# transferred.
#
# The information in this software is subject to change without notice
# and  should  not be  construed  as  a commitment by Ensim Corporation.
# Ensim assumes no responsibility for the use or  reliability  of its
# software on equipment which is not supplied by Ensim.
#

# XXX needs to be switched over to new common lib
. /etc/appliance/scriptsLib-3.0/common.lib
#. /usr/lib/opcenter/postinstall/common/utils

OCWINODEDIR='/home/virtual/FILESYSTEMTEMPLATE/siteinfo/etc'

exe ls -d /home/virtual/FILESYSTEMTEMPLATE 2>/dev/null >/dev/null </dev/null
exe ls /usr/bin/exclude_templates 2>/dev/null >/dev/null </dev/null
exe ls -d $OCWINODEDIR 2>/dev/null >/dev/null </dev/null

inodefile="$OCWINODEDIR/ocwinodes"

# we have to overwrite the file (i.e. not remove & recreate as it will break the hardlink to sites)

if [ -e $inodefile ] ; then
    cat /dev/null > $inodefile
fi

exe find /home/virtual/FILESYSTEMTEMPLATE | /usr/bin/exclude_templates > $inodefile 

exe find $inodefile | /usr/bin/exclude_templates >> $inodefile

#update the /etc/ocwinodes at the box level. This one is not hardlinked to anything
exe rm -f /etc/ocwinodes
exe cp -p $inodefile /etc/ocwinodes

exit 0
