#!/bin/sh
#*******************************************************************************
# E.S.O. - VLT project
#
# "@(#) $I>-<d$"
#
# who       when      what
# --------  --------  ----------------------------------------------
# mcarrasc  01/02/99  created
# gfilippi  07/03/99  modified as a single action
#

#************************************************************************
#   NAME
#       none - dummy action, can be used as template
#
#   SYNOPSIS
#       none 
#           INSTALL|CHECK     select operational mode (CHECK= no changes)
#           TEMPLATE_NAME     template file name. The search order for the 
#                             template is:
#                               ../templates/$TEMPLATE_NAME.`hostname`
#                               ../templates/$TEMPLATE_NAME
#                               /vlt/System/templates/$TEMPLATE_NAME
#           TARGET_FILE       the name of the file to be installed
#           TARGET_DIR        the directory where to install
#           PERMISSION        protection mask for the target file
#           OWNER             UID for the target file
#           GROUP             GUI for the target file
#
#   DESCRIPTION
#
#   FILES
#
#   ENVIRONMENT
#
#   RETURN VALUES
#
#   CAUTIONS
#
#   EXAMPLES
#
#   SEE ALSO
#
#   BUGS
#
#------------------------------------------------------------------------

date=`date '+%y%m%d'`

MODE=$1
HOST=`hostname`

TEMPLATE_NAME=$2
TARGET_FILE=$3
TARGET_DIR=$4
PERMISSION=$5
OWNER=$6
GROUP=$7

echo "----------------------------------------------------------------------"
echo "HOST:            $HOST"
echo "TEMPLATE_NAME:   $TEMPLATE_NAME"
echo "TARGET_FILE:     $TARGET_FILE"
echo "TARGET_DIR:      $TARGET_DIR"
echo "PERMISSION:      $PERMISSION"
echo "OWNER:           $OWNER"
echo "GROUP:           $GROUP"

#
# Locate the template file
#

if [ -f ../templates/$TEMPLATE_NAME.$HOST ]
then 
    FROM_FILE=../templates/$TEMPLATE_NAME.$HOST

else
    if [ -f ../templates/$TEMPLATE_NAME ]
    then 
        FROM_FILE=../templates/$TEMPLATE_NAME

    else
        if [ -f /vlt/System/templates/$TEMPLATE_NAME ]
        then 
            FROM_FILE=/vlt/System/templates/$TEMPLATE_NAME

        else
            # no template available
            exit
        fi
    fi
fi 

echo " file: $FROM_FILE    ---->    ${TARGET_DIR}/${TARGET_FILE}  "

echo " checking (no action)..... "

if [ "$MODE" = "INSTALL" ]
then
    echo " installing (no action)..... "
fi

echo "----------------------------------------------------------------------"

exit
