#!/bin/sh #*************************************************************************** # $Copyright: Copyright (c) 2022 Veritas Technologies LLC. All rights reserved $ #*************************************************************************** # # The following variable is changed by the Build file to a valid value. # MACHINE=rs6000_61 # Intentionally set TMPDIR to /tmp. TMPDIR=/tmp BP_BIN=/usr/openv/netbackup/bin DB_EXT=/usr/openv/netbackup/ext/db_ext Q1="Please specify the Informix instance home path name:" LIB_LOC="/usr" LIB_NM="lib" USAGE () { echo "" echo "USAGE:" echo " $0" exit 22 } trap trapped 1 2 3 15 trapped () { rm -f ${Q1_ANSW} ${Q1_ANSW}.error exit 1 } # # This function takes a string as input and echos it out # as a question with a prompt for an answer. Any answer # not beginning with y or Y is considered a no. # confirm () { echo "${1} (y/n) [n] " read ans case "${ans}" in Y*|y*) echo return 1 ;; *) echo return 0 ;; esac } # # 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_64_bit=0 if [ $# -ne 0 ] ; then USAGE fi Q1_ANSW=${TMPDIR}/INFMX_Q1.$$ rm -f ${Q1_ANSW} # # Finding out the Informix home directory is first so that # rs6000 can figure out the proper name to use when creating # the link. # done=0 echo "" INF_INST="" while [ ${done} -ne 1 ] ; do echo ${Q1} read INF_INST if [ ! -d "${INF_INST}" ] ; then echo "" echo "Directory \"${INF_INST}\" does not exist." echo "" if confirm "Do you want to exit this script?" then : else trapped fi else echo ${INF_INST} >> ${Q1_ANSW} echo "" done=1 fi done # # Determine the version level of Informix. If we can't figure # it out, use a default of 7.30. # ver_f1="7" ver_f2="30" if [ ! -f "${INF_INST}"/bin/oninit ] ; then echo "" echo "INSTALLATION WARNING:" echo "File ${INF_INST}/bin/oninit does not exist." echo "Informix version level has been set to 7.30." else ver_line=`"${INF_INST}"/bin/oninit -V 2>/dev/null | head -1` echo ${ver_line} | grep 'Version' > /dev/null 2>&1 if [ $? -ne 0 ] ; then echo "" echo "INSTALLATION WARNING:" echo "Could not determine the version level for Informix." echo "Informix version level has been set to 7.30." else ver=`echo ${ver_line} | sed -e 's/.*Version //'` ver_f1=`echo ${ver} | cut -f1 -d" " | cut -f1 -d '.'` ver_f2=`echo ${ver} | cut -f1 -d" " | cut -f2 -d '.'` fi fi if [ "${ver_f1}" -eq "9" -a "${ver_f2}" -ge "40" -o "${ver_f1}" -eq "10" -o "${ver_f1}" -eq "11" ] ; then LIB_LOC="${INF_INST}" fi BAR_API=ibsad001.so if [ "${MACHINE}" = "hpia11.31" ] ; then NBU_64_API=infxbsa.so elif [ "${MACHINE}" = "solaris_x86_10_64" ] ; then NBU_64_API=infxbsa.so elif [ "${MACHINE}" = "solaris10" -o \ "${MACHINE}" = "linuxR_x86_3.10.0" -o "${MACHINE}" = "linuxS_x86_4.4.73" ] ; then NBU_64_API=infxbsa.so64 elif [ "${MACHINE}" = "rs6000_61" ] ; then NBU_64_API=infxbsa.so64 if [ "${ver_f1}" -eq "8" -a "${ver_f2}" -ge "21" ] ; then BAR_API=ibsad001.o fi fi if [ ! -f ${BP_BIN}/${NBU_64_API} ] ; then echo "" echo "ERROR: ${BP_BIN}/${NBU_64_API} not found." echo "ERROR: The Informix agent software has not been installed." echo "" trapped fi if [ -d ${DB_EXT}/informix/scripts ] ; then echo "" echo "Changing informix scripts' file ownership and group." for i in informix_dbspace_list \ informix_logical_log_backup \ informix_onbar_backup_of_dbspace1 \ informix_onbar_backup_of_rootdbs \ informix_onbar_backup_of_rootdbs_and_dbspace1 \ informix_onbar_backup_using_file_list \ infx_remove_expired_images \ informix_onbar_restore_dbspace1 \ informix_onbar_restore_rootdbs \ informix_onbar_whole_backup do chown informix ${DB_EXT}/informix/scripts/${i} chgrp informix ${DB_EXT}/informix/scripts/${i} done fi # # Protect the value of INF_INST with double quotes in case there is # a blank in the directory name. # if [ ! -d "${INF_INST}"/etc ] ; then echo "" echo "INSTALLATION ERROR:" echo "Directory ${INF_INST}/etc does not exist." echo "Check to see if Informix has been installed in ${INF_INST}." touch ${Q1_ANSW}.error else grep "^1|1\.1\.0|VERITAS-NetBackup|1|$" "${INF_INST}"/etc/sm_versions > /dev/null 2>&1 if [ $? -ne 0 ] ; then echo "" echo "Adding NetBackup to ${INF_INST}/etc/sm_versions." cat <<- END_OV_EDIT >>"${INF_INST}"/etc/sm_versions 1|1.1.0|VERITAS-NetBackup|1| END_OV_EDIT fi fi if [ ! -f ${Q1_ANSW}.error ] ; then # # Do some extra checks for the 32bit/64bit scenario. # Only 64bit is supported for Informix. # if [ "${MACHINE}" = "linuxR_x86_3.10.0" -o "${MACHINE}" = "linuxS_x86_4.4.73" ] ; then os_bits=`uname -p` if [ "${os_bits}" = "x86_64" ] ; then is_64_bit=1 fi cut_string="-f3" cut_string_2="-f5" elif [ "${MACHINE}" = "solaris10" -o "${MACHINE}" = "solaris_x86_10_64" ] ; then os_bits=`isainfo -nv` echo ${os_bits} | grep "64\-bit" > /dev/null 2>&1 if [ $? -eq 0 ] ; then is_64_bit=1 fi cut_string="-f1,2" elif [ "${MACHINE}" = "rs6000_61" ]; then /usr/bin/ls -l /unix | grep unix_64 > /dev/null 2>&1 if [ $? -eq 0 ]; then is_64_bit=1 fi cut_string="-f2" elif [ "${MACHINE}" = "hpia11.31" ] ; then # an IBM recommended way to check if is 64 bit http://www-01.ibm.com/support/docview.wss?uid=swg21148578 if [ `getconf KERNEL_BITS` -eq 64 ]; then is_64_bit=1 fi cut_string="-f1" fi if [ ${is_64_bit} -eq 1 ] ; then if [ "${MACHINE}" = "linuxR_x86_3.10.0" -o "${MACHINE}" = "linuxS_x86_4.4.73" ] ; then we_64_type=`file ${BP_BIN}/${NBU_64_API} | cut ${cut_string} -d" " | cut -f1 -d"-"` else we_64_type=`file ${BP_BIN}/${NBU_64_API} | cut -f2 -d":" | cut ${cut_string} -d" " | tr -d '\011'` fi if [ ! -f "${INF_INST}"/bin/oninit ] ; then echo "" echo "INSTALLATION WARNING:" echo "File ${INF_INST}/bin/oninit does not exist." echo "Cannot determine its binary type. Assuming it" echo "is the same as ${BP_BIN}/${NBU_64_API}." they_type="${we_64_type}" else if [ "${MACHINE}" = "linuxR_x86_3.10.0" -o "${MACHINE}" = "linuxS_x86_4.4.73" ] ; then they_type=`file "${INF_INST}"/bin/oninit | cut ${cut_string} -d" " | cut -f1 -d"-"` if [ "${they_type}" != "32" -a "${they_type}" != "64" ] ; then they_type=`file "${INF_INST}"/bin/oninit | cut ${cut_string_2} -d" " | cut -f1 -d"-"` fi else they_type=`file "${INF_INST}"/bin/oninit | cut -f2 -d":" | cut ${cut_string} -d" " | tr -d '\011'` fi fi if [ "${we_64_type}" = "${they_type}" ] ; then which_api=${NBU_64_API} if [ "${MACHINE}" = "rs6000_61" ] ; then if [ ! \( "${ver_f1}" -eq "8" -a "${ver_f2}" -ge "21" \) ] ; then BAR_API=ibsad001_64.so fi fi else echo "" echo "INSTALLATION ERROR:" echo "The file type for ${INF_INST}/bin/oninit does not" echo "match ${BP_BIN}/${NBU_64_API}." trapped fi else echo "" echo "INSTALLATION ERROR:" echo "NetBackup for Informix is not supported on 32 bit machines." echo "" trapped fi if ls -ld "${LIB_LOC}"/${LIB_NM}/${BAR_API} 2>/dev/null | grep "^l" > /dev/null then rm -f "${LIB_LOC}"/${LIB_NM}/${BAR_API} elif [ -f "${LIB_LOC}"/${LIB_NM}/${BAR_API} ] ; then rm -f "${LIB_LOC}"/${LIB_NM}/${BAR_API}.org mv "${LIB_LOC}"/${LIB_NM}/${BAR_API} "${LIB_LOC}"/${LIB_NM}/${BAR_API}.org fi echo "" echo "Linking "${LIB_LOC}"/${LIB_NM}/${BAR_API} to ${BP_BIN}/${which_api}." /bin/ln -s ${BP_BIN}/${which_api} "${LIB_LOC}"/${LIB_NM}/${BAR_API} # # Try to clean up an old directory and file. # if [ -d ${DB_EXT}/informix/infx_db_comm ] ; then rmdir ${DB_EXT}/informix/infx_db_comm > /dev/null 2>&1 fi rm -f ${BP_BIN}/install_infxbsa rm -f ${Q1_ANSW} exit 0 else trapped fi