#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos72L src/bos/etc/dhcpsetup/dhcpsetup.sh 1.2 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2018 # 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 # # @(#)12 1.2 src/bos/etc/dhcpsetup/dhcpsetup.sh, cmdinstl, bos72L, l2018_07A3 2/5/18 16:29:30 # # Globals typeset -i rc=0 typeset -i start_service=0 exit_file="/etc/dhcpsetup.nostart" AWK=/usr/bin/awk CHRCTCP=/usr/sbin/chrctcp GREP=/usr/bin/grep IFCONFIG=/usr/sbin/ifconfig LSDEV=/usr/sbin/lsdev RMITAB=/usr/sbin/rmitab # MAIN # check for a disablement file (future support) [[ -f "$exit_file" ]] && exit $rc # cycle though the list of adapters # - define dhcp settings for non-existent interfaces for i in $( $LSDEV -Cc adapter -F name | $GREP ent ) do interface="en${i#ent}" if_val=$( $IFCONFIG $interface 2>/dev/null | $AWK '/inet/ {print $2}' ) if [[ -z "$if_val" ]]; then echo "\ninterface $interface\n{\noption 19 0\noption 20 0\noption 27 0\noption 29 0\noption 30 0\noption 31 0\noption 34 0\noption 36 0\noption 39 0\n}" >> /etc/dhcpcd.ini start_service=1 fi done if [[ $start_service -gt 0 ]]; then $CHRCTCP -S -a dhcpcd || rc=1 fi # auto-run once during deploy # - remove cloud-ready inittab entry $RMITAB dhcpsetup 2>/dev/null # done exit $rc