#! /bin/sh # # $Id: nw_node_preremove.SunOS,v 1.6.10.4 2005/12/15 03:46:52 chejle Exp $ Copyright (c) 2003-2005 EMC Corporation. # # # Copyright (c) 2003-2005 EMC Corporation. # # All rights reserved. This is an UNPUBLISHED work, and # comprises proprietary and confidential information of EMC. # Unauthorized use, disclosure, and distribution are strictly # prohibited. Use, duplication, or disclosure of the software # and documentation by the U.S. Government is subject to # restrictions set forth in a license agreement between the # Government and EMC or other written agreement specifying # the Government's rights to use the software and any applicable # FAR provisions, such as FAR 52.227-19. # PATH=/usr/sbin:/usr/bin:/sbin PRODUCT_NAME="Sun StorEdge EBS" #============================================================================== # Function: unload_drivers # Summary: unload the lus and op drivers so they can be removed #============================================================================== unload_drivers() { if [ `uname -r | cut -f 2 -d '.'` -lt 10 ]; then # remove lus driver on Solaris 9 and below rem_drv lus > /dev/null 2>&1 if [ $? -eq 0 ]; then echo "lus driver unloaded" else echo "lus driver did not unload properly" exit 2 fi else # cleanup and unload/reload sgen driver on Solaris 10 and above # if user says it is OK # always remove any mods we made to /kernel/drv/sgen.conf del_sgen ID=`modinfo | grep sgen | awk '{print $1}'` if [ -n "$ID" ]; then echo echo "The changes made to sgen.conf will not take effect until sgen is reloaded. " echo echo "If you are sure that no process is currently using sgen to control " echo " a tape library or other device, then it may be safely unloaded. " RESULT=`ckyorn -Q -p "Would you like to unload sgen? (default=no)" -d no` if [ `expr ${RESULT} : [yY]` -ne 0 ]; then modunload -i ${ID} if [ $? != 0 ]; then echo " ERROR: modunload -i $ID failed " echo " You must unload and reload sgen manually or reboot this system before " echo " changes will take effect " echo else echo " sgen unloaded OK - we will now reload it so other applications " echo " that depend on it will continue to function properly. " echo modload -p drv/sgen fi else echo " You must unload and reload sgen manually or reboot this system before " echo " changes will take effect " echo fi else # on removal, if sgen isn't currently loaded we don't need to do anything... echo " sgen is not currently loaded so we have nothing to do right here. Have a nice day!" fi fi rem_drv op > /dev/null 2>&1 if [ $? -eq 0 ]; then echo "optical driver unloaded" else echo "optical driver did not unload properly" exit 2 fi } #============================================================================== # Function: del_sgen # Summary: remove entries from /kernel/drv/sgen.conf #============================================================================== del_sgen() { file=${PKG_INSTALL_ROOT}/kernel/drv/sgen.conf echo "Removing entries from ${file}" # remove entries from /etc/devlink.tab sedcmd="/^#begin - added by ${PKGINST}/,/^#end - added by ${PKGINST}/d" sed -e "${sedcmd}" ${file} > ${file}.tmp.$$ if [ $? -eq 0 ]; then mv ${file}.tmp.$$ ${file} else echo "cleanup of ${file} failed" exit 2 fi } #============================================================================== # Function: stop_daemons # Summary: find nsr_shutdown and stop any running daemons #============================================================================== stop_daemons() { if [ $PKGINST = LGTOnode ]; then NSR_SHUTDOWN=${CLIENT_BASEDIR}/sbin/nsr_shutdown else NSR_SHUTDOWN=${CLIENT_BASEDIR}/sbin/nsr/nsr_shutdown fi [ -z "${NSR_SHUTDOWN}" ] && return # not installed [ ! -x "${NSR_SHUTDOWN}" ] && return # not executable ${NSR_SHUTDOWN} -l > /dev/null 2>&1 # no running daemons if [ $? -eq 0 ]; then echo "Shutting down the ${PRODUCT_NAME} daemons" ${NSR_SHUTDOWN} -q fi } #============================================================================== # Function: main #============================================================================== stop_daemons unload_drivers exit 0