Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svc/milestone/net-nwam
          +++ new/usr/src/cmd/svc/milestone/net-nwam
↓ open down ↓ 49 lines elided ↑ open up ↑
  50   50  
  51   51  # commands
  52   52  BASENAME=/usr/bin/basename
  53   53  CAT=/usr/bin/cat
  54   54  CP=/usr/bin/cp
  55   55  DOMAINNAME=/usr/bin/domainname
  56   56  GREP=/usr/bin/grep
  57   57  LDAPCLIENT=/usr/sbin/ldapclient
  58   58  MKDIR=/usr/bin/mkdir
  59   59  MKFIFO=/usr/bin/mkfifo
  60      -NAWK=/usr/bin/nawk
       60 +AWK=/usr/xpg4/bin/awk
  61   61  NWAMCFG=/usr/sbin/nwamcfg
  62   62  RM=/usr/bin/rm
  63   63  SVCADM=/usr/sbin/svcadm
  64   64  SVCCFG=/usr/sbin/svccfg
  65   65  SVCPROP=/usr/bin/svcprop
  66   66  
  67   67  # Path to directories
  68   68  # We don't have a writable file system so we write to /etc/svc/volatile and
  69   69  # then later copy anything interesting to /etc/nwam.
  70   70  VOL_NWAM_PATH=/etc/svc/volatile/nwam
↓ open down ↓ 96 lines elided ↑ open up ↑
 167  167          NAMESERVICES_CONFIG_FILE="$VOL_LEGACY_PATH/nsswitch.conf"
 168  168          
 169  169          # Gather DNS info from resolv.conf if present.
 170  170          if [ -f /etc/resolv.conf ]; then
 171  171                  NAMESERVICES="dns,"
 172  172                  $GREP -i "added by dhcp" /etc/nsswitch.conf >/dev/null
 173  173                  if [ $? -eq 0 ]; then
 174  174                          DNS_NAMESERVICE_CONFIGSRC="dhcp"
 175  175                  else
 176  176                          DNS_NAMESERVICE_CONFIGSRC="manual"
 177      -                        DNS_NAMESERVICE_DOMAIN=`$NAWK '$1 == "domain" {\
      177 +                        DNS_NAMESERVICE_DOMAIN=`$AWK '$1 == "domain" {\
 178  178                              print $2 }' < /etc/resolv.conf`
 179      -                        DNS_NAMESERVICE_SERVERS=`$NAWK '$1 == "nameserver" \
      179 +                        DNS_NAMESERVICE_SERVERS=`$AWK '$1 == "nameserver" \
 180  180                              { printf "%s,", $2 }' < /etc/resolv.conf`
 181      -                        DNS_NAMESERVICE_SEARCH=`$NAWK '$1 == "search" \
      181 +                        DNS_NAMESERVICE_SEARCH=`$AWK '$1 == "search" \
 182  182                              { printf "%s,", $2 }' < /etc/resolv.conf`
 183  183                          copy_to_legacy_loc /etc/resolv.conf
 184  184                  fi
 185  185          fi
 186  186  
 187  187          # Gather NIS info from appropriate file if present.
 188  188          if service_is_enabled $NIS_CLIENT_FMRI; then
 189  189                  NAMESERVICES="${NAMESERVICES}nis,"
 190  190                  NIS_NAMESERVICE_CONFIGSRC="manual"
 191  191                  DEFAULT_DOMAIN=`$CAT /etc/defaultdomain`
 192  192  
 193      -                yp_servers=`$NAWK '{ printf "%s ", $1 }' \
      193 +                yp_servers=`$AWK '{ printf "%s ", $1 }' \
 194  194                      < $NIS_BIND_PATH/$DEFAULT_DOMAIN/ypservers`
 195  195                  for serv in $yp_servers; do
 196  196                          if is_valid_addr $serv; then
 197  197                                  addr="$serv,"
 198  198                          else
 199  199                                  addr=`$GREP -iw $serv /etc/inet/hosts | \
 200      -                                    $NAWK '{ printf "%s,", $1 }'`
      200 +                                    $AWK '{ printf "%s,", $1 }'`
 201  201                          fi
 202  202                          NIS_NAMESERVICE_SERVERS="${NIS_NAMESERVICE_SERVERS}$addr"
 203  203                  done
 204  204          fi
 205  205  
 206  206          # Gather LDAP info via ldapclient(1M).
 207  207          if [ -f /var/ldap/ldap_client_file ]; then
 208  208                  copy_to_legacy /var/ldap/ldap_client_file
 209  209                  NAMESERVICES="${NAMESERVICES}ldap,"
 210  210                  LDAP_NAMESERVICE_CONFIGSRC="manual"
 211  211                  LDAP_NAMESERVICE_SERVERS=`$LDAPCLIENT list 2>/dev/null | \
 212      -                    $NAWK '$1 == "preferredServerList:" { print $2 }'`
      212 +                    $AWK '$1 == "preferredServerList:" { print $2 }'`
 213  213                  DEFAULT_DOMAIN=`$CAT /etc/defaultdomain`
 214  214          fi
 215  215  
 216  216          # Now, write nwamcfg commands for nameservices
 217  217          write_loc_prop "nameservices" $NAMESERVICES $CREATE_LOC_LEGACY_FILE
 218  218          write_loc_prop "nameservices-config-file" $NAMESERVICES_CONFIG_FILE \
 219  219              $CREATE_LOC_LEGACY_FILE
 220  220          write_loc_prop "dns-nameservice-configsrc" $DNS_NAMESERVICE_CONFIGSRC \
 221  221              $CREATE_LOC_LEGACY_FILE
 222  222          write_loc_prop "dns-nameservice-domain" $DNS_NAMESERVICE_DOMAIN \
