Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/boot/scripts/root_archive.ksh
          +++ new/usr/src/cmd/boot/scripts/root_archive.ksh
↓ open down ↓ 198 lines elided ↑ open up ↑
 199  199  
 200  200          # always compress if fiocompress exists
 201  201          #
 202  202          if [ -x /usr/sbin/fiocompress ] ; then
 203  203                  COMPRESS=true
 204  204          fi
 205  205  
 206  206          # Estimate image size and add %10 overhead for ufs stuff.
 207  207          # Note, we can't use du here in case $UNPACKED_ROOT is on a filesystem,
 208  208          # e.g. zfs, in which the disk usage is less than the sum of the file
 209      -        # sizes.  The nawk code
      209 +        # sizes.  The awk code
 210  210          #
 211  211          #       {t += ($7 % 1024) ? (int($7 / 1024) + 1) * 1024 : $7}
 212  212          #
 213  213          # below rounds up the size of a file/directory, in bytes, to the
 214  214          # next multiple of 1024.  This mimics the behavior of ufs especially
 215  215          # with directories.  This results in a total size that's slightly
 216  216          # bigger than if du was called on a ufs directory.
 217  217          #
 218  218          # if the operation in turn is compressing the files the amount
 219  219          # of typical shrinkage is used to come up with a useful archive
 220  220          # size
 221      -        size=$(find "$UNPACKED_ROOT" -ls | nawk '
      221 +        size=$(find "$UNPACKED_ROOT" -ls | /usr/xpg4/bin/awk '
 222  222              {t += ($7 % 1024) ? (int($7 / 1024) + 1) * 1024 : $7}
 223  223              END {print int(t * 1.10 / 1024)}')
 224  224          if [ "$COMPRESS" = true ] ; then
 225      -                size=`echo $size | nawk '{s = $1} END {print int(s * 0.6)}'`
      225 +                size=`echo $size | /usr/xpg4/bin/awk '{s = $1} END {print int(s * 0.6)}'`
 226  226          fi
 227  227  
 228  228          /usr/sbin/mkfile ${size}k "$TMR"
 229  229  
 230  230          LOFIDEV=`/usr/sbin/lofiadm -a "$TMR"`
 231  231          if [ $? != 0 ] ; then
 232  232                  echo lofi plumb failed
 233  233                  exit 2
 234  234          fi
 235  235  
↓ open down ↓ 109 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX