#!/bin/sh

PKG=SUNWscdhc
FILE=SUNW.dhcp

if [ "${ROOTDIR}" = "/" ]; then
    MYROOTDIR=""
  else
    MYROOTDIR=${ROOTDIR}
fi 

MYBASEDIR=`/usr/bin/pkgparam -R ${ROOTDIR} ${PKG} BASEDIR`
RTRDIR=${MYROOTDIR}/usr/cluster/lib/rgm/gdsdata
SRCDIR=${MYBASEDIR}/${PKG}/etc

# Create a link from ${MYBASEDIR}/${PKG}/bin/toupper.[sparc|i386] to
# ${MYROOTDIR}${MYBASEDIR}/${PKG}/bin/toupper

/usr/sbin/installf -R ${ROOTDIR} ${PKG} ${MYBASEDIR}/${PKG}/bin/toupper

echo "Link ${MYBASEDIR}/${PKG}/bin/toupper."`uname -p`" to ${MYROOTDIR}${MYBASEDIR}/${PKG}/bin/toupper"
ln -s ${MYBASEDIR}/${PKG}/bin/toupper.`uname -p` ${MYROOTDIR}${MYBASEDIR}/${PKG}/bin/toupper

/usr/sbin/installf -f -R ${ROOTDIR} ${PKG} || exit 1

# Create a link from ${MYBASEDIR}/${PKG}/bin/dhcpclient.[sparc|i386] to
# ${MYROOTDIR}${MYBASEDIR}/${PKG}/bin/dhcpclient

/usr/sbin/installf -R ${ROOTDIR} ${PKG} ${MYBASEDIR}/${PKG}/bin/dhcpclient

echo "Link ${MYBASEDIR}/${PKG}/bin/dhcpclient."`uname -p`" to ${MYROOTDIR}${MYBASEDIR}/${PKG}/bin/dhcpclient"
ln -s ${MYBASEDIR}/${PKG}/bin/dhcpclient.`uname -p` ${MYROOTDIR}${MYBASEDIR}/${PKG}/bin/dhcpclient

/usr/sbin/installf -f -R ${ROOTDIR} ${PKG} || exit 1

# GDSDATA DIRECTORY

if [ ! -d "${RTRDIR}" ]; then
   mkdir ${RTRDIR} || exit 2
fi

# RTR FILE

if [ ! -h "${RTRDIR}/${FILE}" ]; then
   echo "Linking ${SRCDIR}/${FILE} to ${RTRDIR}/${FILE}"
   ln -s ${SRCDIR}/${FILE} ${RTRDIR}/${FILE}
fi

exit 0

