#! /bin/sh # # $Id: nw_node_postinstall.SunOS,v 1.9.2.1 2007/03/05 22:42:32 hulikv Exp $ Copyright (c) 2003-2007 EMC Corporation. # # # Copyright (c) 2003-2007 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 StorageTek 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, ask the user if # we can inform the sgen driver to reload the sgen.conf file # for the Networker specfic settings to take effect. # Note that for the devices which can not be detached, # they will reference the driver global properties from the # old sgen.conf. New driver instances would reference global # properties in the new sgen.conf file. ID=`modinfo | grep sgen | awk '{print $1}'` if [ -n "$ID" ]; then echo echo "The changes made to sgen.conf will not take" echo "effect until sgen reloads the sgen.conf file. " echo echo "If you are sure that no process is currently " echo "using sgen to control a tape library or other " echo "device, then it may be safe to inform sgen to " echo "reload the sgen configuration file. " RESULT=`ckyorn -Q -p "Would you like sgen to reload sgen.conf? (default=no)" -d no` if [ `expr ${RESULT} : [yY]` -ne 0 ]; then echo " Reloading sgen.conf..." /usr/sbin/update_drv -f sgen if [ $? != 0 ]; then echo " ERROR: update_drv -f sgen failed " echo " You must issue 'update_drv -f sgen' manually or reboot this system before changes will take effect. " echo echo "Press return to continue..." read dummy_read else echo " sgen successfully reloaded sgen.conf." echo fi else echo " You must issue 'update_drv -f sgen' manually or reboot this system before changes will take effect. " echo echo "Press return to continue..." read dummy_read 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 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