#!/bin/bash
# $Header: /cvs/WebShield/wsrc/files/mgmt/add_engine_and_dat,v 1.2 2001/04/12 14:31:52 bwhittak Exp $
#
# (C) Copyright Network Associates Inc. 2001
#
# Called by the UI to install engine/DAT zips it's collected from user.
#
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

# process options
while [[ $# -gt 0 ]]; do
    case $1 in
	(-eng) eng_zip=$2; shift;;
	(-dat) dat_zip=$2; shift;;
	(*) echo "Unrecognised option ignored: $1" >&2;;
    esac
    shift
done

# we'd better have something to do
if [[ -z "$eng_zip" && -z "$dat_zip" ]]; then
    echo "Nothing to do" >&2
    exit
fi

# Do the update
av-update -local \
    ${eng_zip:+-engzip "$eng_zip"} \
    ${dat_zip:+-datzip "$dat_zip"} \
	</dev/null >/dev/null 2>&1
exit
