Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/brand/solaris10/zone/p2v.ksh
          +++ new/usr/src/lib/brand/solaris10/zone/p2v.ksh
↓ open down ↓ 93 lines elided ↑ open up ↑
  94   94                  vlog "$v_nonetfix"
  95   95                  return
  96   96          fi
  97   97  
  98   98          NET=$(LC_ALL=C /usr/sbin/zonecfg -z $ZONENAME info net)
  99   99          if (( $? != 0 )); then
 100  100                  error "$e_badinfo" "net"
 101  101                  return
 102  102          fi
 103  103  
 104      -        NETIF=$(echo $NET | /usr/bin/nawk '{
      104 +        NETIF=$(echo $NET | /usr/xpg4/bin/awk '{
 105  105                  for (i = 1; i < NF; i++) {
 106  106                          if ($i == "physical:") {
 107  107                                  if (length(net) == 0) {
 108  108                                          i++
 109  109                                          net = $i
 110  110                                  } else {
 111  111                                          multiple=1
 112  112                                  }
 113  113                          }
 114  114                  }
↓ open down ↓ 28 lines elided ↑ open up ↑
 143  143                  error "$e_badfile" "/etc/dfs/dfstab"
 144  144                  return
 145  145          fi
 146  146  
 147  147          tmpfile=$(mktemp -t)
 148  148          if [[ $? == 1 || -z "$tmpfile" ]]; then
 149  149                  error "$e_tmpfile"
 150  150                  return
 151  151          fi
 152  152  
 153      -        /usr/bin/nawk '{
      153 +        /usr/xpg4/bin/awk '{
 154  154                  if (substr($1, 0, 1) == "#") {
 155  155                          print $0
 156  156                  } else {
 157  157                          print "#", $0
 158  158                          modified=1
 159  159                  }
 160  160          }
 161  161          END {
 162  162                  if (modified == 1) {
 163  163                          printf("# Modified by p2v ")
↓ open down ↓ 27 lines elided ↑ open up ↑
 191  191                  error "$e_badfile" "/etc/vfstab"
 192  192                  return
 193  193          fi
 194  194  
 195  195          tmpfile=$(mktemp -t)
 196  196          if [[ $? == 1 || -z "$tmpfile" ]]; then
 197  197                  error "$e_tmpfile"
 198  198                  return
 199  199          fi
 200  200  
 201      -        /usr/bin/nawk '{
      201 +        /usr/xpg4/bin/awk '{
 202  202                  if (substr($1, 0, 1) == "#") {
 203  203                          print $0
 204  204                  } else if ($1 == "fd" || $1 == "/proc" || $1 == "swap" ||
 205  205                      $1 == "ctfs" || $1 == "objfs" || $1 == "sharefs" ||
 206  206                      $4 == "nfs" || $4 == "lofs") {
 207  207                          print $0
 208  208                  } else {
 209  209                          print "#", $0
 210  210                          modified=1
 211  211                  }
↓ open down ↓ 42 lines elided ↑ open up ↑
 254  254  
 255  255          for i in $ZONEROOT/var/sadm/pkg/*
 256  256          do
 257  257                  pkg=$(/usr/bin/basename $i)
 258  258                  [[ ! -f $ZONEROOT/var/sadm/pkg/$pkg/save/pspool/$pkg/pkgmap ]] \
 259  259                      && continue
 260  260  
 261  261                  /usr/bin/egrep -s "SUNW_PKG_HOLLOW=true" \
 262  262                      $ZONEROOT/var/sadm/pkg/$pkg/pkginfo || continue
 263  263  
 264      -                for j in $(/usr/bin/nawk '{if ($2 == "f" &&
      264 +                for j in $(/usr/xpg4/bin/awk '{if ($2 == "f" &&
 265  265                      substr($4, 1, 17) == "var/svc/manifest/") print $4}' \
 266  266                      $ZONEROOT/var/sadm/pkg/$pkg/save/pspool/$pkg/pkgmap)
 267  267                  do
 268  268                          svcs=$(SVCCFG_NOVALIDATE=1 \
 269  269                              SVCCFG_REPOSITORY=$ZONEROOT/etc/svc/repository.db \
 270  270                              /usr/sbin/svccfg inventory $ZONEROOT/$j)
 271  271                          for k in $svcs
 272  272                          do
 273  273                                  echo $k /$j >> $SMFTMPFILE
 274  274                          done
↓ open down ↓ 44 lines elided ↑ open up ↑
 319  319                  echo "/usr/sbin/svccfg delhash -d $mfst"
 320  320                  echo "rm -f $mfst"
 321  321          done < $SMFTMPFILE > $ZONEROOT/tmp/smf_rm
 322  322  
 323  323          /usr/sbin/zlogin -S $ZONENAME /bin/sh /tmp/smf_rm >/dev/null 2>&1
 324  324  
 325  325          /usr/bin/rm -f $SMFTMPFILE
 326  326  
 327  327          # Get a list of the svcs that now exist in the zone.
 328  328          LANG=C /usr/sbin/zlogin -S $ZONENAME /usr/bin/svcs -aH | \
 329      -            /usr/bin/nawk '{print $3}' >>$insttmpfile
      329 +            /usr/xpg4/bin/awk '{print $3}' >>$insttmpfile
 330  330  
 331  331          [[ -n $LOGFILE ]] && \
 332  332              printf "[$(date)] ${MSG_PREFIX}${v_svcsinzone}\n" >&2
 333  333          [[ -n $LOGFILE ]] && cat $insttmpfile >&2
 334  334  
 335  335          #
 336  336          # Import ip-interface-management service in S10C, network
 337  337          # loopback service requires ipmgmtd in exclusive stack zones.
 338  338          #
 339  339          /usr/sbin/zlogin -S $ZONENAME /usr/sbin/svccfg import \
↓ open down ↓ 109 lines elided ↑ open up ↑
 449  449  {
 450  450          zoneconfig=$ZONEROOT/etc/zones
 451  451  
 452  452          [[ ! -d $zoneconfig ]] && return
 453  453  
 454  454          if [[ -h $zoneconfig/index || ! -f $zoneconfig/index ]]; then
 455  455                  error "$e_badfile" "/etc/zones/index"
 456  456                  return
 457  457          fi
 458  458  
 459      -        NGZ=$(/usr/bin/nawk -F: '{
      459 +        NGZ=$(/usr/xpg4/bin/awk -F: '{
 460  460                  if (substr($1, 0, 1) == "#" || $1 == "global")
 461  461                          continue
 462  462  
 463  463                  if ($2 == "installed")
 464  464                          printf("%s ", $1)
 465  465          }' $zoneconfig/index)
 466  466  
 467  467          # Return if there are no installed zones to warn about.
 468  468          [[ -z "$NGZ" ]] && return
 469  469  
 470  470          log "$v_rmzones" "$NGZ"
 471  471  
 472      -        NGZP=$(/usr/bin/nawk -F: '{
      472 +        NGZP=$(/usr/xpg4/bin/awk -F: '{
 473  473                  if (substr($1, 0, 1) == "#" || $1 == "global")
 474  474                          continue
 475  475  
 476  476                  if ($2 == "installed")
 477  477                          printf("%s ", $3)
 478  478          }' $zoneconfig/index)
 479  479  
 480  480          log "$v_rmzonepaths"
 481  481  
 482  482          for i in $NGZP
↓ open down ↓ 92 lines elided ↑ open up ↑
 575  575  
 576  576  log "$v_adjust"
 577  577  
 578  578  #
 579  579  # Any errors in these functions are not considered fatal.  The zone can be
 580  580  # be fixed up manually afterwards and it may need some additional manual
 581  581  # cleanup in any case.
 582  582  #
 583  583  
 584  584  STACK_TYPE=$(/usr/sbin/zoneadm -z $ZONENAME list -p | \
 585      -    /usr/bin/nawk -F: '{print $7}')
      585 +    /usr/xpg4/bin/awk -F: '{print $7}')
 586  586  if (( $? != 0 )); then
 587  587          error "$e_badinfo" "stacktype"
 588  588  fi
 589  589  vlog "$v_stacktype" "$STACK_TYPE"
 590  590  
 591  591  fix_lu
 592  592  fix_net
 593  593  fix_nfs
 594  594  fix_vfstab
 595  595  
↓ open down ↓ 22 lines elided ↑ open up ↑
 618  618  hollow_dir_list=$(mktemp $ZONEROOT/.hollow.pkgs.dirs.XXXXXX)
 619  619  [ -f "$hollow_pkgs" -a -f "$hollow_file_list" -a -f "$hollow_dir_list" ] || {
 620  620          error "$e_tmpfile"
 621  621          rm -f $hollow_pkgs $hollow_file_list $hollow_dir_list
 622  622          fatal "$e_exitfail"
 623  623  }
 624  624  for pkg_name in $ZONEROOT/var/sadm/pkg/*; do
 625  625          grep 'SUNW_PKG_HOLLOW=true' $pkg_name/pkginfo >/dev/null 2>&1 && \
 626  626              basename $pkg_name >>$hollow_pkgs
 627  627  done
 628      -/usr/bin/nawk -v hollowpkgs=$hollow_pkgs -v filelist=$hollow_file_list \
      628 +/usr/xpg4/bin/awk -v hollowpkgs=$hollow_pkgs -v filelist=$hollow_file_list \
 629  629      -v dirlist=$hollow_dir_list '
 630  630          BEGIN {
 631  631                  while (getline p <hollowpkgs > 0)
 632  632                          pkgs[p] = 1;
 633  633                  close(hollowpkgs);
 634  634          }
 635  635          {
 636  636                  # fld is the field where the pkg names begin.
 637  637                  # nm is the file/dir entry name.
 638  638                  if ($2 == "f") {
↓ open down ↓ 84 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX