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

@@ -18,10 +18,11 @@
 # information: Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
 #
 # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2017 RackTop Systems.
 #
 
 # 0a  Initialization.
 
 [ -f /lib/svc/share/smf_include.sh ] || exit 1

@@ -71,21 +72,17 @@
                 echo "WARNING: svccfg apply $1 failed" | tee /dev/msglog
         fi
 }
 
 #
-# If the smf/manifest table has file entries that are missing
+# If the smf repository has file entries that are missing
 # then there is work to be done by the cleanup process.
 #
 function cleanup_needwork {
-        if [ "$early" == true ]; then
-                smfmfiles=`/usr/bin/svcprop smf/manifest | \
-                    awk '(/^lib_/ && /\/manifestfile /) {print $3}'`
-        else
-                smfmfiles=`/usr/bin/svcprop smf/manifest | \
-                    awk '/\/manifestfile / {print $3}'`
-        fi
+        smfmfiles=`svcprop -p manifestfiles '*' 2>/dev/null |
+            nawk -v early="$early" '$2 == "astring" &&
+            (early != "true" || $3 ~ "^/lib/") { print $3 }'`
 
         nw=`/lib/svc/bin/mfstscan $smfmfiles 2>&1 1>/dev/null`
         [ "$nw" ] && return 1
 
         return 0