Home | History | Annotate | Download | only in common_files
      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 (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 #
     23 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 #ident	"%Z%%M%	%I%	%E% SMI"
     27 #
     28 # i.seedmanifest - smf(5) service manifest install class action script
     29 #   for services that must be in the seed repository.
     30 # 
     31 # PLEASE NOTE: Use of this CAS means that the SMF repository format cannot
     32 #   change, since it may need to modify an SMF repository on another system
     33 #   image.  As such, any use of this CAS must be cleared with the SMF team.
     34 #
     35 
     36 repfile=$PKG_INSTALL_ROOT/etc/svc/repository.db
     37 
     38 #
     39 # If the repository does not yet exist, create it from the appropriate seed.
     40 #
     41 if [ ! -f $repfile ]; then
     42 	if [ -n "$SUNW_PKG_INSTALL_ZONENAME" -a \
     43 	    "$SUNW_PKG_INSTALL_ZONENAME" != "global" ]; then
     44 		dbfile=nonglobal.db
     45 	else
     46 		dbfile=global.db
     47 	fi
     48 
     49 	if [ -f $PKG_INSTALL_ROOT/lib/svc/seed/$dbfile ]; then
     50 		/usr/bin/cp $PKG_INSTALL_ROOT/lib/svc/seed/$dbfile $repfile
     51 		/usr/bin/chmod 0600 $repfile
     52 		/usr/bin/chown root:sys $repfile
     53 	fi
     54 
     55 	#
     56 	# Since our service is in the seed, we're done.
     57 	#
     58 	exit 0
     59 fi
     60 
     61 while read src dst; do
     62 	/usr/bin/cp -p $src $dst
     63 
     64 	SVCCFG_REPOSITORY=$repfile SVCCFG_CHECKHASH=1 \
     65 	    /usr/sbin/svccfg import $dst
     66 done
     67 
     68 exit 0
     69