Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/scripts/Install.sh
          +++ new/usr/src/tools/scripts/Install.sh
↓ open down ↓ 227 lines elided ↑ open up ↑
 228  228  function tstmkdir {
 229  229          [ -d $1 ] || mkdir -p $1 || fail
 230  230  }
 231  231  
 232  232  #
 233  233  # Patch up target directories for glommed kernel.
 234  234  # usage: fixglom listfile glomname
 235  235  #
 236  236  
 237  237  function fixglom {
 238      -        nawk \
      238 +        /usr/xpg4/bin/awk \
 239  239              -v glomname=$2 \
 240  240              -v karch=$KARCH ' 
 241  241          $1 == "MOD" || $1 == "SYMLINK" {
 242  242                  sub(/^platform.*kernel/, "platform/" karch "/" glomname, $4)
 243  243                  sub(/^kernel/, "platform/" karch "/" glomname, $4)
 244  244                  sub(/^usr.kernel/, "platform/" karch "/" glomname, $4)
 245  245                  print
 246  246          }
 247  247          $1 == "LINK" {
 248  248                  sub(/^platform.*kernel/, "platform/" karch "/" glomname, $3)
↓ open down ↓ 14 lines elided ↑ open up ↑
 263  263          mv $1.new $1
 264  264  }
 265  265  
 266  266  #
 267  267  # Filter out implementation-specific modules, unless that
 268  268  # implementation was requested by the user.
 269  269  # usage: filtimpl listfile implname
 270  270  #
 271  271  
 272  272  function filtimpl {
 273      -        nawk \
      273 +        /usr/xpg4/bin/awk \
 274  274              -v impl=$2 '
 275  275          $1 == "MOD" || $1 == "SYMLINK" {
 276  276                  if ($6 == "all" || $6 == impl)
 277  277                          print
 278  278          }
 279  279          $1 == "CONF" {
 280  280                  if ($5 == "all" || $5 == impl)
 281  281                          print
 282  282          }
 283  283          $1 == "LINK" {
↓ open down ↓ 2 lines elided ↑ open up ↑
 286  286          }
 287  287          ' $1 > $1.new
 288  288          mv $1.new $1
 289  289  }
 290  290  
 291  291  #
 292  292  # Filter the module list to match the user's request.
 293  293  # Usage: filtmod listfile modules
 294  294  #
 295  295  function filtmod {
 296      -        nawk -v reqstring="$2" '
      296 +        /usr/xpg4/bin/awk -v reqstring="$2" '
 297  297          function modmatch(modname) {
 298  298                  if (reqstring == "All") {
 299  299                          return (1)
 300  300                  } else if (reqstring == "Modules") {
 301  301                          if (modname != "unix" && modname != "genunix")
 302  302                                  return (1)
 303  303                  } else {
 304  304                          if (modname in reqmods)
 305  305                                  return (1)
 306  306                  }
↓ open down ↓ 139 lines elided ↑ open up ↑
 446  446                  $INSTALL_CP $4/$conffile $target
 447  447                  ;;
 448  448          *)
 449  449                  fail "unrecognized modlist entry: $*"
 450  450                  ;;
 451  451          esac
 452  452  }
 453  453  
 454  454  # Sanity-check the given module list.
 455  455  function check_modlist {
 456      -        nawk '
      456 +        /usr/xpg4/bin/awk '
 457  457          BEGIN {
 458  458                  nfields["MOD"] = 6
 459  459                  nfields["CONF"] = 6
 460  460                  nfields["LINK"] = 7
 461  461                  nfields["SYMLINK"] = 7
 462  462          }
 463  463          {
 464  464                  # This also catches unknown tags.
 465  465                  if (nfields[$1] != NF) {
 466  466                          print "error: invalid modlist record:"
↓ open down ↓ 482 lines elided ↑ open up ↑
 949  949  
 950  950  TARFILE=$INSTALL_DIR/Install.${KARCH}.tar
 951  951  INSTALL_FILES=$INSTALL_DIR/$KARCH
 952  952  
 953  953  #
 954  954  # Extract the target machine and target directory from a target of the
 955  955  # form [user@]machine:/dir .
 956  956  #
 957  957  
 958  958  if [ "$IMODE" != "n" ]; then
 959      -        eval `echo $TARGET | nawk -F':' '{ 
      959 +        eval `echo $TARGET | /usr/xpg4/bin/awk -F':' '{ 
 960  960                  if (NF != 2 || !length($1) || !length($2))
 961  961                          print "usage \"Invalid target\""
 962  962                  m = $1; d = $2
 963  963                  if ($1 ~ /@/) {
 964  964                      k = split($1, f, "@");
 965  965                      if (k != 2 || !length(f[1]) || !length (f[2]))
 966  966                              print "usage \"Invalid target\""
 967  967                      u = f[1]; m = f[2]
 968  968                  }
 969  969                  print "TARGET_USER=" u ";"
↓ open down ↓ 89 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX