#! /bin/sh # # $Id: nw_node_postinstall.SunOS,v 1.3.10.5 2006/04/26 18:33:31 castrv 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: add_devlink # Summary: add entries to /etc/devlink.tab #============================================================================== add_devlink() { file=${PKG_INSTALL_ROOT}/etc/devlink.tab echo "Adding entries to ${file}" # clean up any previous entries in /etc/devlink.tab sedcmd1="/^#EMC Juke begin/,/^#EMC Juke end/d" sedcmd2="/^#EMC uscsi begin/,/^#EMC uscsi end/d" sedcmd3="/^#EMC Optical begin/,/^#EMC Optical end/d" sed -e "${sedcmd1}" -e "${sedcmd2}" -e "${sedcmd3}" ${file} > ${file}.tmp.$$ if [ $? -eq 0 ]; then mv ${file}.tmp.$$ ${file} else echo "cleanup of ${file} failed" exit 2 fi # add entries to /etc/devlink.tab echo "#begin - added by ${PKGINST} - do not EDIT" >> ${file} if [ `uname -r | cut -f 2 -d '.'` -lt 10 ]; then # lus driver only supported on Solaris 9 and below echo "type=ddi_pseudo;name=lus;minor=0 lus" >> ${file} fi echo "type=ddi_pseudo;name=op optical\N0" >> ${file} echo "#end - added by ${PKGINST} - do not EDIT" >> ${file} } #============================================================================== # Function: add_sgen # Summary: add entries to /kernel/drv/sgen.conf #============================================================================== add_sgen() { file=${PKG_INSTALL_ROOT}/kernel/drv/sgen.conf list=device-type-config-list types='"direct", "sequential", "worm", "rodirect", "optical", "changer"' echo "Adding entries to ${file}" echo "#begin - added by ${PKGINST} - do not EDIT" >> ${file} echo "${list}=${types};" >> ${file} for t in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do for l in 0 1 2 3 4 5 6; do echo "name=\"sgen\" class=\"scsi\" target=${t} lun=${l};" >> ${file} done done echo "#end - added by ${PKGINST} - do not EDIT" >> ${file} } #============================================================================== # Function: remove_lus # Summary: removes the lus driver #============================================================================== remove_lus() { rm -f ${PKG_INSTALL_ROOT}/usr/kernel/drv/lus rm -f ${PKG_INSTALL_ROOT}/usr/kernel/drv/lus.conf rm -f ${PKG_INSTALL_ROOT}/usr/kernel/drv/sparcv9/lus removef ${PKGINST} ${PKG_INSTALL_ROOT}/usr/kernel/drv/lus > /dev/null removef ${PKGINST} ${PKG_INSTALL_ROOT}/usr/kernel/drv/lus.conf > /dev/null removef ${PKGINST} ${PKG_INSTALL_ROOT}/usr/kernel/drv/sparcv9/lus > /dev/null removef -f ${PKGINST} } #============================================================================== # Function: load_drivers # Summary: load the lus and op drivers #============================================================================== load_drivers() { if [ "X${PKG_INSTALL_ROOT}" = "/a" ]; then touch ${PKG_INSTALL_ROOT}/reconfigure fmt<<-! Due to package relocation, the lus and optical drivers can not be dynamically loaded. The drivers will be configured automatically the next time the target system is rebooted. ! else if [ `uname -r | cut -f 2 -d '.'` -lt 10 ]; then # use lus driver on Solaris 9 and below add_drv -m '* 0666 bin bin' lus > /dev/null 2>&1 if [ $? -eq 0 ]; then echo "lus driver configured and loaded" else echo "lus driver did not configure properly" fi else # for Solaris 10 and above we use sgen instead of lus # if sgen is currently loaded, we must ask the user if # we can unload and reload it so that our modifications # to sgen.conf will take effect 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 #sgen is not currently loaded - we can safely load it ourselves modload -p drv/sgen if [ $? -eq 0 ]; then echo "sgen driver configured and loaded" else add_drv -n -m '* 0600 bin bin' sgen > /dev/null 2>&1 if [ $? -eq 0 ]; then modload -p drv/sgen if [ $? -eq 0 ]; then echo "sgen driver configured, added and loaded properly" else echo "sgen driver added OK, but did not load properly" fi else echo " *** sgen driver did not load properly and " echo " *** it could not be added " echo " *** /kernel/drv/sparcv9/sgen is possibly missing" exit 2 fi fi fi fi add_drv -n -m '* 0600 bin bin' op > /dev/null 2>&1 if [ $? -eq 0 ]; then echo "optical driver configured and loaded" else echo "optical driver did not configure properly" fi fi } #============================================================================== # Function: start_daemons # Summary: start the NetWorker daemons #============================================================================== start_daemons() { if [ "X${RESTART_DAEMONS}" = "Xyes" ]; then echo "Starting the ${PRODUCT_NAME} daemons" /etc/init.d/networker start fi } #============================================================================== # Function: main #============================================================================== add_devlink if [ `uname -r | cut -f 2 -d '.'` -ge 10 ]; then add_sgen remove_lus fi load_drivers start_daemons exit 0