#! /bin/sh # # $Id: nw_clnt_request.SunOS,v 1.3.64.1 2005/11/14 19:53:16 audec 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" # default request script values NSR_HOME=/var/nsr NSR_SERVERS="" RESTART_DAEMONS=no #=============================================================================== # Function: ask_nsrhome # Summary: prompt for location of nsrhome and set NSR_HOME #=============================================================================== ask_nsrhome() { fmt<<-! To setup ${PRODUCT_NAME} you need to specify a directory to store various data files in. For a ${PRODUCT_NAME} client or storage node the default directory of ${NSR_HOME} is acceptable. However, for a ${PRODUCT_NAME} server, this directory can become quite large and should reside on a big enough file system. Below is a list of file systems which you might consider: File system Free space in KB ! df -kl | grep "^/dev" | sort -k 4 -rn | awk '{printf("%-30s %10s\n",$6,$4)}' # use existing NSR_HOME if one exists [ -d /nsr ] && NSR_HOME=/nsr [ -h /nsr ] && NSR_HOME=`ls -l /nsr | awk '{print $11}'` while true; do nsrhome=`ckpath -Q -a -p "Enter a ${PRODUCT_NAME} data directory (default=${NSR_HOME})" -d ${NSR_HOME}` # check to see if directory is on a local file system dir=${nsrhome} while [ ! -d ${dir} ]; do dir=`dirname ${dir}` done if [ `df -n ${dir} | awk '{print $3}'` = "nfs" ]; then echo "ERROR: ${nsrhome} is not on a local file system" continue fi NSR_HOME=${nsrhome} break; done } #=============================================================================== # Function: ask_servernames # Summary: prompt for list of authorized servers and set NSR_SERVERS #=============================================================================== ask_servernames() { if [ -f ${NSR_HOME}/res/servers ]; then old_list=`grep -v "^#" ${NSR_HOME}/res/servers` fmt<<-! The ${PRODUCT_NAME} client currently restricts access to the following list of ${PRODUCT_NAME} servers: ! echo "${old_list}" RESULT=`ckyorn -Q -p "Do you want to replace this list with a different list? (default=no)" -d no` if [ `expr ${RESULT} : [nN]` -ne 0 ]; then echo "The list of allowed ${PRODUCT_NAME} servers will be preserved." new_list="" # values in old_list are newline separated, # convert to space separated values for server in ${old_list}; do new_list="${new_list} ${server}" done NSR_SERVERS=`echo ${new_list} | cut -c 1-` return fi echo "The list of allowed ${PRODUCT_NAME} servers will be replaced." fi fmt<<-! The ${PRODUCT_NAME} client restricts access to a select set of ${PRODUCT_NAME} servers. Please enter the names of each computer running a ${PRODUCT_NAME} server that will back up this computer, one name at a time. If a computer has more than one network interface, please enter each interface's name (one at a time). ! new_list="" while true; do echo "Enter a ${PRODUCT_NAME} server hostname [no more]: \c" read server if [ -z "${server}" ]; then break fi if [ `expr "${server}" : ".* "` -ne 0 ]; then echo "Please enter one name at a time." elif [ "X${server}" = "Xall" ]; then new_list="" break else new_list="${new_list} ${server}" fi done if [ -z "${new_list}" -o "X${server}" = "Xall" ]; then echo "Allowing access to all ${PRODUCT_NAME} servers." fi NSR_SERVERS=`echo ${new_list} | cut -c 1-` } #=============================================================================== # Function: ask_restartdaemons # Summary: prompt whether to restart daemons and set RESTART_DAEMONS #=============================================================================== ask_restartdaemons() { RESULT=`ckyorn -Q -p "Restart ${PRODUCT_NAME} daemons at end of install? (default=${RESTART_DAEMONS})" -d ${RESTART_DAEMONS}` if [ `expr ${RESULT} : [yY]` -ne 0 ]; then RESTART_DAEMONS=yes else RESTART_DAEMONS=no fi } #=============================================================================== # Function: main #=============================================================================== if [ "X${PKG_INSTALL_ROOT}" = "X/a" ]; then echo "JumpStart installation detected, using defaults" else ask_nsrhome ask_servernames ask_restartdaemons fi cat >$1 <