Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svc/milestone/net-loc
          +++ new/usr/src/cmd/svc/milestone/net-loc
↓ open down ↓ 38 lines elided ↑ open up ↑
  39   39  NWAM_FMRI="svc:/network/physical:nwam"
  40   40  
  41   41  # commands
  42   42  CP=/usr/bin/cp
  43   43  DHCPINFO=/sbin/dhcpinfo
  44   44  DOMAINNAME=/usr/bin/domainname
  45   45  GREP=/usr/bin/grep
  46   46  LDAPCLIENT=/usr/sbin/ldapclient
  47   47  MKDIR=/usr/bin/mkdir
  48   48  MV=/usr/bin/mv
  49      -NAWK=/usr/bin/nawk
       49 +AWK=/usr/xpg4/bin/awk
  50   50  NWAMADM=/usr/sbin/nwamadm
  51   51  NWAMCFG=/usr/sbin/nwamcfg
  52   52  RM=/usr/bin/rm
  53   53  SED=/usr/bin/sed
  54   54  SVCADM=/usr/sbin/svcadm
  55   55  SVCCFG=/usr/sbin/svccfg
  56   56  SVCPROP=/usr/bin/svcprop
  57   57  TOUCH=/usr/bin/touch
  58   58  
  59   59  # Path to directories
↓ open down ↓ 8 lines elided ↑ open up ↑
  68   68  #
  69   69  # Don't parse the output of ifconfig(1M) because interfaces that haven't
  70   70  # acquired a DHCP lease also have the DHCP flag set.
  71   71  #
  72   72  get_dhcp_interfaces () {
  73   73          #
  74   74          # 1. parse netstat(1M) output for v4 interfaces in BOUND
  75   75          #    or INFORMATION state
  76   76          # 2. make a space-separated list of interface names
  77   77          #
  78      -        netstat -D -f inet | $NAWK '
       78 +        netstat -D -f inet | $AWK '
  79   79              $2 ~ /BOUND/ { printf "%s ", $1 }
  80   80              $2 ~ /INFORMATION/ { printf "%s ", $1 }'
  81   81  }
  82   82  
  83   83  #
  84   84  # get_dhcpinfo <code/identifier>
  85   85  #
  86   86  # echoes the value received through each interface controlled by DHCP;
  87   87  # multiple values are echoed as a space-separated list
  88   88  #
↓ open down ↓ 119 lines elided ↑ open up ↑
 208  208                          set -- $DNS_SEARCH
 209  209                          DNS_DOMAIN=$1
 210  210                          ;;
 211  211                  '*')
 212  212                          echo "Unrecognized DNS configsrc ${configsrc}; ignoring"
 213  213                          ;;
 214  214                  esac
 215  215  
 216  216                  # Write DNS settings
 217  217                  if [ -n "$DNS_DOMAIN" ]; then
 218      -                        echo "$DNS_DOMAIN" | $NAWK \
      218 +                        echo "$DNS_DOMAIN" | $AWK \
 219  219                              '{ for (i = 1; i <= NF; i++) \
 220  220                              print "domain ", $i }' >> $file.$$
 221  221                  fi
 222  222                  if [ -n "$DNS_SEARCH" ]; then
 223      -                        echo "$DNS_SEARCH" | $NAWK \
      223 +                        echo "$DNS_SEARCH" | $AWK \
 224  224                              '{ printf("search"); \
 225  225                              for (i = 1; i <= NF; i++) printf(" %s", $i); \
 226  226                              printf("\n") }' >> $file.$$
 227  227                  fi
 228  228                  if [ -n "$DNS_SERVERS" ]; then
 229      -                        echo "$DNS_SERVERS" | $NAWK \
      229 +                        echo "$DNS_SERVERS" | $AWK \
 230  230                              '{ for (i = 1; i <= NF; i++) \
 231  231                              print "nameserver ", $i }' >> $file.$$
 232  232                  fi
 233  233          done    
 234  234  
 235  235          # Finally, copy our working version to the real thing
 236  236          $MV -f $file.$$ $file
 237  237          start_svc $DNS_CLIENT_FMRI
 238  238  
 239  239          return 0
↓ open down ↓ 26 lines elided ↑ open up ↑
 266  266                                  $DOMAINNAME $DEFAULT_DOMAIN
 267  267                                  $DOMAINNAME > $ETC_DEFAULT_DOMAIN
 268  268                          else
 269  269                                  echo "'domainname' not set for '$loc'"
 270  270                                  return 1
 271  271                          fi
 272  272                          ;;
 273  273                  'dhcp')
 274  274                          # Use only the first name
 275  275                          DEFAULT_DOMAIN=`get_dhcpinfo NISdmain | \
 276      -                            $NAWK '{ print $1 }'`
      276 +                            $AWK '{ print $1 }'`
 277  277                          NIS_SERVERS=`get_dhcpinfo NISservs`
 278  278                          $DOMAINNAME $DEFAULT_DOMAIN
 279  279                          $DOMAINNAME > $ETC_DEFAULT_DOMAIN
 280  280                          ;;
 281  281                  '*')
 282  282                          echo "Unrecognized NIS configsrc ${configsrc}; ignoring"
 283  283                          ;;
 284  284                  esac
 285  285  
 286  286                  # Place NIS settings in appropriate directory/file.
 287  287                  if [ ! -d "$NIS_BIND_PATH/$DEFAULT_DOMAIN" ]; then
 288  288                          $MKDIR -p $NIS_BIND_PATH/$DEFAULT_DOMAIN
 289  289                  fi
 290  290                  if [ -n "$NIS_SERVERS" ]; then
 291      -                        echo "$NIS_SERVERS" | $NAWK \
      291 +                        echo "$NIS_SERVERS" | $AWK \
 292  292                              '{ for (i = 1; i <= NF; i++) print $i }' \
 293  293                              > $NIS_BIND_PATH/$DEFAULT_DOMAIN/ypservers
 294  294                  fi
 295  295          done
 296  296  
 297  297          start_svc $NIS_CLIENT_FMRI
 298  298  
 299  299          return 0
 300  300  }
 301  301  
↓ open down ↓ 431 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX