#! /bin/sh # # $Id: nw_clnt_postinstall.SunOS,v 1.11.2.5 2005/11/15 22:24:37 benedv Exp $ Copyright (c) 2005 EMC Corporation # # # Copyright (c) 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: create_nsrhome # Summary: create the /nsr directory structure #============================================================================== create_nsrhome() { echo "Creating the /nsr directory structure" # create the specified directory if [ ! -d ${PKG_INSTALL_ROOT}/${NSR_HOME} ]; then mkdir -p ${PKG_INSTALL_ROOT}/${NSR_HOME} fi # create the /nsr sym link if [ "X${NSR_HOME}" != "X/nsr" ]; then if [ ! -h ${PKG_INSTALL_ROOT}/nsr ]; then ln -s ${NSR_HOME} ${PKG_INSTALL_ROOT}/nsr elif [ `ls -l /nsr | awk '{print $11}'` != ${NSR_HOME} ]; then mv ${PKG_INSTALL_ROOT}/nsr ${PKG_INSTALL_ROOT}/nsr.old ln -s ${NSR_HOME} ${PKG_INSTALL_ROOT}/nsr fi fi } #============================================================================== # Function: create_servers # Summary: create the servers file #============================================================================== create_servers() { echo "Creating the /nsr/res/servers file" if [ ! -d ${PKG_INSTALL_ROOT}/${NSR_HOME}/res ]; then mkdir ${PKG_INSTALL_ROOT}/${NSR_HOME}/res fi cat>${PKG_INSTALL_ROOT}/${NSR_HOME}/res/servers<> ${PKG_INSTALL_ROOT}/${NSR_HOME}/res/servers done } #============================================================================== # Function: create_scripts # Summary: create startup script and symlinks to rc directories #============================================================================== create_scripts() { echo "Creating ${PRODUCT_NAME} start/stop scripts" if [ $PKGINST = LGTOclnt ]; then NSREXECD=${CLIENT_BASEDIR}/sbin/nsrexecd LGTOLMD=${CLIENT_BASEDIR}/sbin/lgtolmd NSRD=${CLIENT_BASEDIR}/sbin/nsrd NSR_SHUTDOWN=${CLIENT_BASEDIR}/sbin/nsr_shutdown CLUSTER=${CLIENT_BASEDIR}/sbin/NetWorker.clustersvr NSRWIZRES=${CLIENT_BASEDIR}/sbin/nsrwreg else NSREXECD=${CLIENT_BASEDIR}/sbin/nsr/nsrexecd LGTOLMD=${CLIENT_BASEDIR}/sbin/lgtolmd NSRD=${CLIENT_BASEDIR}/sbin/nsr/nsrd NSR_SHUTDOWN=${CLIENT_BASEDIR}/sbin/nsr/nsr_shutdown CLUSTER=${CLIENT_BASEDIR}/sbin/nsr/NetWorker.clustersvr NSRWIZRES=${CLIENT_BASEDIR}/sbin/nsr/nsrwreg fi # create /etc/init.d/networker cat>${PKG_INSTALL_ROOT}/etc/init.d/networker< /dev/console if [ -x "\${NSREXECD}" ]; then if [ -f "\${CLUSTER}" ]; then if [ -f "\${PKG_INSTALL_ROOT}/nsr.NetWorker.local" -o -h "\${PKG_INSTALL_ROOT}/nsr.NetWorker.local" ]; then if [ -h "\${PKG_INSTALL_ROOT}/nsr" ]; then rm -f \${PKG_INSTALL_ROOT}/nsr ln -s \${PKG_INSTALL_ROOT}/nsr.NetWorker.local \${PKG_INSTALL_ROOT}/nsr fi fi fi (\${NSREXECD}) > /dev/console 2>&1 (echo ' nsrexecd') > /dev/console fi if [ -x "\${LGTOLMD}" ]; then (\${LGTOLMD} -p /nsr/lic -n 1) > /dev/console 2>&1 (echo ' lgtolmd') > /dev/console fi if [ -x "\${NSRD}" -a ! -f "\${CLUSTER}" ]; then (\${NSRD}) > /dev/console 2>&1 (echo ' nsrd') > /dev/console fi if [ -x "\${NSRWIZRES}" ]; then (\${NSRWIZRES}) > /dev/console 2>&1 fi ;; 'stop') (echo 'stopping ${PRODUCT_NAME} daemons:') > /dev/console if [ -x "\${NSR_SHUTDOWN}" ]; then (\${NSR_SHUTDOWN} -q) > /dev/console 2>&1 (echo ' nsr_shutdown -q') > /dev/console fi ;; *) echo "usage: \`basename \$0\` {start|stop}" ;; esac ! chmod 744 ${PKG_INSTALL_ROOT}/etc/init.d/networker # create the sym links ln -s /etc/init.d/networker ${PKG_INSTALL_ROOT}/etc/rc2.d/S95networker ln -s /etc/init.d/networker ${PKG_INSTALL_ROOT}/etc/rc0.d/K05networker } #============================================================================== # Function: clnt_add_rpc # Summary: add entries to /etc/rpc #============================================================================== clnt_add_rpc() { echo "Adding ${PRODUCT_NAME} entries to /etc/rpc" file=${PKG_INSTALL_ROOT}/etc/rpc # add entries for rap searchstr='^rap' grep "${searchstr}" ${file} > /dev/null 2>&1 if [ $? -ne 0 ]; then cat >>${file} <<-! rap 390101 rapla rapserv 390102 raprd ! fi # add entries for nsr searchstr='^nsr' grep "${searchstr}" ${file} > /dev/null 2>&1 if [ $? -ne 0 ]; then cat >>${file} <<-! nsrd 390103 nsr nsrmmd 390104 nsrmm nsrindexd 390105 nsrindex nsrmmdbd 390107 nsrmmdb nsrstat 390109 nsrjb 390110 nsrjbd nsrexec 390113 nsrexecd nsrlcpd 390429 nsrlcpd nsrmmgd 390430 nsrmmgd nsrjobd 390433 ! fi # add entries for hagent searchstr='^hagent' grep "${searchstr}" ${file} > /dev/null 2>&1 if [ $? -ne 0 ]; then cat >>${file} <<-! hagentd 390427 ! fi } #============================================================================== # Function: start_daemons # Summary: create the servers file #============================================================================== start_daemons() { if [ "X${RESTART_DAEMONS}" = "Xyes" ]; then echo "Starting the ${PRODUCT_NAME} daemons" /etc/init.d/networker start fi } #============================================================================== # Function: main #============================================================================== create_nsrhome create_servers create_scripts clnt_add_rpc start_daemons exit 0