Home | History | Annotate | Download | only in ext-sources
      1 #!/bin/sh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License, Version 1.0 only
      7 # (the "License").  You may not use this file except in compliance
      8 # with the License.
      9 #
     10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     11 # or http://www.opensolaris.org/os/licensing.
     12 # See the License for the specific language governing permissions
     13 # and limitations under the License.
     14 #
     15 # When distributing Covered Code, include this CDDL HEADER in each
     16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     17 # If applicable, add the following below this CDDL HEADER, with the
     18 # fields enclosed by brackets "[]" replaced with your own identifying
     19 # information: Portions Copyright [yyyy] [name of copyright owner]
     20 #
     21 # CDDL HEADER END
     22 #
     23 #
     24 # Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 #ident	"@(#)i.manifest	1.6	05/06/08 SMI"
     28 #
     29 # i.manifest - smf(5) service manifest install class action script
     30 #
     31 
     32 repfile=$PKG_INSTALL_ROOT/etc/svc/repository.db
     33 export repfile
     34 
     35 #
     36 # If the repository does not yet exist, create it from the appropriate seed.  If
     37 # for some reason the seeds do not exist, svccfg(1M) will create the repository
     38 # automatically.
     39 #
     40 if [ ! -f $repfile ]; then
     41 	if [ -n "$SUNW_PKG_INSTALL_ZONENAME" -a \
     42 	    "$SUNW_PKG_INSTALL_ZONENAME" != "global" ]; then
     43 		[ -f $PKG_INSTALL_ROOT/lib/svc/seed/nonglobal.db ] && \
     44 		/usr/bin/cp $PKG_INSTALL_ROOT/lib/svc/seed/nonglobal.db \
     45 		    $repfile
     46 	else
     47 		[ -f $PKG_INSTALL_ROOT/lib/svc/seed/global.db ] && \
     48 		/usr/bin/cp $PKG_INSTALL_ROOT/lib/svc/seed/global.db \
     49 		    $repfile
     50 	fi
     51 	/usr/bin/chmod 0600 $repfile
     52 	/usr/bin/chown root:sys $repfile
     53 fi
     54 
     55 if [ ! -r $PKG_INSTALL_ROOT/etc/svc/volatile/repository_door ]; then
     56 	#
     57 	# smf(5) is not presently running for the destination environment.
     58 	# Since we presently cannot refresh without a running svc.startd(1M), we
     59 	# cannot consistently handle dependent placement.  Defer to next boot.
     60 	#
     61 	while read src dst; do
     62 		/usr/bin/cp -p $src $dst
     63 	done
     64 else
     65 	#
     66 	# Local package install.
     67 	#
     68 	while read src dst; do
     69 		/usr/bin/cp -p $src $dst
     70 
     71 		[ "$PKG_INSTALL_ROOT" = "" -o "$PKG_INSTALL_ROOT" = "/" ] && \
     72 		    SVCCFG_CHECKHASH=1 /usr/sbin/svccfg import $dst
     73 	done
     74 fi
     75 
     76 exit 0
     77