↓ open down ↓ 135 lines elided ↑ open up ↑
 358  358          fi
 359  359  
 360  360          # NIS - directory and ypserver in /var/yp/binding/
 361  361          NIS_CONFIGSRC=`nwam_get_loc_prop Legacy nis-nameservice-configsrc`
 362  362          NIS_SERVERS=`nwam_get_loc_prop Legacy nis-nameservice-servers`
 363  363          if [ -n "$NIS_CONFIGSRC" ]; then
 364  364                  if [ ! -d "$NIS_BIND_PATH/$DEFAULT_DOMAIN" ]; then
 365  365                          $MKDIR -p $NIS_BIND_PATH/$DEFAULT_DOMAIN
 366  366                  fi
 367  367                  if [ -n "$NIS_SERVERS" ]; then
 368      -                        echo "$NIS_SERVERS" | $NAWK \
      368 +                        echo "$NIS_SERVERS" | $AWK \
 369  369                              'FS="," { for (i = 1; i <= NF; i++) print $i }' \
 370  370                              > $NIS_BIND_PATH/$DEFAULT_DOMAIN/ypservers
 371  371                  fi
 372  372                  $SVCADM enable nis/client
 373  373          fi
 374  374  
 375  375          # LDAP - copy ldap_client_file to /var/ldap/ldap_client_file
 376  376          if [ -f "$PERM_LEGACY_PATH/ldap_client_file" ]; then
 377  377                  copy_from_legacy_loc /var/ldap/ldap_client_file
 378  378                  $SVCADM enable ldap/client
↓ open down ↓ 35 lines elided ↑ open up ↑
 414  414                  set_smf_prop $IPSEC_POLICY_FMRI config/config_file \
 415  415                      $IPSEC_POLICY_DEFAULT_CONFIG_FILE
 416  416                  $SVCADM disable $IPSEC_POLICY_FMRI
 417  417          fi
 418  418  
 419  419          refresh_ipf=false
 420  420          if [ -n "$ipf_file" ]; then
 421  421                  # change /none, /allow, and /deny to firewall policy
 422  422                  if [ "$ipf_file" = "/none" -o "$ipf_file" = "/allow" \
 423  423                      -o "$ipf_file" = "/deny" ]; then
 424      -                        policy=`echo "$ipf_file" | $NAWK 'FS="/" { print $2 }'`
      424 +                        policy=`echo "$ipf_file" | $AWK 'FS="/" { print $2 }'`
 425  425                          set_smf_prop $IPFILTER_FMRI \
 426  426                              firewall_config_default/policy $policy
 427  427                          # no need to clear custom_policy_file as it isn't "custom"
 428  428                  else
 429  429                          copy_from_legacy_loc $ipf_file
 430  430                          set_smf_prop $IPFILTER_FMRI \
 431  431                              firewall_config_default/policy "custom"
 432  432                          set_smf_prop $IPFILTER_FMRI \
 433  433                              firewall_config_default/custom_policy_file $ipf_file
 434  434                  fi
↓ open down ↓ 212 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX