6331N/A#!/bin/sh
6331N/A#
6331N/A#
6331N/A# CDDL HEADER START
6331N/A#
6331N/A# The contents of this file are subject to the terms of the
6331N/A# Common Development and Distribution License (the "License").
6331N/A# You may not use this file except in compliance with the License.
6331N/A#
6331N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
6331N/A# or http://www.opensolaris.org/os/licensing.
6331N/A# See the License for the specific language governing permissions
6331N/A# and limitations under the License.
6331N/A#
6331N/A# When distributing Covered Code, include this CDDL HEADER in each
6331N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6331N/A# If applicable, add the following below this CDDL HEADER, with the
6331N/A# fields enclosed by brackets "[]" replaced with your own identifying
6331N/A# information: Portions Copyright [yyyy] [name of copyright owner]
6331N/A#
6331N/A# CDDL HEADER END
6331N/A
6331N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
6331N/A# Use is subject to license terms.
6331N/A# Portions Copyright (c) 2007-2012 Jens Elkner.
6331N/A
6331N/A#
6331N/A# r.manifest - smf(5) manifest remove class action script
6331N/A#
6331N/A
6331N/Aif [ "$PKG_INSTALL_ROOT" != "" -a "$PKG_INSTALL_ROOT" != "/" ]; then
6331N/A #
6331N/A # We can't safely disable the service in this case.
6331N/A #
6331N/A smf_alive=no
6331N/Aelse
6331N/A #
6331N/A # We can verify if the service is disabled prior to
6331N/A # removal.
6331N/A #
6331N/A if [ -r /etc/svc/volatile/repository_door ]; then
6331N/A smf_alive=yes
6331N/A fi
6331N/Afi
6331N/A
6331N/AMFSTSCAN=/lib/svc/bin/mfstscan
6331N/ASVCCFG=/usr/sbin/svccfg
6331N/ASVCPROP=/usr/bin/svcprop
6331N/A
6331N/Awhile read mfst; do
6331N/A if [ "$smf_alive" = "yes" ]; then
6331N/A ENTITIES=`$SVCCFG inventory $mfst`
6331N/A
6331N/A for fmri in $ENTITIES; do
6331N/A #
6331N/A # Determine whether any of our instances are
6331N/A # enabled.
6331N/A #
6331N/A en_p=`$SVCPROP -C -p general/enabled $fmri 2>/dev/null`
6331N/A en_o=`$SVCPROP -C -p general_ovr/enabled $fmri 2>/dev/null`
6331N/A
6331N/A if [ "$en_p" = "true" -o "$en_o" = "true" ]; then
6331N/A echo "$fmri is and remains enabled -> aborting"
6331N/A exit 1
6331N/A fi
6331N/A
6331N/A [ `uname -r` = '5.10' ] && $SVCCFG delete $fmri
6331N/A done
6331N/A
6331N/A #
6331N/A # Delete the manifest hash value.
6331N/A #
6423N/A if [ `uname -r` = '5.10' ]; then
6423N/A pg_name=`$MFSTSCAN -t $mfst`
6423N/A if $SVCPROP -q -p $pg_name smf/manifest; then
6423N/A $SVCCFG -s smf/manifest delpg $pg_name
6423N/A fi
6331N/A fi
6331N/A fi
6331N/A
6331N/A /usr/bin/rm $mfst
6331N/Adone
6331N/A[ `uname -r` != '5.10' -a "$smf_alive" = "yes" ] && \
6331N/A /usr/sbin/svcadm restart manifest-import
6331N/A
6331N/Aexit 0