6331N/A#!/bin/sh
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# i.manifest - smf(5) service manifest install class action script
6331N/A#
6331N/A
6331N/Arepfile=$PKG_INSTALL_ROOT/etc/svc/repository.db
6331N/Aexport repfile
6331N/A
6331N/A#
6331N/A# If the repository does not yet exist, create it from the appropriate seed. If
6331N/A# for some reason the seeds do not exist, svccfg(1M) will create the repository
6331N/A# automatically.
6331N/A#
6331N/Aif [ ! -f $repfile ]; then
6331N/A if [ -n "$SUNW_PKG_INSTALL_ZONENAME" -a \
6331N/A "$SUNW_PKG_INSTALL_ZONENAME" != "global" ]; then
6331N/A [ -f $PKG_INSTALL_ROOT/lib/svc/seed/nonglobal.db ] && \
6331N/A /usr/bin/cp $PKG_INSTALL_ROOT/lib/svc/seed/nonglobal.db \
6331N/A $repfile
6331N/A else
6331N/A [ -f $PKG_INSTALL_ROOT/lib/svc/seed/global.db ] && \
6331N/A /usr/bin/cp $PKG_INSTALL_ROOT/lib/svc/seed/global.db \
6331N/A $repfile
6331N/A fi
6331N/A /usr/bin/chmod 0600 $repfile
6331N/A /usr/bin/chown root:sys $repfile
6331N/Afi
6331N/A
6331N/Aosrel=`uname -r`
6331N/Aif [ ! -r $PKG_INSTALL_ROOT/etc/svc/volatile/repository_door ]; then
6331N/A #
6331N/A # smf(5) is not presently running for the destination environment.
6331N/A # Since we presently cannot refresh without a running svc.startd(1M), we
6331N/A # cannot consistently handle dependent placement. Defer to next boot.
6331N/A #
6331N/A while read src dst; do
6331N/A if [ "$osrel" = '5.10' ]; then
6331N/A /usr/bin/sed -e "s#@CLIENT_BASEDIR@#${CLIENT_BASEDIR}#g" \
6331N/A -e 's,<pg_pattern,<!-- pg_pattern,' \
6331N/A -e 's,</pg_pattern>,</pg_pattern -->,' $src >$dst
6331N/A else
6331N/A /usr/bin/sed -e "s#@CLIENT_BASEDIR@#${CLIENT_BASEDIR}#g" $src >$dst
6331N/A fi
6331N/A done
6331N/Aelse
6331N/A #
6331N/A # Local package install.
6331N/A #
6331N/A while read src dst; do
6331N/A if [ "$osrel" = '5.10' ]; then
6331N/A /usr/bin/sed -e "s#@CLIENT_BASEDIR@#${CLIENT_BASEDIR}#g" \
6331N/A -e 's,<pg_pattern,<!-- pg_pattern,' \
6331N/A -e 's,</pg_pattern>,</pg_pattern -->,' $src >$dst
6331N/A else
6331N/A /usr/bin/sed -e "s#@CLIENT_BASEDIR@#${CLIENT_BASEDIR}#g" $src >$dst
6331N/A fi
6331N/A
6331N/A if [ "$PKG_INSTALL_ROOT" = "" -o "$PKG_INSTALL_ROOT" = "/" ]; then
6331N/A SVCCFG_CHECKHASH=1
6331N/A [ "$osrel" = '5.10' ] && /usr/sbin/svccfg import $dst
6331N/A fi
6331N/A done
6331N/A if [ "$osrel" != '5.10' -a "$SVCCFG_CHECKHASH" = '1' ]; then
6331N/A [ "$PKG_INSTALL_ROOT" = "" -o "$PKG_INSTALL_ROOT" = "/" ] && \
6331N/A /usr/sbin/svcadm restart manifest-import
6331N/A fi
6331N/Afi
6331N/A
6331N/Aexit 0