#!/bin/bash
# $Header: /cvs/WebShield/wsrc/files/mgmt/update_config_ex,v 1.4 2004/06/22 14:54:33 bwhittak Exp $
#
# Copyright (C) 2004 Networks Associates Technology Inc. All rights reserved.
#
# Apply any necessary updates to restored config - either in the usual place of
# in a UI session directroy specified by $1

if [ -f $NETAWSS/.profile.vars ]; then
    . $NETAWSS/.profile.vars
else
    . /var/NAIENV/.profile.vars
fi
[[ "$PATH" == "$wsPATH":* || -z "$wsPATH" ]] || PATH=$wsPATH:$PATH
shopt -s extglob
shopt -s nullglob

sessdir=${1:-$XMLCONFDIR}	# optional session directory, or default
xwsconf=$sessdir/WebShield.xml
. shvars-xmlconf || exit

# In case it's an old config we just restored merge it with the prototype
export WSXVER='v2.7'
export OLDWSXVER=$(GetXMLvalue "$xwsconf" "$wsWSver" | sed 's/^[^v]*//')
if [[ "$OLDWSXVER" != "$WSXVER" ]]; then
    # do any conversion scripts
    for s in $WSMGMT/xmlconv.d/e*; do
	[[ -x "$s" ]] && "$s" "$xwsconf"
    done
fi

# all done
exit 0
