#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/lib/nim/methods/c_cp_resolv.sh 1.1.1.2 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 1995,2011 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)82 1.1.1.2 src/bos/usr/lib/nim/methods/c_cp_resolv.sh, cmdnim, bos720 7/15/11 03:13:47 # COMPONENT_NAME: CMDNIM # # FUNCTIONS: ./usr/lib/nim/methods/c_cp_resolv.sh # # # ORIGINS: 27 # # # (C) COPYRIGHT International Business Machines Corp. 1995 # All Rights Reserved # Licensed Materials - Property of IBM # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # NIMPATH=${0%/*} NIMPATH=${NIMPATH%/*} [[ ${NIMPATH} = ${0} ]] && NIMPATH=/usr/lpp/bos.sysmgt/nim NIM_METHODS="${NIMPATH}/methods" export NIMPATH NIM_METHODS # # "dot" include (source) the shell lib functions # . ${NIM_METHODS}/c_sh_lib # --------------------------- local defines # --------------------------- module globals REQUIRED_ATTRS="location" OPTIONAL_ATTRS="" location="" # ---------------------------- c_cp_resolv # # NAME: c_cp_resolv # # FUNCTION: # sets up the /etc/resolv.conf file # # EXECUTION ENVIRONMENT: # # NOTES: # # RECOVERY OPERATION: # # DATA STRUCTURES: # parameters: # global: # # RETURNS: (int) # 0 = no errors # >0 = failure # # OUTPUT: # ---------------------------------------------------------------------------- # # signal processing trap cleanup 0 trap err_signal 1 2 11 15 # NIM initialization nim_init # initialize local variables source= rc= # set parameters from command line while getopts :a:qv c do case ${c} in a) # validate the attr ass parse_attr_ass "${OPTARG}" # include the assignment for use in this environment eval ${variable}=\"${value}\" ;; q) # show attr info cmd_what exit 0 ;; v) # verbose mode (for debugging) set -x for i in $(typeset +f) do typeset -ft $i done ;; \?) # unknown option error ${ERR_BAD_OPT} ${OPTARG} ;; esac done # # check for missing attrs # ck_attrs # # ensure local access to the file (local path returned via access_pnt) # nim_mount ${location} # # Check if an /etc/resolv.conf exists, if so save if off. # [[ -s ${RESOLV_CONF} ]] && ${NAMERSLV} -E ${RESOLV_CONF}.prev # # Now copy the file from the NFS server and stick it in # /etc, if that fails and we have a prev version put it # back.... # ${CP} ${access_pnt} ${RESOLV_CONF} 2>${ERR} && ${CHMOD} 644 ${RESOLV_CONF} 2>${ERR} || { [[ -s ${RESOLV_CONF}.prev ]] && ${NAMERSLV} -B ${RESOLV_CONF}.prev err_from_cmd ${CP} } # sweet success exit 0