#!/bin/sh

###############################################################################
#
# $Id$
# $Author$
#
#
# Replaces enstore_html rpm.
#
##############################################################################
random_num=$$${RANDOM}
tmpdir=/tmp/${random_num}
startdir=${PWD}
#=======================================================================
# Check out what is needed
#=======================================================================
mkdir ${tmpdir}
if [ $? != 0 ] ; then
    echo  "could not create temp directory $tmpdir" >&2
    exit 1
fi

#======================================================================
# Cleanup function
#======================================================================
cleanup() {
  rm -rf $tmpdir
}

# add cleanup
trap cleanup 0
trap "exit 1" 1 2 3 15

service httpd stop
cd ${tmpdir}
cp ${ENSTORE_DIR}/etc/*.gif .
cp ${ENSTORE_DIR}/etc/*.html .
cp ${ENSTORE_DIR}/sbin/active_volumes.sh .
cp ${ENSTORE_DIR}/sbin/deploy_enstore_html .
cp ${ENSTORE_DIR}/sbin/make_enstore_system.py .
cp ${ENSTORE_DIR}/sbin/undeploy_enstore_html .
cp ${ENSTORE_DIR}/src/*cgi*py .
cp ${ENSTORE_DIR}/src/web_server.py .
cp ${ENSTORE_DIR}/www/conf/httpd.conf .

./deploy_enstore_html

#=======================================================================
# Clean-up? will be cause by exit (trap 0)
#=======================================================================
