#!/sbin/sh

#########################################################################
# 									
#   File:	 customize
#   @(#) customize $Revision: 1.4 $ $Date: 93/02/17 14:53:39 $
#   Description: /etc/update customization script for HPXT2-TECREF fileset
# 
#########################################################################
#

umask 022
PATH="/bin:/usr/bin:/etc:."
FILESET=HPXT2-TECREF


# Get environment variables as setup earlier in prerequisite fileset    
#
ENVARDIRS="/opt/hpxt/enware2/lbin /tmp /usr/tmp last"
for ENVARDIR in $ENVARDIRS
do
  if [ $ENVARDIR = "last" ]
  then
    echo "WARNING: cannot find suitable env.vars file"
    exit 0
  fi

  if [ -f $ENVARDIR/env.vars ]
  then
    . $ENVARDIR/env.vars
    break
  fi
done

HELPGEN="/usr/vue/bin/helpgen"

if [ "$OS" = "hp10" ]
then
  PATH=$SW_PATH

  if [ -f /usr/bin/dcnodes -o -f /usr/sbin/dcnodes ]
  then
    dcnodes -q
    if [ $? -eq 2 ]
    then
        exit 0
    fi
  fi

fi

if [ "$OS" = "hp10" ]
then

  TECREF=tecref
  mkdir -p /etc/vhelp/families/C > /dev/null 2>&1
  rm -f /etc/vhelp/families/C/${TECREF}*.hf
  ln -s /opt/hpxt/enware2/share/doc/vhelp/Netstation/C/${TECREF}.hf \
	/etc/vhelp/families/C/$TECREF.hf

  mkdir -p /etc/vhelp/volumes/C > /dev/null 2>&1
  rm -f /etc/vhelp/volumes/C/${TECREF}*.hv
  ln -s /opt/hpxt/enware2/share/doc/vhelp/Netstation/C/$TECREF.hv \
	/etc/vhelp/volumes/C/$TECREF.hv

  rm -rf /usr/lib/vhelp/Netstation > /dev/null 2>&1
  ln -s /opt/hpxt/enware2/share/doc/vhelp/Netstation \
	/usr/lib/vhelp/Netstation

  if [ -x $HELPGEN ]
  then
    $HELPGEN
  fi

  exit 0
fi


ARCH=$1
ARCHEXT=""
case $ARCH in
    HP-MC68*)
    if [ ! hp9000s300 ]
    then
	ARCHEXT="+/$ARCH"
    fi
    ;;
esac


cd /

#
# Get rid of old vhelp
#
rm /usr/lib/vhelp/ENWARE/C/tecref[56]* > /dev/null 2>&1
rm /usr/vhelp/families/C/tecref[56]*.hf > /dev/null 2>&1
rm /usr/vhelp/volumes/C/tecref[56]*.hv > /dev/null 2>&1

rm -f /usr/vhelp/families/C/tecref.hf 
rm -f /usr/vhelp/volumes/C/tecref.hv

mkdir -p usr/vhelp/families/C > /dev/null 2>&1
ln -s /opt/hpxt/enware2/share/doc/vhelp/Netstation/C/tecref.hf \
	usr/vhelp/families/C/tecref.hf

mkdir -p usr/vhelp/volumes/C > /dev/null 2>&1
ln -s /opt/hpxt/enware2/share/doc/vhelp/Netstation/C/tecref.hv \
	usr/vhelp/volumes/C/tecref.hv

rm -rf usr/lib/vhelp/Netstation > /dev/null 2>&1
ln -s /opt/hpxt/enware2/share/doc/vhelp/Netstation \
	usr/lib/vhelp/Netstation

echo '/usr/vhelp/families/C/tecref.hf' >> /etc/filesets${ARCHEXT}/$FILESET
echo '/usr/vhelp/volumes/C/tecref.hv' >> /etc/filesets${ARCHEXT}/$FILESET

if [ -x $HELPGEN ]
then
  $HELPGEN
else
  echo "WARNING: Could not find $HELPGEN"
fi

exit 0
