Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/brand/shared/zone/common.ksh
          +++ new/usr/src/lib/brand/shared/zone/common.ksh
↓ open down ↓ 241 lines elided ↑ open up ↑
 242  242  #               dir: /opt
 243  243  #               special: /opt
 244  244  #               raw not specified
 245  245  #               type: lofs
 246  246  #               options: [noexec,ro,noatime]
 247  247  #
 248  248  # and it assumes the order of the fs properties as above.
 249  249  #
 250  250  get_fs_info()
 251  251  {
 252      -        zonecfg -z $zonename info fs | nawk '{
      252 +        zonecfg -z $zonename info fs | /usr/xpg4/bin/awk '{
 253  253                  if ($1 == "options:") {
 254  254                          # Remove brackets.
 255  255                          options=substr($2, 2, length($2) - 2);
 256  256                          printf("%s %s %s %s\n", dir, type, special, options);
 257  257                  } else if ($1 == "dir:") {
 258  258                          dir=$2;
 259  259                  } else if ($1 == "special:") {
 260  260                          special=$2;
 261  261                  } else if ($1 == "type:") {
 262  262                          type=$2
↓ open down ↓ 4 lines elided ↑ open up ↑
 267  267  #
 268  268  # Mount zonecfg fs entries into the zonepath.
 269  269  #
 270  270  mnt_fs()
 271  271  {
 272  272          if [ ! -s $fstmpfile ]; then
 273  273                  return;
 274  274          fi
 275  275  
 276  276          # Sort the fs entries so we can handle nested mounts.
 277      -        sort $fstmpfile | nawk -v zonepath=$zonepath '{
      277 +        sort $fstmpfile | /usr/xpg4/bin/awk -v zonepath=$zonepath '{
 278  278                  if (NF == 4)
 279  279                          options="-o " $4;
 280  280                  else
 281  281                          options=""
 282  282  
 283  283                  # Create the mount point.  Ignore errors since we might have
 284  284                  # a nested mount with a pre-existing mount point.
 285  285                  cmd="/usr/bin/mkdir -p " zonepath "/root" $1 " >/dev/null 2>&1"
 286  286                  system(cmd);
 287  287  
↓ open down ↓ 9 lines elided ↑ open up ↑
 297  297  #
 298  298  # Unmount zonecfg fs entries from the zonepath.
 299  299  #
 300  300  umnt_fs()
 301  301  {
 302  302          if [ ! -s $fstmpfile ]; then
 303  303                  return;
 304  304          fi
 305  305  
 306  306          # Reverse sort the fs entries so we can handle nested unmounts.
 307      -        sort -r $fstmpfile | nawk -v zonepath=$zonepath '{
      307 +        sort -r $fstmpfile | /usr/xpg4/bin/awk -v zonepath=$zonepath '{
 308  308                  cmd="/usr/sbin/umount " zonepath "/root" $1
 309  309                  if (system(cmd) != 0) {
 310  310                          printf("command failed: %s\n", cmd);
 311  311                  }
 312  312          }' >>$LOGFILE
 313  313  }
 314  314  
 315  315  # Find the dataset mounted on the zonepath.
 316  316  get_zonepath_ds() {
 317  317          ZONEPATH_DS=`/usr/sbin/zfs list -H -t filesystem -o name,mountpoint | \
 318      -            /usr/bin/nawk -v zonepath=$1 '{
      318 +            /usr/xpg4/bin/awk -v zonepath=$1 '{
 319  319                  if ($2 == zonepath)
 320  320                          print $1
 321  321          }'`
 322  322  
 323  323          if [ -z "$ZONEPATH_DS" ]; then
 324  324                  fail_fatal "$f_no_ds"
 325  325          fi
 326  326  }
 327  327  
 328  328  #
↓ open down ↓ 233 lines elided ↑ open up ↑
 562  562  # variable to the location where the achive should be unpacked.
 563  563  #
 564  564  get_archive_base()
 565  565  {
 566  566          stage1=$1
 567  567          archive=$2
 568  568          stage2=$3
 569  569  
 570  570          vlog "$m_analyse_archive"
 571  571  
 572      -        base=`$stage1 $archive | $stage2 2>/dev/null | nawk -F/ '{
      572 +        base=`$stage1 $archive | $stage2 2>/dev/null | /usr/xpg4/bin/awk -F/ '{
 573  573                  # Check for an absolute path archive
 574  574                  if (substr($0, 1, 1) == "/")
 575  575                          exit 1
 576  576  
 577  577                  if ($1 != ".")
 578  578                          dirs[$1] = 1
 579  579                  else
 580  580                          dirs[$2] = 1
 581  581          }
 582  582          END {
↓ open down ↓ 485 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX