#!/bin/sh
#
# Move /sbin/in.mpathd to new location /usr/lib/inet/in.mpathd
# 
# Create symlink from /sbin/in.mpath to new location 
#    /usr/lib/inet.inmpathd
#
# Update contents database apropriately 
#
# Once this modification has been made, patchrm will 
#   restore the original files, but not to their original
#   location.  
#

# If /sbin/in.mpathd is a symlink this modification has
#   already been made

if [ ! -h ${ROOTDIR}/sbin/in.mpathd ]; then

# Remove /sbin/in.mpathd from the SUNWcsr contents database

   if [ "$ROOTDIR" != "" ]; then
      REMOVEF="removef -R ${ROOTDIR}"
   else
      REMOVEF="removef"
   fi

# Move file to new location and create symlink
#   from the original position

   ${REMOVEF} SUNWcsr /sbin/in.mpathd

   ${REMOVEF} -f SUNWcsr || exit 2

   if [ -f ${ROOTDIR}/sbin/in.mpathd -a ! -f ${ROOTDIR}/usr/lib/inet/in.mpathd ]; then
      mv ${ROOTDIR}/sbin/in.mpathd ${ROOTDIR}/usr/lib/inet
      ln -s ../usr/lib/inet/in.mpathd ${ROOTDIR}/sbin/in.mpathd
   fi

# Register these changes with the contents database 

   if [ "$ROOTDIR" != "" ]; then
      INSTALLF="installf -R ${ROOTDIR}"
   else
      INSTALLF="installf"
   fi

   ${INSTALLF} SUNWcsr /sbin/in.mpathd

   ${INSTALLF} -f SUNWcsr

   ${INSTALLF} SUNWcsu /usr/lib/inet/in.mpathd

   ${INSTALLF} -f SUNWcsu

fi


