Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/lvm/etc/svm.cleanup.sh
          +++ new/usr/src/cmd/lvm/etc/svm.cleanup.sh
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14  #
  15   15  # When distributing Covered Code, include this CDDL HEADER in each
  16   16  # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  17   17  # If applicable, add the following below this CDDL HEADER, with the
  18   18  # fields enclosed by brackets "[]" replaced with your own identifying
  19   19  # information: Portions Copyright [yyyy] [name of copyright owner]
  20   20  #
  21   21  # CDDL HEADER END
  22   22  #
  23   23  #
  24      -# ident "%Z%%M% %I%     %E% SMI"
  25      -#
  26   24  # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  27   25  # Use is subject to license terms.
  28   26  #
  29   27  # SVM Flash cleanup
  30   28  # Remove existing master SVM configuration on clone after full flash install.
  31   29  # Restore existing clone SVM configuation after differential flash install.
  32   30  #
  33   31  
  34   32  IN_SYS=${FLASH_ROOT}/etc/system
  35   33  IN_CONF=${FLASH_ROOT}/kernel/drv/md.conf
↓ open down ↓ 3 lines elided ↑ open up ↑
  39   37  TMP_CONF=/var/tmp/md.conf.1
  40   38  TMP_CF=/var/tmp/mddb.cf.1
  41   39  
  42   40  # Directory where original clone config is saved.
  43   41  SAVE_DIR=${FLASH_DIR}/flash/svm
  44   42  
  45   43  if [ "${FLASH_TYPE}" = "FULL" ]; then
  46   44          # Full flash install, remove master's SVM configuration from clone.
  47   45  
  48   46          # Remove any SVM root entry from /etc/system file.
  49      -        nawk '
       47 +        /usr/xpg4/bin/awk '
  50   48          BEGIN {delroot=0}
  51   49          /^\* Begin MDD root info \(do not edit\)$/ {delroot=1}
  52   50          /^\* End MDD root info \(do not edit\)$/ {delroot=0; next}
  53   51          {if (delroot == 0) print $0}
  54   52          ' ${IN_SYS} > ${TMP_SYS}
  55   53          cp ${TMP_SYS} ${IN_SYS}
  56   54  
  57   55          # Check if we are on the mini-root.  If we are, we need to clean up the
  58   56          # mddb configuration since this implies we are doing a full flash onto
  59   57          # a fresh system.
  60   58          #
  61   59          # If we are not on the mini-root that must mean we are installing
  62   60          # the full flash via live-upgrade.  In that case we share the
  63   61          # SVM configuration with the currently running system so we
  64   62          # need to copy the md.conf file from the current root onto the
  65   63          # newly installed root.  Note that the flash archive might not have
  66   64          # been created from the currently running system.
  67   65          if [ -h /kernel/drv/md.conf ]; then
  68   66                  # Remove SVM mddb entries from /kernel/drv/md.conf.
  69      -                nawk '
       67 +                /usr/xpg4/bin/awk '
  70   68                  BEGIN {delmddb=0}
  71   69                  /^# Begin MDD database info \(do not edit\)$/ {delmddb=1}
  72   70                  /^# End MDD database info \(do not edit\)$/ {delmddb=0; next}
  73   71                  {if (delmddb == 0) print $0}
  74   72                  ' ${IN_CONF} > ${TMP_CONF}
  75   73                  cp ${TMP_CONF} ${IN_CONF}
  76   74  
  77   75                  # Remove SVM mddb entries from /etc/lvm/mddb.cf.
  78      -                nawk '
       76 +                /usr/xpg4/bin/awk '
  79   77                  /^#/ {print $0}
  80   78                  ' ${IN_CF} > ${TMP_CF}
  81   79                  cp ${TMP_CF} ${IN_CF}
  82   80  
  83   81          else
  84   82                  # copy SVM config from current root to new root
  85   83                  cp /kernel/drv/md.conf ${IN_CONF}
  86   84                  cp /etc/lvm/mddb.cf ${IN_CF}
  87   85          fi
  88   86  
↓ open down ↓ 50 lines elided ↑ open up ↑
 139  137          # Now process the various permutations for the master and clone
 140  138          # /etc/system file SVM root entries.
 141  139  
 142  140          # First check if we need to do anything with /etc/system.
 143  141          if `cmp -s ${SAVE_DIR}/system ${IN_SYS} >/dev/null 2>&1`; then
 144  142              # There is no difference so leave it alone.
 145  143              exit 0;
 146  144          fi
 147  145  
 148  146          # Get any SVM root entry from master /etc/system file.
 149      -        MASTER_ROOT=`nawk '
      147 +        MASTER_ROOT=`/usr/xpg4/bin/awk '
 150  148          BEGIN {inroot=0}
 151  149          /^\* Begin MDD root info \(do not edit\)$/ {inroot=1; next}
 152  150          /^\* End MDD root info \(do not edit\)$/ {inroot=0}
 153  151          {if (inroot == 1) print $0}
 154  152          ' ${IN_SYS}`
 155  153  
 156  154          # Get any SVM root entry from clone /etc/system file.
 157      -        CLONE_ROOT=`nawk '
      155 +        CLONE_ROOT=`/usr/xpg4/bin/awk '
 158  156          BEGIN {inroot=0}
 159  157          /^\* Begin MDD root info \(do not edit\)$/ {inroot=1; next}
 160  158          /^\* End MDD root info \(do not edit\)$/ {inroot=0}
 161  159          {if (inroot == 1) print $0}
 162  160          ' ${SAVE_DIR}/system`
 163  161  
 164  162          # If there is an SVM root entry in the master /etc/system file.
 165  163          if [ "${MASTER_ROOT}" ]; then
 166  164  
 167  165              # If there is an SVM root entry in the clone /etc/system file.
 168  166              if [ "${CLONE_ROOT}" ]; then
 169  167  
 170  168                  # Restore clone SVM root entry in /etc/system file.
 171      -                nawk -v clone_root="${CLONE_ROOT}" '
      169 +                /usr/xpg4/bin/awk -v clone_root="${CLONE_ROOT}" '
 172  170                  BEGIN {newroot=0}
 173  171                  /^\* Begin MDD root info \(do not edit\)$/ {
 174  172                      newroot=1
 175  173                      print $0
 176  174                      print clone_root
 177  175                  }
 178  176                  /^\* End MDD root info \(do not edit\)$/ {newroot=0}
 179  177                  {if (newroot == 0) print $0}
 180  178                  ' ${IN_SYS} >${TMP_SYS}
 181  179                  cp ${TMP_SYS} ${IN_SYS}
 182  180  
 183  181              else
 184  182  
 185  183                  # There is no SVM root entry in the clone so remove the entry
 186  184                  # from the /etc/system file.
 187      -                nawk '
      185 +                /usr/xpg4/bin/awk '
 188  186                  BEGIN {delroot=0}
 189  187                  /^\* Begin MDD root info \(do not edit\)$/ {delroot=1}
 190  188                  /^\* End MDD root info \(do not edit\)$/ {delroot=0; next }
 191  189                  {if (delroot == 0) print $0}
 192  190                  ' ${IN_SYS} >${TMP_SYS}
 193  191                  cp ${TMP_SYS} ${IN_SYS}
 194  192  
 195  193              fi
 196  194  
 197  195          else
↓ open down ↓ 15 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX