#!/bin/sh
#@(#)HP X Station Admin Scripts
#
# xtutil_add-file	
#
# add file in $1 to IPD (10.0) or fileset list 
#

# default path
PATH="/sbin:/usr/sbin:/bin:/usr/bin:/etc:/usr/etc:/usr/local/bin:/usr/ucb:/usr/ccs"

if [ "$1" = "" ]
then
  echo "no file name specified in call to $0"
  exit 1
fi

if [ "$OS" = "" ]
then
  THISPATH=`ls -la $0 | awk '{print $NF}'`
  THISDIR=`dirname $THISPATH`
  if [ -f "${THISDIR}/env.vars" ]
  then
    . ${THISDIR}/env.vars
  else
    echo "could not find ${THISDIR}/env.vars"
    exit 2
  fi
fi


if [ "$OS" = "hp10" ]
then
  CONTROL_UTILS=/usr/lbin/sw/control_utils
  if [ ! -f $CONTROL_UTILS ]
  then
    echo "ERROR:   Cannot find $UTILS"
    exit 3
  fi
  . $CONTROL_UTILS

  IPD_addfile $1
else
  if [ "$OS" = "hp" ]
  then
    if [ "$FILESET" = "" ]
    then
      echo "env var FILESET undefined"
      exit 4
    fi
    if [ -f /etc/filesets/$FILESET ]
    then
      echo "$1" >> /etc/filesets/$FILESET 2>/dev/null
    else
      echo "$0: cannot find /etc/filesets/$FILESET"
      exit 5
    fi
  else
    echo "$0: wrong OS ($OS) for this utility"
    exit 6
  fi
fi

exit 0
