#!/bin/bsh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # onc720 src/oncplus/usr/sbin/sysmgt/rmkeyserv.sh 1.3 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 1989,2007 # 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 # # @(#)44 1.3 src/oncplus/usr/sbin/sysmgt/rmkeyserv.sh, nis, onc720 11/12/07 07:19:16 # # COMPONENT_NAME: onccmds # # FUNCTIONS: place # # ORIGINS: 27 # # # (C) COPYRIGHT International Business Machines Corp. 1989,1997 # 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. # set -f # this is so that the case statement will work COMMAND_NAME=`/usr/bin/basename $0` TMPDIR=${TMPDIR:-$HOME/tmp} [ ! -d $TMPDIR ] && TMPDIR=/tmp TMPDIR=$TMPDIR/$COMMAND_NAME.$$ /usr/bin/mkdir $TMPDIR || { echo "$COMMAND_NAME: Could not create temporary files" exit 1 } SED_CMD="/bin/sed" RC_NFS="/etc/rc.nfs" TMP_RC_NFS="$TMPDIR/tmp.rc.nfs" USAGE=" usage: ${COMMAND_NAME} [-I|-B|-N]\n" set -- `/usr/bin/getopt IBN $* 2>/dev/null` if [ $? != 0 ] ; then # Test for syntax error /usr/bin/dspmsg cmdnfs.cat -s 37 5 "${USAGE}" ${COMMAND_NAME} trap '/bin/rm -rf $TMPDIR 2>/dev/null' 0 1 2 3 15 exit 1 fi while [ $1 != -- ] do case "$1" in "-I") #WHEN should this take place (IPL) if [ -n "${WHEN}" ] ; then /usr/bin/dspmsg cmdnfs.cat -s 37 5 "$USAGE" ${COMMAND_NAME} ; trap '/bin/rm -rf $TMPDIR 2>/dev/null' 0 1 2 3 15 exit 1 ; fi WHEN="I" shift ;; "-N") #WHEN should this take place (NOW) if [ -n "${WHEN}" ] ; then /usr/bin/dspmsg cmdnfs.cat -s 37 5 "$USAGE" ${COMMAND_NAME} ; trap '/bin/rm -rf $TMPDIR 2>/dev/null' 0 1 2 3 15 exit 1 ; fi WHEN="N" shift ;; "-B") #WHEN should this take place (BOTH) if [ -n "${WHEN}" ] ; then /usr/bin/dspmsg cmdnfs.cat -s 37 5 "$USAGE" ${COMMAND_NAME} ; trap '/bin/rm -rf $TMPDIR 2>/dev/null' 0 1 2 3 15 exit 1 ; fi WHEN="B" shift ;; *) /usr/bin/dspmsg cmdnfs.cat -s 37 5 "$USAGE" ${COMMAND_NAME} trap '/bin/rm -rf $TMPDIR 2>/dev/null' 0 1 2 3 15 exit 1 ;; esac done # check to make sure that there are not any extra parameters shift # get rid of the -- parameter if [ -n "$1" ] ; then # something extra here. /usr/bin/dspmsg cmdnfs.cat -s 37 5 "${USAGE}" ${COMMAND_NAME} trap '/bin/rm -rf $TMPDIR 2>/dev/null' 0 1 2 3 15 exit 1 fi # Set the defaults for this command WHEN=${WHEN:-"B"} if [ "${WHEN}" = "I" -o "${WHEN}" = "B" ] ; then ${SED_CMD} "\?-x.*/usr/sbin/keyserv?,/fi/s/#// \?-x.*/usr/sbin/keyserv?,/fi/s/^/#/" ${RC_NFS} > ${TMP_RC_NFS} 2>/dev/null if [ $? != 0 ] ; then /usr/bin/dspmsg cmdnfs.cat -s 37 14 "${COMMAND_NAME}: error in updating ${RC_NFS}\n" ${COMMAND_NAME} ${RC_NFS} trap '/bin/rm -rf $TMPDIR 2>/dev/null' 0 1 2 3 15 exit 1 fi # copy the file back to /etc /bin/cp ${TMP_RC_NFS} ${RC_NFS} > /dev/null 2>&1 if [ $? != 0 ] ; then /usr/bin/dspmsg cmdnfs.cat -s 37 14 "${COMMAND_NAME}: error in updating ${RC_NFS}\n" ${COMMAND_NAME} ${RC_NFS} fi fi if [ "${WHEN}" = "N" -o "${WHEN}" = "B" ] ; then /usr/bin/stopsrc -s keyserv fi trap '/bin/rm -rf $TMPDIR 2>/dev/null' 0 1 2 3 15