#!/bin/sh # $Revision: 1.104 $ #*************************************************************************** # $Copyright: Copyright 1993 - 2012 Symantec Corporation, All Rights Reserved $ #*************************************************************************** # # The following variable is changed by package_all.sh to a valid value. # RELEASE_LEVEL=7.5 trap trapped 1 2 3 15 trapped () { $ECHO " File ${Trace_File} contains a trace of this install." rm -f /${PKG_INSTALL_ROOT}/tmp/nb_telem_ans rm -f ${TMPDIR}/telem_output.$$ rm -f ${TMPDIR}/cdrom_install.$$.status exit 1 } # INSERT fn.set_echo_var #----- $Id: fn.set_echo_var,v 1.5 2007/12/13 15:10:03 $ ----- # # This function is a case statement sets # the ECHO variable # with the appropriate path & flags. #Define Echo to allow escape characters case "`uname -s`" in Darwin) eoslevel=`uname -r | cut -f1 -d"."` if [ "${eoslevel}" -ge "9" ] ; then ECHO="echo" else ECHO="echo -e" fi ;; FreeBSD) ECHO="echo -e" ;; Linux*) unset POSIXLY_CORRECT ECHO="/bin/echo -e" ;; SunOS*) ECHO="/usr/bin/echo" ;; *) ECHO="echo" ;; esac # INSERT fn.prompt #----- $Id: fn.prompt,v 1.2 2004/11/22 20:01:21 $ ----- # Prompt () - determines the flags to use to print # a line without a newline char # # *** This function uses the set_echo_var function -${ECHO} to # define the Prompt function. # # calling signature - Prompt "some string" # return value - none case "`${ECHO} 'x\c'`" in 'x\c') Prompt() { ${ECHO} -n "$*" } ;; x) Prompt() { ${ECHO} "$*\c" } ;; *) Prompt() { ${ECHO} -n "$*" } ;; esac # INSERT fn.confirm #----- $Id: fn.confirm,v 1.5 2004/11/22 20:01:21 $ ----- # # confirm () - Takes three parameters: # 1: "y" or "n" to be displayed as the default # 2: a prompt string to be displayed to the user # 3: help text string (optional) # # It is expected that the Trace_File variable # has been set to a file or /dev/null. # # *** This function uses the Prompt function # which uses the set_echo_var function - ${ECHO}. # # calling signature: confirm y "some string" [ "help text" ] # or # confirm n "some string" [ "help text" ] # # returns: 0 for Yes, 1 for No confirm () { help=${3} Q="" if [ -n "${help}" ]; then Q=",?" fi Prompt "${2} [y,n${Q}] (${1}) " valid=0 until [ ${valid} -ne 0 ] do #read ans and if it is empty, initialize it with the default read ans : ${ans:=${1}} #write to the tracefile ${ECHO} ${ans} >> ${Trace_File} case "${ans}" in Y*|y*) valid=1 return 0 ;; N*|n*) valid=1 return 1 ;; ?*) ${ECHO} "" ${ECHO} ${help} ${ECHO} "" Prompt "${2} [y,n${Q}] (${1}) " ;; *) ${ECHO} "" Prompt "${ans} is invalid input. Enter [y,n${Q}] (${1}) " ;; esac done } # INSERT fn.get_number #----- $Id: fn.get_number,v 1.3 2004/11/22 20:01:21 $ ----- # # get_number () - Takes four parameters, three are mandatory. # Parameter one: string displayed to the user # two: minimum value # three: maximum value # four (optional): default # # The input must be a number inbetween the min and max. # The number is placed in the VALUE variable. # *** This function uses the Prompt function and the prompt # function uses the set_echo_var function - ${ECHO}. # *** It is expected that the Trace_File variable has been # set to a file or /dev/null. # # calling signature: # get_number "some string" min_value max_value -d default_value # or # get_number "some string" min_value max_value get_number () { #grab the default param if given if [ $# -gt 4 ] ; then if [ "${4}" = "-d" ] ; then defaultNum=${5} else defaultNum="none" fi else defaultNum="none" fi valid=0 until [ ${valid} -ne 0 ] do if [ ${defaultNum} = "none" ] ; then Prompt "${1} [${2} - ${3}]: " else Prompt "${1} [${2} - ${3}] (default: ${defaultNum}): " fi read VALUE #read ans and if it is empty, initialize it with the default VALUE=${VALUE:=${defaultNum}} if [ ${VALUE} = "none" ] ; then ${ECHO} "" >> ${Trace_File} #this way "none" won't be written else ${ECHO} ${VALUE} >> ${Trace_File} fi #check to see if input is really a number echo ${VALUE} | egrep -e \(\^[0-9]\+\$\) > /dev/null #if a number & in range if [ $? -eq 0 ] ; then if [ ${VALUE} -ge ${2} -a ${VALUE} -le ${3} ] ; then return fi fi if [ "${VALUE}" != "none" ] ; then #this handles so that "none" won't be printed to the screen ${ECHO} "ERROR: ${VALUE} is invalid input. Please try again." ${ECHO} "" fi done } # INSERT fn.is_cmd_in_path # # is_cmd_in_path is used to test if a command is accessible # from somewhere in $PATH (it doesn't matter where). If it # is, 0 is returned. If the command can't be found within # any of the directories in $PATH, 1 is returned. Call the # function with the command of interest. For example, # is_cmd_in_path gunzip # # On some platforms, the while/read puts you in a subshell # and using return in the while won't actually exit out of # the function (hence the usage of a tmp file). # is_cmd_in_path () { cmd="${1}" rm -f ${TMPDIR}/is_cmd_in_path.$$ ${ECHO} "${PATH}" | tr ':' '\012' | \ while read cpath do if [ -x "${cpath}"/"${cmd}" ] ; then ${ECHO} 0 >> ${TMPDIR}/is_cmd_in_path.$$ break fi done if [ -s ${TMPDIR}/is_cmd_in_path.$$ ] ; then rm -f ${TMPDIR}/is_cmd_in_path.$$ return 0 fi return 1 } # INSERT fn.check_for_vsm #----- $Id: fn.check_for_vsm,v 1.5 2010/07/16 20:51:47 $ # # Checks to see if VSM is present on the machine. You cannot # upgrade a machine containing VSM to NB 7.0 or beyond. # Display the options and point the user to the instructions # on how to uninstall VSM. # # PKG_OPTION and PKG_INSTALL_ROOT are expected to be set by # the caller. check_for_vsm () { old_hsm_list="" # See if we are on a solaris sparc machine before running # pkginfo. Any OS level checks should have already been done. my_os=`uname -s` proc_type=`uname -p 2>/dev/null` if [ "${my_os}" = "SunOS" -a "${proc_type}" = "sparc" ] ; then # # List of all Storage Migrator related package names # we've used. Upgrading a machine with Storage Migrator # on it is not allowed starting with NB 7.0. # for package in SYMCsmhsm SYMCsmvcs VRTSsmhsm \ VRTSsmvcs SUNWhsmee do full_hsm_list="`pkginfo ${PKG_OPTION} ${package}.* 2>/dev/null | cut -f2 -d\" \" | sort -r`" for pkg in ${full_hsm_list} do old_hsm_list="${old_hsm_list} ${pkg}" done done fi if [ "${old_hsm_list}" != "" -o -f /usr/openv/hsm/version -o \ -d /usr/openv/hsm ] ; then ${ECHO} " It appears you have NetBackup Storage Migrator related products installed on this machine. This machine cannot be upgraded to NetBackup 7.0 or later. There are two options: 1. Leave this machine at the existing level of NetBackup. 2. Unmigrate all files, uninstall the NetBackup Storage Migrator related products, then upgrade the machine to NetBackup 7.0 or later. The process to accomplish these steps is documented in file VSM_README which is at the top of Solaris Sparc server media, HP PARISC server media and in the NetBackup Installation Guide for Unix and Linux. " if [ "${old_hsm_list}" != "" ] ; then num=`${ECHO} ${old_hsm_list} | wc -w | sed s/' '/''/g | cut -f1 -d" "` plural="" if [ ${num} -gt 1 ] ; then plural="s" fi ${ECHO} " You have the following NetBackup Storage Migrator related product${plural} installed: " ${ECHO} ${old_hsm_list} | /usr/bin/tr ' ' '\n' if [ -n "${PKG_INSTALL_ROOT}" ] ; then ${ECHO} " NOTE: These addon packages did not support being installed into an alternate root environment via pkgadd -R. Therefore, they cannot be removed via pkgrm -R. You must reboot with ${PKG_INSTALL_ROOT} as the running root in order to remove them. " fi fi return 1 fi return 0 } # INSERT fn.set_tar_options #----- $Id: fn.set_tar_options,v 1.13 2010/01/06 21:24:28 $ ----- # # This function takes one parameter, a # string which is the MACHINE or platform type. # It sets two variables: TAR_C_OPTIONS and # TAR_X_OPTIONS # # NOTE: The v flag is not handled in this function. If you want # to add the v flag, you need to set it in your scripts. # For example, place the v before the variable like so, v${TAR_X_OPTIONS}. # # calling signature: # set_tar_options "MachineType" set_tar_options () { case "${1}" in HP* | hp* ) TAR_C_OPTIONS="cfA" #c - create new archive #f - use given filename #A - suppress warning messages for ACL entries TAR_X_OPTIONS="xpfA" #x - extract #p - use original tarred file protection properties #f - use given filename #A - suppress warning messages for ACL entries ;; * ) TAR_C_OPTIONS="cf" #c - create new archive #f - use given filename TAR_X_OPTIONS="xpf" #x - extract #p - use original tarred file protection propeties #f - use given filename ;; esac } # INSERT fn.unbundle_pkg #----- $Id: fn.unbundle_pkg,v 1.6 2011/05/09 21:34:13 $ # # unbundle_pkg is used to unbundle a tar.gz file such as # client_bin.tar.gz. The .gz file could contain the traditional # gzip/tar format or the native package format. It is decided # by platform which is which for now. Three variables are expected # to be passed by the caller. A fourth parameter is possible for # Sun platforms only if installing to an alternate root. # # 1) The full path to the gz file. ie. /.gz # 2) The native packaging name. ie. SYMCnbclt # 3) The full path to a trace file for only the native commands. If # this function fails, the caller appends that special file to # the normal trace so all info is available. Otherwise, the special # file is just mentioned in case extra information is desired. # If the .gz file is in traditional format, this file is not created. # 4) Optional and for Sun platforms only. Pass in the alternate root option. # # TMPDIR, MACHINE, ECHO, TAR, etc. are expected to be set already. # Daemons are expected to already be down. # # If all went well, unbundle_pkg returns 0. If any kind of problem occurred, # it returns 1. The informative error message is issued here. The caller # only needs to abort if a 1 was returned. unbundle_pkg () { if [ $# -ne 3 -a $# -ne 4 ] ; then ${ECHO} " The full path to the .tar.gz file, the native package name to be queried for and/or the special trace file are missing from the call to unbundle_pkg. Aborting..." return 1 elif [ ! -f "${1}" ] ; then ${ECHO} " File ${1} does not exist and cannot be unbundled. Aborting..." return 1 fi gzip_file="${1}" pkgname="${2}" pkg_trace="${3}" pkg_dir=${TMPDIR}/nb_pkg alt_root_opt="" if [ "${4}" != "" ] ; then alt_root_opt="${4}" fi query_cmd="" unbundle_cmd="gunzip -c ${gzip_file}" tar_cmd="${TAR} v${SPEC_TAR_OPT}${TAR_X_OPTIONS} -" awk_command="awk '{print \$4}'" DF="/usr/bin/df -k" gzip_dir=`dirname ${gzip_file}` is_really_gzip=1 ${ECHO} ${gzip_file} | grep '\.tar\.gz' > /dev/null 2>&1 if [ $? -ne 0 ] ; then is_really_gzip=0 pkg_dir=${gzip_dir} fi case "${MACHINE}" in HP*) query_cmd="swlist" rm_cmd="swremove -x mount_all_filesystems=false -x enforce_dependencies=false" inst_cmd="swinstall -x mount_all_filesystems=false -s ${pkg_dir}/${pkgname}.depot" DF="/usr/bin/df -b" awk_command="awk '{print \$( NF - 2 )}'" ;; Linux* | LINUX* | ZLINUX*) if [ ! -f /etc/debian_version -o `uname -m` != "x86_64" ] ; then query_cmd="rpm -q" rm_cmd="rpm -vv -e" inst_cmd="rpm -vv -U ${pkg_dir}/" #-P option prevents line wrap on linux DF="/bin/df -kP" fi ;; RS6000) query_cmd="lslpp -L" rm_cmd="installp -u" inst_cmd="installp -a -d ${pkg_dir}" awk_command="awk '{print \$3}'" ;; Solaris | SOLARIS*) query_cmd="pkginfo ${alt_root_opt}" rm_cmd="${ECHO} y | pkgrm -n ${alt_root_opt} -a ${pkg_dir}/.pkg_defaults" inst_cmd="pkgadd ${alt_root_opt} -a ${pkg_dir}/.pkg_defaults -d ${pkg_dir}/${pkgname}.pkg" ;; esac if [ "${query_cmd}" != "" -a ${is_really_gzip} -eq 1 ] ; then # Check to see if the .gz file has been updated by a patch. # If it has, the .gz file is now in tar ball format and # the key variables (query_cmd, unbundle_cmd and tar_cmd) # need to be reset. Intentionally use /bin/tar here as # "our" tar puts that output on stderr and grep misses it. gunzip -c ${gzip_file} | /bin/tar tf - | grep ${pkgname} > /dev/null 2>&1 if [ $? -ne 0 ] ; then query_cmd="" unbundle_cmd="gunzip -c ${gzip_file}" tar_cmd="${TAR} v${SPEC_TAR_OPT}${TAR_X_OPTIONS} -" fi fi # If query_cmd is not set, then the .gz file does not contain # a native package, so we do it the old way and unbundle # right into /usr. If query_cmd is set, the .gz file # contains a native package and a series of events needs # to happen. if [ "${query_cmd}" = "" ] ; then # # Must redirect stderr to stdout as the tar used for Linux # clients uses stderr. In the install_clients scenario, # client_config's stderr output is saved off for a status # check and we lose our output unless this redirect is done. # ${unbundle_cmd} | eval ${tar_cmd} 2>&1 if [ $? -ne 0 ] ; then ${ECHO} " tar failed unpacking ${gzip_file} on `hostname`. Cannot complete the install. Aborting..." return 1 fi else rm -f ${pkg_trace} if [ ${is_really_gzip} -eq 1 ] ; then # Do a space check on the directory before trying # to do anything. Don't want to remove the existing # package if I can't put the new one down. # # Each .tar.gz file has an accompanying .sizes file # that contains the total kbytes required to unbundle # it. Add an extra kbyte as a fudge factor. size_file=.sizes_`basename ${gzip_file} .tar.gz` dir_space=`cat ${gzip_dir}/${size_file}` dir_space=`expr ${dir_space} + 1` top_pkg_dir=`dirname ${pkg_dir}` dir_avail=`(cd ${top_pkg_dir}; ${DF} . | tail -1 | eval "${awk_command}")` if [ ${dir_avail} -lt ${dir_space} ] ; then ${ECHO} " There are ${dir_avail} kbytes of space in ${top_pkg_dir} which is not enough to complete the installation. About ${dir_space} kbytes of space is required. Aborting..." return 1 fi # Make sure no other installation has already started. if [ -d ${pkg_dir} ] ; then ${ECHO} " Directory ${pkg_dir} already exists. Another installation may already be in progress on `hostname`. Cannot complete the install. Aborting..." return 1 else mkdir ${pkg_dir} if [ $? -ne 0 ] ; then ${ECHO} " Unable to create directory ${pkg_dir}. Cannot complete the install. Aborting..." return 1 fi fi # Create a trace file for the native packaging commands. touch ${pkg_trace} # Unbundle the .tar.gz file so the native package # is exposed. ( cd ${pkg_dir} ${ECHO} " Unpacking ${pkgname} package." ${ECHO} " ========== Unpacking package ==========" >> ${pkg_trace} ${unbundle_cmd} | ${tar_cmd} >> ${pkg_trace} 2>&1 ) if [ $? -ne 0 ] ; then ${ECHO} " tar failed unpacking ${gzip_file} on `hostname`. Cannot complete the install. Aborting..." rm -rf ${pkg_dir} return 1 fi fi # In case the unpacking step was not needed, create a trace # file for the native packaging commands. touch ${pkg_trace} # See if the package has already been installed. # If it wasn't, issue a generic message as some # platforms put out an error if the package queried # for isn't installed and it looks alarming. ${ECHO} "Checking for pre-existing ${pkgname} package." ${ECHO} " == Checking for pre-existing package ==" >> ${pkg_trace} query_ans="`${query_cmd} ${pkgname} 2>&1`" if [ $? -ne 0 ] ; then ${ECHO} "package ${pkgname} is not installed" >> ${pkg_trace} else ${ECHO} "${query_ans}" >> ${pkg_trace} # Remove the existing package from the system. ${ECHO} "Removing pre-existing ${pkgname} package." ${ECHO} " ==== Removing pre-existing package ====" >> ${pkg_trace} eval ${rm_cmd} ${pkgname} >> ${pkg_trace} 2>&1 if [ $? -ne 0 ] ; then ${ECHO} " Removal of package ${pkgname} was unsuccessful. Aborting..." if [ ${is_really_gzip} -eq 1 ] ; then rm -rf ${pkg_dir} fi return 1 fi fi # Now install the native package. ${ECHO} "Installing ${pkgname} package." ${ECHO} " ========= Installing package ==========" >> ${pkg_trace} ${ECHO} ${inst_cmd} | grep rpm > /dev/null 2>&1 if [ $? -eq 0 ] ; then ${inst_cmd}${pkgname}.rpm >> ${pkg_trace} 2>&1 else # Sun server packages ask questions which the user # won't see if we stuff stdout and stderr into the # trace file. Let the output show and it will be # caught by the calling install script. if [ "${pkgname}" = "SYMCnetbp" -a \ \( "${MACHINE}" = "SOLARIS" -o "${MACHINE}" = "SOLARIS_X86" \) ] ; then ${inst_cmd} ${pkgname} else ${inst_cmd} ${pkgname} >> ${pkg_trace} 2>&1 fi fi if [ $? -ne 0 ] ; then ${ECHO} " Failed to install ${pkgname} on `hostname`. Cannot complete the install. Aborting..." if [ ${is_really_gzip} -eq 1 ] ; then rm -rf ${pkg_dir} fi return 1 fi if [ ${is_really_gzip} -eq 1 ] ; then rm -rf ${pkg_dir} fi fi return 0 } # INSERT fn.execute_telemetry #----- $Id: fn.execute_telemetry,v 1.9 2011/12/08 16:20:43 $ # # See if telemetry data is ok to post and collect the # data. Only ask on initial installs or if previous answer # was no and there's been a major/minor version level change. # Save the answer off in /tmp for now. Eventually, the answer # will be saved in bp.conf. # # The path to the telemetry executable is passed in as parameter 1. # Parameter 2 is whether to suppress the question from possibly # being asked. Only to be used for addon packages such as # DataStore or the LPs as the NB install should have already # provided an answer and if not, we still don't want to prompt. # Optional 3rd parameter is for an option passed to telemetry. # Only used by addon packages such as DataStore or the LPs. # # RELEASE_LEVEL, PKG_INSTALL_ROOT, ECHO and Native_locale are # expected to be set already. # execute_telemetry () { telem_path="${1}" suppress="${2}" telem_option="${3}" telem_upload="--upload" # Check for an answer file in /tmp first. If it exists, # the question was asked already but never was saved off # in bp.conf yet. This answer takes precedence. If no # answer file in /tmp, check for an entry in bp.conf. If # it exists and the answer was no, see if the NetBackup # major/minor version level has changed (true upgrade). # If so, ask them again. ask_me="n" ans="Y" if [ -f /${PKG_INSTALL_ROOT}/tmp/nb_telem_ans ] ; then ans=`/usr/bin/tr -d ' \011' < /${PKG_INSTALL_ROOT}/tmp/nb_telem_ans | \ head -1 | cut -f2 -d"=" | tr "[:lower:]" "[:upper:]"` else if [ -f /${PKG_INSTALL_ROOT}/usr/openv/netbackup/bp.conf ] ; then ans=`/usr/bin/tr -d ' \011' < /${PKG_INSTALL_ROOT}/usr/openv/netbackup/bp.conf | \ grep "^TELEMETRY_UPLOAD=" | head -1 | cut -f2 -d"=" | tr "[:lower:]" "[:upper:]"` if [ "${ans}" = "" ] ; then ask_me=y elif [ "${ans}" = "N" -o "${ans}" = "NO" ] ; then this_abbr_level=`expr ${RELEASE_LEVEL} : '\([0-9.]*\)' | cut -f1,2 -d"."` abbr_old_server_level=0 if [ -f /${PKG_INSTALL_ROOT}/usr/openv/netbackup/version ] ; then tmp_old_release=`head -2 /${PKG_INSTALL_ROOT}/usr/openv/netbackup/version | tail -1 | cut -f3 -d" "` old_server_level=`expr ${tmp_old_release} : '\([0-9.]*\)'` abbr_old_server_level=`${ECHO} ${old_server_level} | cut -f1,2 -d"."` fi if [ "${abbr_old_server_level}" != "${this_abbr_level}" ] ; then ask_me=y fi fi else ask_me=y fi fi if [ "${ask_me}" = "y" -a "${suppress}" = "nosuppress" ] ; then if confirm y " Participate in the NetBackup Product Improvement Program?" then ${ECHO} "TELEMETRY_UPLOAD=YES" > /${PKG_INSTALL_ROOT}/tmp/nb_telem_ans ans=Y else ${ECHO} "TELEMETRY_UPLOAD=NO" > /${PKG_INSTALL_ROOT}/tmp/nb_telem_ans ans=N fi fi # ans can be nothing if suppressing for addons. if [ "${ans}" = "N" -o "${ans}" = "NO" -o "${ans}" = "" ] ; then telem_upload="" fi rm -f ${TMPDIR}/telem_output.$$ ( umask 0077 ; LC_ALL=${Native_locale} ${telem_path}/telemetry --collector=nb-install ${telem_upload} ${telem_option} >> ${TMPDIR}/telem_output.$$ 2>&1 ) if [ -s ${TMPDIR}/telem_output.$$ ] ; then ${ECHO} "" ${ECHO} "NOTE:" cat ${TMPDIR}/telem_output.$$ fi rm -f ${TMPDIR}/telem_output.$$ ${ECHO} "" } # INSERT fn.save_locale #----- $Id: fn.save_locale,v 1.5 2011/10/11 15:27:42 $ ----- # # Get_Original_locale () - Assumes that LC_ALL, LANG or LC_MESSAGES must # be set to the locale of interest. If not just # use C. # # Scripts that start daemons should call Set_C_locale instead of doing # their own setting of LC_ALL. # Later calls to start daemons should be of the form: # # LC_ALL=$Native_locale the_daemon Its_options Get_Original_locale () { if [ "${Native_locale}" = "" ] ; then Native_locale=`locale | grep LC_ALL | awk -F"=" '{print $2}' | sed 's/\"//g'` if [ "$Native_locale" = "" ] ; then Native_locale=`locale | grep LC_MESSAGES | awk -F"=" '{print $2}' | sed 's/\"//g'` if [ "$Native_locale" = "" ] ; then Native_locale=`locale | grep LANG | awk -F"=" '{print $2}' | sed 's/\"//g'` if [ "$Native_locale" = "" ] ; then Native_locale=C fi fi fi export Native_locale fi } Set_C_locale () { Get_Original_locale LC_ALL=C export LC_ALL } # # To have a nice complete trace, most of the program is executed in a # subshell. In order to preserve any exit status from within the subshell, # we need to put it into something visible when the subshell goes away. # # Exit status of 5 is an abort of some nature but we do not want to run # telemetry at this point. Used for OpsCenter menu options and some early # install checks. wrap_up () { if [ -f ${MY_CD_PATH}/${PLATFORM}/catalog/anb/telemetry -a "${1}" != "5" ] ; then execute_telemetry ${MY_CD_PATH}/${PLATFORM}/catalog/anb nosuppress fi rm -f ${TMPDIR}/cdrom_install.$$.status ${ECHO} ${1} >> ${TMPDIR}/cdrom_install.$$.status exit } choose_boot_environment () { # Ensure that if an inactive boot environment is specified, # it is mounted and includes etc, var, usr, tmp. # Inactive boot environment install: PKG_INSTALL_ROOT set # LOCAL_INSTALL="" # Active boot environment install: PKG_INSTALL_ROOT="" # LOCAL_INSTALL=1 LOCAL_INSTALL=1 if confirm y " NetBackup installs to the running root environment, by default. Are you installing to the running root environment?" then return else ${ECHO} " You have chosen to install to an alternate root environment. The alternate root environment must be mounted for access and it must contain etc, var, usr, and tmp subdirectories. For example, if you specify the alternate root path to be /alt, then /alt/etc, /alt/var, /alt/usr and /alt/tmp must exist. NetBackup will be installed relative to /alt rather than the default root path '/'. " REPLY="" while [ "$REPLY" = "" ]; do Prompt " Enter alternate root path (or q to quit): " read REPLY ${ECHO} "${REPLY}" >> ${Trace_File} done if [ "${REPLY}" = "q" -o "${REPLY}" = "Q" ]; then wrap_up 1 fi # Set PKG_INSTALL_ROOT, stripping off any leading "/" # Allows the user to specify with or without leading "/" # and one "/" is safely prepended in later references. PKG_INSTALL_ROOT=`${ECHO} $REPLY | sed -e 's/^\/*//'` LOCAL_INSTALL="" if [ ! -d /${PKG_INSTALL_ROOT}/etc -o \ ! -d /${PKG_INSTALL_ROOT}/var -o \ ! -d /${PKG_INSTALL_ROOT}/usr -o \ ! -d /${PKG_INSTALL_ROOT}/tmp ]; then ${ECHO} " /${PKG_INSTALL_ROOT}/etc, /${PKG_INSTALL_ROOT}/var /${PKG_INSTALL_ROOT}/usr and /${PKG_INSTALL_ROOT}/tmp must exist!" wrap_up 1 fi fi } report_any_old_extras () { stop=0 # # List of all SYMC, VRTS and SUNW addon package names we've used # that have been folded into the NetBackup server or client package. # HSM, NB and MM are not looked for here. Put the ones that # other packages depend on last on the list (like sfa, fis etc). # Since we need to go backwards from newest to oldest, the SYMC # list (6.1+) needs to be first. # pkg_list="SYMCnbadc SYMCnbbbs SYMCnbbmr SYMCnbdb2 SYMCnbdmp SYMCnbenc SYMCnbinx SYMCnblot SYMCnblua SYMCnbora SYMCnbsap SYMCnbsnc SYMCnbsyb SYMCnbvlt SYMCqqnb VRTSnbadc VRTSnbaro VRTSnbbbs VRTSnbbli VRTSnbbmr VRTSnbdb2 VRTSnbdba VRTSnbdmp VRTSnbefi VRTSnbenc VRTSnbfsh VRTSnbgdm VRTSnbinx VRTSnblot VRTSnbodm VRTSnbora VRTSnbovf VRTSnbsap VRTSnbsyb VRTSnbtrk VRTSnbu56 VRTSnbvlt VRTSnbfis VRTSnbsfa VRTSnbu40 VRTSqqnb SUNWmmmhd SUNWnbafs SUNWnbaro SUNWnbbli SUNWnbdb2 SUNWnbdmp SUNWnbeio SUNWnbemc SUNWnbfsh SUNWnbgdm SUNWnbinx SUNWnblot SUNWnbobo SUNWnbora SUNWnbovf SUNWnbsap SUNWnbsyb SUNWnbtrk SUNWnbu56 SUNWnbfis SUNWnbsfa SUNWnbu40" old_extras_list="" for package in ${pkg_list} do full_list="`pkginfo ${PKG_OPTION} ${package}.* 2>/dev/null | cut -f2 -d\" \" | sort -r`" for pkg in ${full_list} do old_extras_list="${old_extras_list} ${pkg}" done done # Add the language packs too due to the split into server and # client. lp_pkg_list="SYMCfrnb SYMCjanb SYMCzhnb VRTSjanb VRTSzhnb SUNWjanb" old_lps_list="" for package in ${lp_pkg_list} do full_list="`pkginfo ${PKG_OPTION} ${package}.* 2>/dev/null | cut -f2 -d\" \" | sort -r`" for pkg in ${full_list} do old_lps_list="${old_lps_list} ${pkg}" done done # Add datastore too. old_dstore_pkg_list="" for package in SYMCnbsds VRTSnbsds VRTSnbbsa SUNWnbbsa do full_list="`pkginfo ${PKG_OPTION} ${package}.* 2>/dev/null | cut -f2 -d\" \" | sort -r`" for pkg in ${full_list} do old_dstore_pkg_list="${old_dstore_pkg_list} ${pkg}" done done if [ "${old_extras_list}" != "" -o "${old_lps_list}" != "" -o \ "${old_dstore_pkg_list}" != "" ] ; then num_e=`${ECHO} ${old_extras_list} | wc -w | sed s/' '/''/g | cut -f1 -d" "` num_l=`${ECHO} ${old_lps_list} | wc -w | sed s/' '/''/g | cut -f1 -d" "` num_d=`${ECHO} ${old_dstore_pkg_list} | wc -w | sed s/' '/''/g | cut -f1 -d" "` num=`expr ${num_e} + ${num_l} + ${num_d}` plural="" if [ ${num} -gt 1 ] ; then plural="s" fi ${ECHO} " You have the following optional NetBackup product${plural} installed: " if [ "${old_extras_list}" != "" ] ; then ${ECHO} ${old_extras_list} | /usr/bin/tr ' ' '\n' ${ECHO} " Starting with NetBackup 7.0, the previously listed addon products have been folded into the NetBackup server or NetBackup client package. These old packages must be removed prior to upgrading to NetBackup 7.0 or later. " fi if [ "${old_lps_list}" != "" ] ; then ${ECHO} ${old_lps_list} | /usr/bin/tr ' ' '\n' ${ECHO} " Starting with NetBackup 7.1, the previously listed addon products have been re-architectured. These old packages must be removed prior to upgrading to NetBackup 7.1 or higher." fi ${ECHO} " Removing these packages after the NetBackup server has been upgraded will remove files important to the NetBackup installation. " if [ "${old_dstore_pkg_list}" != "" ] ; then ${ECHO} ${old_dstore_pkg_list} | /usr/bin/tr ' ' '\n' ${ECHO} " The previously listed addon products should be removed prior to an upgrade. " fi if [ -n "${PKG_INSTALL_ROOT}" ]; then ${ECHO} " NOTE: These addon packages did not support being installed into an alternate root environment via pkgadd -R. Therefore, they cannot be removed via pkgrm -R. You must reboot with /${PKG_INSTALL_ROOT} as the running root in order to remove them. Quitting this script so the reboot may occur. " stop=1 else if confirm y "Do you want this script to attempt to run pkgrm on all listed packages?" then for opkg in ${old_extras_list} ${old_lps_list} ${old_dstore_pkg_list} do ${ECHO} y | pkgrm -n ${PKG_OPTION} -a ${MY_CD_PATH}/${PLATFORM}/.pkg_defaults ${opkg} > /dev/null if [ $? -ne 0 ] ; then stop=2 fi done else ${ECHO} " Quitting this script so you can remove these old packages now. " stop=1 fi fi fi return ${stop} } report_any_old_packages () { stop=0 # List of all NB server SYMC, VRTS and SUNW package names we've used. # Since we need to go backwards from newest to oldest, the SYMC # list (6.1+) needs to be first. pkg_list="SYMCnetbp VRTSnetbp VRTSmmgr SUNWnetbp SUNWmmgr" old_base_list="" for package in ${pkg_list} do full_list="`pkginfo ${PKG_OPTION} ${package}.* 2>/dev/null | cut -f2 -d\" \" | sort -r`" for pkg in ${full_list} do old_base_list="${old_base_list} ${pkg}" done done if [ "${old_base_list}" != "" ] ; then num=`${ECHO} ${old_base_list} | wc -w | sed s/' '/''/g | cut -f1 -d" "` if [ ${num} -eq 1 ] ; then verb="is" plural="" else verb="are" plural="s" fi # If there is only 1 old package and it is SYMCnetbp (and not # SYMCnetbp.x) then don't force the removal as we'll do it when # the new package is laid down. if [ ${num} -ne 1 -o "${old_base_list}" != " SYMCnetbp" ] ; then ${ECHO} " The following old package${plural} ${verb} currently installed on your system: " ${ECHO} ${old_base_list} | /usr/bin/tr ' ' '\n' ${ECHO} " Starting with NetBackup 7.5, the previously listed old packages have been re-architectured. These old packages must be removed prior to upgrading to NetBackup 7.5 or higher. Quitting this script so you can remove these old packages now. " stop=1 fi fi return ${stop} } #---------------------------- get_platform () { OS_Type=`uname -s` case $OS_Type in OSF1 | IRIX*) ${ECHO} " NetBackup ${RELEASE_LEVEL} or later is not supported on this platform. " wrap_up 5 ;; FreeBSD | Darwin) ${ECHO} " NetBackup is not supported as a server on this platform. " wrap_up 5 ;; HP*) oslevel_f1=`uname -r | cut -f2 -d"."` oslevel_f2=`uname -r | cut -f3 -d"."` # Check if this is an IA64 processor if [ `uname -m` = ia64 ] ; then if [ "${oslevel_f1}" = "11" -a "${oslevel_f2}" -ge "31" ] ; then PLATFORM=hpia64 else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is not supported on HP Itanium operating systems older than 11.31. " wrap_up 5 fi else if [ "${oslevel_f1}" = "11" -a "${oslevel_f2}" -ge "11" ] ; then os_bits=`getconf _CS_KERNEL_BITS` if [ "${os_bits}" != "64" ] ; then ${ECHO} " NetBackup ${RELEASE_LEVEL} software is only supported on HP PARISC operating systems running in 64-bit mode. " wrap_up 5 fi # Make all the checks separately to make extra # sure we don't clobber an install. We need to # abort if we either are a master or the EMM server. # Need to take into account clustering (active and # inactive) and required interface situations as well. # Chop off the domain name. if [ -f /usr/openv/netbackup/bp.conf ] ; then am_i_master=0 have_db=0 master_name=`/usr/bin/tr -d ' \011' < /usr/openv/netbackup/bp.conf | \ grep "^SERVER=" | head -1 | cut -f2 -d"=" | cut -f1 -d"."` emm_server=`/usr/bin/tr -d ' \011' < /usr/openv/netbackup/bp.conf | \ grep "^EMMSERVER" | tail -1 | cut -f2 -d"=" | cut -f1 -d"."` nb_db_path=`/usr/bin/tr -d ' \011' < /usr/openv/netbackup/bp.conf | \ grep "^VXDBMS_NB_DATA" | tail -1 | cut -f2 -d"=" | cut -f1 -d"."` cluster_name=`/usr/bin/tr -d ' \011' < /usr/openv/netbackup/bp.conf | \ grep "^CLUSTER_NAME" | tail -1 | cut -f2 -d"=" | cut -f1 -d"."` req_int_name=`/usr/bin/tr -d ' \011' < /usr/openv/netbackup/bp.conf | \ grep "^REQUIRED_INTERFACE" | tail -1 | cut -f2 -d"=" | cut -f1 -d"."` if [ "${cluster_name}" = "${master_name}" -o "${req_int_name}" = "${master_name}" ] ; then am_i_master=1 fi if [ \( "${cluster_name}" != "" -a "${cluster_name}" = "${emm_server}" \) -o \ \( "${req_int_name}" != "" -a "${req_int_name}" = "${emm_server}" \) ] ; then have_db=1 fi if [ -f /usr/openv/netbackup/bin/bpclntcmd ] ; then if [ "${emm_server}" != "" ] ; then /usr/openv/netbackup/bin/bpclntcmd -is_local_host ${emm_server} > /dev/null 2>&1 if [ $? -eq 0 ] ; then have_db=1 fi fi /usr/openv/netbackup/bin/bpclntcmd -is_local_host ${master_name} > /dev/null 2>&1 if [ $? -eq 0 ] ; then am_i_master=1 fi fi if [ -f ${nb_db_path}/NBDB.db -o -f ${nb_db_path}/BMRDB.db ] ; then have_db=1 fi # If an EMM or BMR database is found or this # machine is the master server, abort. if [ ${have_db} -eq 1 -o ${am_i_master} -eq 1 ] ; then ${ECHO} " NetBackup ${RELEASE_LEVEL} is not supported as an HP PARISC master server or a media server that contains the NetBackup EMM database. " wrap_up 5 fi fi # Display HP PARISC warning for all installs to # give the opportunity to quit now. ${ECHO} " ************************************************* IMPORTANT CHANGE FOR HP PARISC INSTALLATIONS: NetBackup ${RELEASE_LEVEL} is not supported as an HP PARISC master server or a media server that contains the NetBackup EMM database. *************************************************" PLATFORM=hp-ux else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is not supported on HP PARISC operating systems older than 11.11. " wrap_up 5 fi fi ;; AIX) OS=`oslevel | cut -f1-3 -d"." | sed -e 's/\.//g'` if [ "${OS}" -ge "530" ] ; then /usr/bin/ls -l /unix | grep unix_64 > /dev/null 2>&1 if [ $? -ne 0 ] ; then ${ECHO} " NetBackup ${RELEASE_LEVEL} software is only supported on AIX operating systems running in 64-bit mode. " wrap_up 5 fi else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is not supported on AIX operating systems older than 5.3. " wrap_up 5 fi # The default file size on AIX is 2097151 512-byte blocks # which is equivalent to 1.0GB. Need to bump up during # installation to over 2.0GB (4194304 512-byte blocks). ulimit -f unlimited fsize=`env LANG=C ulimit -f` if [ "${fsize}" != "unlimited" ] ; then ${ECHO} " Unable to modify ulimit fsize=${fsize}. Set this to 'unlimited' and retry the install." wrap_up 5 fi PLATFORM=rs6000 ;; Linux*) suse=no if [ -f /etc/SuSE-release -o -f /sbin/SuSEconfig ] ; then suse=yes fi oslevel_f1=`uname -r | cut -f1 -d"."` oslevel_f2=`uname -r | cut -f2 -d"."` oslevel_f3=`uname -r | cut -f3 -d"." | cut -f1 -d"-"` if [ "${oslevel_f3}" = "" ] ; then oslevel_f3=0 fi if [ `uname -m` = ia64 ] ; then if [ "${oslevel_f1}" -ge "3" ] || [ "${oslevel_f1}" = "2" -a "${oslevel_f2}" -ge "6" ] ; then ${ECHO} " NetBackup ${RELEASE_LEVEL} or later is only supported as a client for Linux Itanium platforms. " wrap_up 5 else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is not supported on this platform. " wrap_up 5 fi else if [ "${oslevel_f1}" -ge "3" ] || [ "${oslevel_f1}" = "2" -a "${oslevel_f2}" -ge "6" ] ; then if [ `uname -m` = "x86_64" ] ; then # In case they bump the kernel level to 2.7, need to check # for that in addition to the 2.6.x case. if [ "${suse}" = "no" ] ; then if [ "${oslevel_f1}" -ge "3" -o "${oslevel_f2}" -ge "7" -o "${oslevel_f3}" -ge "18" ] ; then PLATFORM=linuxR_x86 else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is not supported on RedHat operating systems older than 5. " wrap_up 5 fi else if [ "${oslevel_f1}" -ge "3" -o "${oslevel_f2}" -ge "7" -o "${oslevel_f3}" -ge "16" ] ; then PLATFORM=linuxS_x86 else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is not supported on SLES operating systems older than 10. " wrap_up 5 fi fi elif [ `uname -m` = "s390x" ] ; then # In case they bump the kernel level to 2.7, check # for that in addition to the 2.6.x case. if [ "${suse}" = "no" ] ; then if [ "${oslevel_f1}" -ge "3" -o "${oslevel_f2}" -ge "7" -o "${oslevel_f3}" -ge "18" ] ; then PLATFORM=zlinuxR else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is not supported on RedHat operating systems older than 5. " wrap_up 5 fi else if [ "${oslevel_f1}" -ge "3" -o "${oslevel_f2}" -ge "7" -o "${oslevel_f3}" -ge "16" ] ; then PLATFORM=zlinuxS else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is not supported on SLES operating systems older than 10. " wrap_up 5 fi fi else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is only supported on Linux x86 and zLinux operating systems running in 64-bit mode. " wrap_up 5 fi else ${ECHO} " NetBackup ${RELEASE_LEVEL} software is not supported on this platform. " wrap_up 5 fi fi #-P option prevents line wrap on linux ;; SunOS) oslevel_f1=`uname -r | cut -f1 -d"."` oslevel_f2=`uname -r | cut -f2 -d"."` min_level=10 ProcessorType=`uname -p` if [ "${ProcessorType}" = "i386" ] ; then os_type=X86 PLATFORM=solaris_x86 else os_type=sparc PLATFORM=solaris fi if [ "${oslevel_f1}" = "5" -a "${oslevel_f2}" -ge "${min_level}" ] ; then os_bits=`isainfo -nv` ${ECHO} ${os_bits} | grep "64\-bit" > /dev/null 2>&1 if [ $? -ne 0 ] ; then ${ECHO} " NetBackup ${RELEASE_LEVEL} software is only supported on Solaris ${os_type} operating systems running in 64-bit mode. " wrap_up 5 fi else ${ECHO} " NetBackup ${RELEASE_LEVEL} server software is not supported on Solaris ${os_type} operating systems older than Solaris${min_level}. " wrap_up 5 fi ;; esac } #---------------------------- choose_platform () { if [ "${PLATFORM}" = "" ] ; then $ECHO " Platform -------- 1. HP-UX 2. HP-UX IA64 3. LINUX_RH_X86 (RedHat 2.6.18) 4. LINUX_SuSE_X86 (SuSE 2.6.16) 5. RS6000 6. ZLINUX_RH (RedHat 2.6.18) 7. ZLINUX_SuSE (SuSE 2.6.16) 8. Exit from this Script" get_number "Enter Platform Type: " 1 8 case $VALUE in 1) PLATFORM=hp-ux;; 2) PLATFORM=hpia64;; 3) PLATFORM=linuxR_x86;; 4) PLATFORM=linuxS_x86;; 5) PLATFORM=rs6000;; 6) PLATFORM=zlinuxR;; 7) PLATFORM=zlinuxS;; 8) wrap_up 0;; esac fi if [ ! -d "${MY_CD_PATH}/${PLATFORM}" ] ; then $ECHO " NetBackup server software for the ${PLATFORM} platform is not on this media." wrap_up 5 fi } #---------------------------- # # Find all the products. Order is important so check for them # in the order you want them to be presented if all are found. # find_products () { is_nb_client_present=0 is_nb_server_present=0 num_products=0 if [ -d ${MY_CD_PATH}/OpsCenter ] ; then num_products=`expr ${num_products} + 1` eval product_${num_products}="OpsServer" eval name_${num_products}=\"OpsCenter Server\" if [ -d ${MY_CD_PATH}/OpsCenter/Agent ] ; then num_products=`expr ${num_products} + 1` eval product_${num_products}="OpsAgent" eval name_${num_products}=\"OpsCenter Agent\" fi fi if [ -d ${MY_CD_PATH}/hp-ux -o -d ${MY_CD_PATH}/hpia64 -o \ -d ${MY_CD_PATH}/linuxR_x86 -o -d ${MY_CD_PATH}/linuxS_x86 -o \ -d ${MY_CD_PATH}/rs6000 -o \ -d ${MY_CD_PATH}/solaris -o -d ${MY_CD_PATH}/solaris_x86 -o \ -d ${MY_CD_PATH}/zlinuxR -o -d ${MY_CD_PATH}/zlinuxS ] ; then num_products=`expr ${num_products} + 1` eval product_${num_products}="Server" eval name_${num_products}=\"NetBackup Server Software\" is_nb_server_present=1 fi if [ -d ${MY_CD_PATH}/NBClients ] ; then num_products=`expr ${num_products} + 1` eval product_${num_products}="Client" eval name_${num_products}=\"NetBackup Client Software\" is_nb_client_present=1 fi # If we found more than one product, a menu will be presented. # Add the exit option in as a choice. if [ ${num_products} -gt 1 ] ; then num_products=`expr ${num_products} + 1` eval product_${num_products}="Exit" eval name_${num_products}=\"Exit from this Script\" fi } #---------------------------- # # Based on the menu option chosen, install that product. If any # part fails, the script quits. If the install passes and more # than one product is present, return to the main menu. # install_product () { current_prod=${1} case "${current_prod}" in OpsServer) ${MY_CD_PATH}/OpsCenter/Server/installOpsCenterServer if [ $? -ne 0 ] ; then wrap_up 5 fi ;; OpsAgent) ${MY_CD_PATH}/OpsCenter/Agent/installOpsCenterAgent if [ $? -ne 0 ] ; then wrap_up 5 fi ;; Server) get_platform choose_platform if [ "${PLATFORM}" != solaris -a "${PLATFORM}" != solaris_x86 ] ; then nirvx_check ost_check usr run_pdprecheck usr check_for_vsm if [ $? -ne 0 ] ; then # Message was issued by the function. wrap_up 5 fi if [ -f ${MY_CD_PATH}/${PLATFORM}/catalog/anb/telemetry ] ; then execute_telemetry ${MY_CD_PATH}/${PLATFORM}/catalog/anb nosuppress fi ${MY_CD_PATH}/${PLATFORM}/catalog/anb/NB.inst ${Trace_File} if [ $? = 0 ] ; then ${ECHO} "Running /usr/openv/netbackup/bin/install_bp" /usr/openv/netbackup/bin/install_bp ${Trace_File} else wrap_up 1 fi else # Set LOCAL_INSTALL or PKG_INSTALL_ROOT choose_boot_environment # Kill daemons if LOCAL_INSTALL set if [ -n "${LOCAL_INSTALL}" ]; then # Find bp.kill_all. Could be in two possible spots depending # on what's installed. wheres_kill_all="" if [ -f /usr/openv/netbackup/bin/bp.kill_all ] ; then wheres_kill_all=/usr/openv/netbackup/bin elif [ -f /usr/openv/netbackup/bin/goodies/bp.kill_all ] ; then wheres_kill_all=/usr/openv/netbackup/bin/goodies fi if [ -f ${wheres_kill_all}/bp.kill_all ] ; then Trace_File=${Trace_File} ${wheres_kill_all}/bp.kill_all INSTALL if [ $? = 2 ] ; then $ECHO "Cannot upgrade when NetBackup or Media Manager processes are running. Was not successful in terminating NetBackup or Media Manager processes." wrap_up 1 fi fi else # This is alternate root install so # set pkg command option PKG_OPTION="-R /${PKG_INSTALL_ROOT}" fi nirvx_check # If an alternate root install, find out where # the base dir is for openv. The symbolic link # from /usr/openv in the alternate root will not # be correct from here. # # Create a touch file to indicate to # nb_request that the ost check has already # happened. Otherwise, the user will see it # twice. # # Check for the PureDisk installations here too. if [ -n "${LOCAL_INSTALL}" ]; then ost_check usr rm -f /tmp/nb_ostcheck ${ECHO} "ostcheck=y" > /tmp/nb_ostcheck run_pdprecheck usr else base_nb=`pkginfo ${PKG_OPTION} -l SYMCnetbp 2>/dev/null | grep BASEDIR | cut -f 2 -d ":" | /usr/bin/tr -d ' '` if [ "${base_nb}" != "" ] ; then ost_check ${PKG_INSTALL_ROOT}${base_nb} # Only create touch file for alternate # root if we found the base dir. Else # pkgrm was done and we need to do the # check in nb_request. rm -f /${PKG_INSTALL_ROOT}/tmp/nb_ostcheck ${ECHO} "ostcheck=y" > /${PKG_INSTALL_ROOT}/tmp/nb_ostcheck run_pdprecheck ${PKG_INSTALL_ROOT}${base_nb} fi fi # Has to be here so PKG_OPTION is set properly. check_for_vsm if [ $? -ne 0 ] ; then # Message was issued by the function. wrap_up 5 fi report_any_old_extras rep_stat=$? if [ ${rep_stat} -eq 1 ] ; then wrap_up 0 elif [ ${rep_stat} -eq 2 ] ; then ${ECHO} " There were issues running pkgrm on older addon packages. Refer to the trace file to determine which ones and remove them. Then rerun this script. " wrap_up 1 fi report_any_old_packages if [ $? -eq 1 ] ; then wrap_up 0 fi # Need to set tar options and MACHINE before calling # unbundle_pkg. if [ "${PLATFORM}" = "solaris" ] ; then set_tar_options SOLARIS MACHINE=SOLARIS else set_tar_options SOLARIS_X86 MACHINE=SOLARIS_X86 fi # Create a touch file to indicate the install # script executed pkgadd. SYMCnetbp is no longer # a standalone package. rm -f /${PKG_INSTALL_ROOT}/tmp/nb_pkgcheck ${ECHO} "pkgcheck=y" > /${PKG_INSTALL_ROOT}/tmp/nb_pkgcheck execute_telemetry ${MY_CD_PATH}/${PLATFORM}/catalog/anb nosuppress # In case the server version file exists, get the old NB level. OLD_NB_LEVEL=0 if [ -f /${PKG_INSTALL_ROOT}/usr/openv/netbackup/version ] ; then OLD_NB_LEVEL=`head -2 /${PKG_INSTALL_ROOT}/usr/openv/netbackup/version | tail -1 | cut -f3 -d" "` fi # unbundle_pkg has already issued the error # message, if any, so just exit nicely if it failed. unbundle_pkg ${MY_CD_PATH}/${PLATFORM}/anb/SYMCnetbp.pkg SYMCnetbp /tmp/install_netbppkg_trace.$$ "${PKG_OPTION}" if [ $? -ne 0 ]; then if [ -f /tmp/install_netbppkg_trace.$$ ] ; then cat /tmp/install_netbppkg_trace.$$ fi wrap_up 1 else if [ -f /tmp/install_netbppkg_trace.$$ ] ; then ${ECHO} "More details regarding SYMCnetbp can be found in file /tmp/install_netbppkg_trace.$$ on `hostname`." fi fi # Figure out where SYMCnetbp really is installed. In an # alternate root environment, there may be no /usr/openv yet. # If NB_BASEDIR is empty, things are not what they should be, # bail out. NB_BASEDIR=`pkginfo ${PKG_OPTION} -r SYMCnetbp 2>/dev/null` if [ "${NB_BASEDIR}" = "" ] ; then ${ECHO} " pkginfo ${PKG_OPTION} -r SYMCnetbp failed. Aborting ..." wrap_up 1 fi # Set up client distribution area. ( ${ECHO} "" if [ -d /${PKG_INSTALL_ROOT}${NB_BASEDIR} ] ; then cd /${PKG_INSTALL_ROOT}${NB_BASEDIR} gunzip -c ${MY_CD_PATH}/${PLATFORM}/anb/client_dist.tar.gz | ${TAR} v${SPEC_TAR_OPT}${TAR_X_OPTIONS} - if [ $? -ne 0 ]; then ${ECHO} "${TAR} failed. Aborting ..." wrap_up 1 fi else ${ECHO} "Cannot unbundle to directory /${PKG_INSTALL_ROOT}${NB_BASEDIR}. Aborting ..." wrap_up 1 fi ) # Move pack install files. This code used to be in preinstall but # now that the pack installer uses native commands this code # needed to be pulled out to match behavior on non-solaris # installs. Plus it was messing up the pack installer. SaveBinaries=0 if [ -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/.psummary -o \ -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/.phistory -o \ -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/.pseq ] ; then if [ ! -d /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack ] ; then mkdir /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack chmod 755 /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack chgrp bin /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack fi SaveBinaries=1 fi if [ -d /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack ] ; then PACK_OLD_LEVEL=${OLD_NB_LEVEL} # If no version file, parse file created by pkgrm done for an upgrade. # If no version file and no upgrade file, we must be promoting a # client to a server. Use the client version file to get a release # number. if [ ${PACK_OLD_LEVEL} -eq 0 -a \ -s /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/netbackup/.upgrade.to.${RELEASE_LEVEL} ]; then PACK_OLD_LEVEL=`head -2 /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/netbackup/.upgrade.to.${RELEASE_LEVEL} | tail -1 | cut -f3 -d" "` elif [ ${PACK_OLD_LEVEL} -eq 0 -a \ ! -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/netbackup/.upgrade.to.${RELEASE_LEVEL} -a \ -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/netbackup/bin/version ] ; then PACK_OLD_LEVEL=`cat /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/netbackup/bin/version | cut -f2 -d" "` fi if [ ! -d /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack.${PACK_OLD_LEVEL} -a \ ${SaveBinaries} -eq 1 ] ; then echo "Moving pack history to /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack.${PACK_OLD_LEVEL}" mv /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack.${PACK_OLD_LEVEL} fi for pfile in .psummary .phistory .pseq do if [ -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/${pfile} ] ; then rmfile="${pfile}" if [ "${pfile}" = ".phistory" ] ; then rmfile="pack.history" elif [ "${pfile}" = ".psummary" ] ; then rmfile="pack.summary" fi rm -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack.${PACK_OLD_LEVEL}/${rmfile} mv /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/${pfile} /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack.${PACK_OLD_LEVEL} fi done fi pack_save_dt=`/bin/date +"%m%d%y_%H%M%S"` # Wait until any old pack directory is moved before # saving off current package. ${ECHO} " Saving server binaries for ${MACHINE}." save_level=`expr ${RELEASE_LEVEL} : '\([0-9.]*\)'` for pdir in pack pack/NB_${save_level} \ pack/NB_${save_level}/save \ pack/NB_CLT_${save_level} \ pack/NB_CLT_${save_level}/save do if [ ! -d /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/${pdir} ] ; then mkdir /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/${pdir} chmod 755 /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/${pdir} chgrp bin /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/${pdir} fi done # Wildcard the date/time so there is only one copy ever saved. rm -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack/NB_${save_level}/save/.sizes_* rm -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack/NB_${save_level}/save/NB_${save_level}.*.tar rm -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack/NB_${save_level}/save/NB_${save_level}.*.tar.gz rm -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack/NB_CLT_${save_level}/save/NB_CLT_${save_level}Solaris.*.tar rm -f /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack/NB_CLT_${save_level}/save/NB_CLT_${save_level}Solaris.*.tar.gz ( cd ${MY_CD_PATH}/${PLATFORM}/anb cp client_dist.tar.gz /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack/NB_CLT_${save_level}/save/NB_CLT_${save_level}Solaris.${pack_save_dt}.tar.gz cp .sizes_SYMCnetbp /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack/NB_${save_level}/save/.sizes_NB_${save_level}.${pack_save_dt} /bin/tar ${TAR_C_OPTIONS} /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack/NB_${save_level}/save/NB_${save_level}.${pack_save_dt}.tar .pkg_defaults SYMCnetbp.pkg if [ $? -ne 0 ] ; then ${ECHO} "tar failed. Aborting..." exit 1 fi gzip /${PKG_INSTALL_ROOT}${NB_BASEDIR}/openv/pack/NB_${save_level}/save/NB_${save_level}.${pack_save_dt}.tar if [ $? -ne 0 ] ; then ${ECHO} "gzip failed. Aborting..." exit 1 fi ) # Check exit status from subshell as exit in there doesn't # really exit. if [ $? -ne 0 ] ; then ${ECHO} "Saving server binaries for ${MACHINE} failed." ${ECHO} "Aborting..." wrap_up 1 fi # Only do install_bp (configuration), # if pkgadd success AND LOCAL_INSTALL if [ -n "${LOCAL_INSTALL}" ]; then ${ECHO} "Running /usr/openv/netbackup/bin/install_bp" /usr/openv/netbackup/bin/install_bp ${Trace_File} fi fi ;; Client) check_for_vsm if [ $? -ne 0 ] ; then # Message was issued by the function. wrap_up 5 fi ${MY_CD_PATH}/NBClients/catalog/anb/client.inst ${Trace_File} ;; esac } #---------------------------- nirvx_check () { if [ "${PLATFORM}" = "solaris" -o "${PLATFORM}" = "linuxR_x86" ] ; then if [ "${PLATFORM}" = "solaris" ] ; then pkginfo ${PKG_OPTION} SYMCpinirvanix.* >/dev/null 2>&1 else rpm -q SYMCpinirvanix >/dev/null 2>&1 fi if [ $? -eq 0 ] ; then ${ECHO} " The Cloud Storage for Nirvanix plugin (SYMCpinirvanix) has been detected. Beginning with NetBackup 7.1, the Cloud Storage for Nirvanix files are installed automatically with NetBackup. You must uninstall all pre-existing versions of the Cloud Storage for Nirvanix plugin before you can proceed with NetBackup installation. " wrap_up 5 fi fi } #---------------------------- ost_check () { NB_BASE="${1}" if [ -d /${NB_BASE}/openv/lib/ost-plugins ] ; then ${ECHO} " Please verify that any OpenStorage plugins located in directory /${NB_BASE}/openv/lib/ost-plugins have been certified for use with NetBackup 7.0 or later. Starting with NetBackup 7.0, binaries are 64-bit; therefore, it is required that any OpenStorage plugin also be 64-bit. Warning for NetBackup 7.0 or later media servers: if the OpenStorage plugin is not 64-bit, NetBackup will not be able to access the OpenStorage device to perform backups or restores. " fi } #---------------------------- print_copyright () { ${ECHO} " Symantec Installation Script Copyright 1993 - 2012 Symantec Corporation, All Rights Reserved. " } #---------------------------- print_license_msg () { ${ECHO} " Please review the SYMANTEC SOFTWARE LICENSE AGREEMENT located on the installation media before proceeding. The agreement includes details on the NetBackup Product Improvement Program." } #---------------------------- print_sort_msg () { ${ECHO} " For NetBackup installation and upgrade information specific to your platform and to find out if your installed EEBs or hot fixes are contained in this release, check out the Symantec Operations Readiness Tools (SORT) Installation and Upgrade Checklist and Hot fix and EEB Release Auditor, respectively, at https://sort.symantec.com/netbackup. " } #---------------------------- print_portal_warning () { ${ECHO} "ATTENTION! To help ensure a successful upgrade to NetBackup 7.5, please visit the NetBackup 7.5 Upgrade Portal: http://www.symantec.com/docs/TECH74584. " } #---------------------------- run_pdprecheck () { NB_BASE="${1}" if [ -f ${MY_CD_PATH}/${PLATFORM}/catalog/anb/pdinstall ] ; then PD_PRECHECK_ARGS="" if [ -n "${PKG_INSTALL_ROOT}" ] ; then PD_PRECHECK_ARGS="-basedir /${NB_BASE} -alt_root_path ${PKG_INSTALL_ROOT}" fi ${MY_CD_PATH}/${PLATFORM}/catalog/anb/pdinstall -precheck ${PD_PRECHECK_ARGS} 2>&1 ret=$? if [ ${ret} -eq 3 -a -z "${PKG_INSTALL_ROOT}" ]; then wheres_kill_all="" if [ -f /usr/openv/netbackup/bin/bp.kill_all ] ; then wheres_kill_all=/usr/openv/netbackup/bin elif [ -f /usr/openv/netbackup/bin/goodies/bp.kill_all ] ; then wheres_kill_all=/usr/openv/netbackup/bin/goodies fi if [ -f ${wheres_kill_all}/bp.kill_all ]; then ${ECHO} " It is recommended that no NetBackup or Media Manager daemons be running when you uninstall PureDisk software. NetBackup amd Media Manager daemons can be terminated by executing the following command: ${wheres_kill_all}/bp.kill_all " fi wrap_up 5 elif [ ${ret} -ne 0 ]; then ${ECHO} " PureDisk precheck failed. Resolve issues with PureDisk installations and re-run this NetBackup installation script. " wrap_up 5 fi fi } #################### MAIN #################### # Get the directory containing this script CWD=`pwd` MY_CD_PATH="$0" case "${MY_CD_PATH}" in /*) : ;; *) MY_CD_PATH="$CWD/${MY_CD_PATH}" ;; esac #remove leading /./ if any MY_CD_PATH=`$ECHO "${MY_CD_PATH}" | sed -e 's-/\./-/-g'` MY_CD_PATH=`dirname ${MY_CD_PATH}` # If NB_TMPDIR is set in the user's environment, use that first. # If it is not set, use TMPDIR if it is set else default to /tmp. if [ "${NB_TMPDIR}" != "" ] ; then TMPDIR="${NB_TMPDIR}" else TMPDIR=${TMPDIR:=/tmp} fi export TMPDIR PLATFORM="" PKG_OPTION="" PKG_INSTALL_ROOT="" # We don't need special TAR or SPEC_TAR_OPT here as all # server platforms will be natively packaged. Initialize for # unbundle_pkg function. TAR=/bin/tar SPEC_TAR_OPT="" Set_C_locale # Intentionally hard code install trace files to be in /tmp so # users and commands find them in a consistent spot. Trace_File=/tmp/install_trace.$$ if [ -f "${MY_CD_PATH}/InUse" ] ; then $ECHO " The media image is being regenerated at the moment. Please try again later. " exit 0 fi # # Make sure this is being run from root. # ISROOT=`id | egrep "^uid=0\("` if [ "${ISROOT}" = "" ] ; then ${ECHO} "" ${ECHO} "$0 must be run while logged in as root." ${ECHO} "" exit 1 fi is_cmd_in_path gunzip if [ $? -ne 0 ] ; then ${ECHO} " ERROR: gunzip is required to install this package and was not found in \${PATH}. \${PATH} is currently set to: ${PATH} " exit 1 fi ( find_products # # If only one product is found, present the same questions # as in the past. If more than one product is found, a # menu of possible choices is presented. # if [ ${num_products} -eq 1 ]; then print_copyright ${ECHO} " Installing ${name_1} " if [ ${is_nb_server_present} -eq 1 ] ; then print_license_msg print_sort_msg print_portal_warning elif [ ${is_nb_client_present} -eq 1 ] ; then print_license_msg print_sort_msg fi if confirm y "Do you wish to continue?" then install_product ${product_1} wrap_up $? else wrap_up 0 fi else # If an install passes, this loop continues until the # Exit option is chosen. But if any part of the install # fails, the script quits. while : ; do print_copyright index=0 while [ ${index} -lt ${num_products} ]; do index=`expr ${index} + 1` eval ${ECHO} \"\ \ \ \ \ \ \ \ ${index}\)\ \ \${name_${index}}\" done if [ ${is_nb_server_present} -eq 1 ] ; then print_license_msg print_sort_msg print_portal_warning elif [ ${is_nb_client_present} -eq 1 ] ; then print_license_msg print_sort_msg fi ${ECHO} "" get_number "Choose an option: " 1 ${index} answ="${VALUE}" if eval [ \"\${product_${answ}}\" = \"Exit\" ] ; then wrap_up 0 else eval install_product \${product_${answ}} if [ $? -ne 0 ] ; then wrap_up 1 fi fi done fi ) 2>&1 | tee -a -i ${Trace_File} if [ -s ${TMPDIR}/cdrom_install.$$.status ] ; then exit_value=`cat ${TMPDIR}/cdrom_install.$$.status` else exit_value=99 fi rm -f ${TMPDIR}/cdrom_install.$$.status final_trace="${Trace_File}" if [ -d /usr/openv ] ; then if [ ! -d /usr/openv/tmp ] ; then mkdir /usr/openv/tmp fi chmod 755 /usr/openv/tmp chgrp bin /usr/openv/tmp # If the script exits early, the pkg trace files are # dumped to stdout and picked up by the overall trace # file. If all goes well, save off the pkg traces # in the usual spot for completeness. if [ -f /tmp/install_netbppkg_trace.$$ ] ; then cp /tmp/install_netbppkg_trace.$$ /usr/openv/tmp fi cp ${Trace_File} /usr/openv/tmp final_trace="/usr/openv/tmp/`basename ${Trace_File}`" fi ${ECHO} " File ${final_trace} contains a trace of this install. That file can be deleted after you are sure the install was successful." exit ${exit_value}