Print this page
7818 SMF does not always cleanup services that have been removed
Reviewed by: Joshua M. Clulow <josh@sysmgr.org>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svc/milestone/manifest-import
          +++ new/usr/src/cmd/svc/milestone/manifest-import
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13  #
  14   14  # When distributing Covered Code, include this CDDL HEADER in each
  15   15  # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16  # If applicable, add the following below this CDDL HEADER, with the
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
       23 +# Copyright 2017 RackTop Systems.
  23   24  #
  24   25  
  25   26  # 0a  Initialization.
  26   27  
  27   28  [ -f /lib/svc/share/smf_include.sh ] || exit 1
  28   29  
  29   30  . /lib/svc/share/smf_include.sh
  30   31  
  31   32  activity=false
  32   33  
↓ open down ↓ 33 lines elided ↑ open up ↑
  66   67  [ -n "$ALT_MFST_DIR" -a -z "$ALT_REPOSITORY" ] && usage
  67   68  
  68   69  function svccfg_apply {
  69   70          $X /usr/sbin/svccfg apply $1
  70   71          if [ $? -ne 0 ]; then
  71   72                  echo "WARNING: svccfg apply $1 failed" | tee /dev/msglog
  72   73          fi
  73   74  }
  74   75  
  75   76  #
  76      -# If the smf/manifest table has file entries that are missing
       77 +# If the smf repository has file entries that are missing
  77   78  # then there is work to be done by the cleanup process.
  78   79  #
  79   80  function cleanup_needwork {
  80      -        if [ "$early" == true ]; then
  81      -                smfmfiles=`/usr/bin/svcprop smf/manifest | \
  82      -                    awk '(/^lib_/ && /\/manifestfile /) {print $3}'`
  83      -        else
  84      -                smfmfiles=`/usr/bin/svcprop smf/manifest | \
  85      -                    awk '/\/manifestfile / {print $3}'`
  86      -        fi
       81 +        smfmfiles=`svcprop -p manifestfiles '*' 2>/dev/null |
       82 +            nawk -v early="$early" '$2 == "astring" &&
       83 +            (early != "true" || $3 ~ "^/lib/") { print $3 }'`
  87   84  
  88   85          nw=`/lib/svc/bin/mfstscan $smfmfiles 2>&1 1>/dev/null`
  89   86          [ "$nw" ] && return 1
  90   87  
  91   88          return 0
  92   89  }
  93   90  
  94   91  #
  95   92  # Upon upgrading to early manifest import code, preserve hashes of system
  96   93  # profiles which lived under /var/svc/profile so that svccfg apply would
↓ open down ↓ 412 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX