#!/bin/ksh

TAG_BASEDIR=`/twc/bin/db_exp -f c_adtag_directory -s dif /twc/dif/wxl_dif`

TAG_DIRECTORY=$1

TAG_PATH=$TAG_BASEDIR/$TAG_DIRECTORY

################################################################################
# Store the version of the tag to avoid unnecessary re-installs.

# Read the version.
exec 0< $TAG_PATH/version
read VERSION

# Clear out the <adtag>_version_stamp entry if it's there.
COMMAND="DELETE $TAG_DIRECTORY""_version_stamp"
echo "$COMMAND" | /twc/bin/fire_str >/dev/null 2>&1

# Create the entry <adtag>_version_stamp and set it to the version installed.
COMMAND="INSERT $TAG_DIRECTORY""_version_stamp=$VERSION"
echo "$COMMAND" | /twc/bin/fire_str >/dev/null 2>&1
################################################################################

# Now, insert all other entries needed to support the tag.
/twc/bin/db_imp -d -r -s dif /twc/dif/wxl_dif $TAG_PATH/difentries
