Home | History | Annotate | Download | only in SUNWcsr
      1 #
      2 # CDDL HEADER START
      3 #
      4 # The contents of this file are subject to the terms of the
      5 # Common Development and Distribution License (the "License").
      6 # You may not use this file except in compliance with the License.
      7 #
      8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9 # or http://www.opensolaris.org/os/licensing.
     10 # See the License for the specific language governing permissions
     11 # and limitations under the License.
     12 #
     13 # When distributing Covered Code, include this CDDL HEADER in each
     14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15 # If applicable, add the following below this CDDL HEADER, with the
     16 # fields enclosed by brackets "[]" replaced with your own identifying
     17 # information: Portions Copyright [yyyy] [name of copyright owner]
     18 #
     19 # CDDL HEADER END
     20 #
     21 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     22 # Use is subject to license terms.
     23 #
     24 
     25 #
     26 # When first introduced the /etc/inet/ipnodes file was seperate from
     27 # /etc/inet/hosts.  It is now a symbolic link to /etc/inet/hosts.  The
     28 # i.hosts class action script merges the saved temporary ipnodes file 
     29 # into a single hosts file.
     30 #
     31 if [ ! -h $BASEDIR/etc/inet/ipnodes ]; then
     32 	if [ -f $BASEDIR/etc/inet/ipnodes ]; then
     33 		cp -f $BASEDIR/etc/inet/ipnodes \
     34 			$BASEDIR/etc/inet/ipnodes.hostsmerge
     35 	fi
     36 fi
     37 
     38 #
     39 # TIMEZONE.temp is processed and removed by the i.definit class action
     40 # script.
     41 #
     42 if [ -f $BASEDIR/etc/TIMEZONE ] ; then
     43 	cp $BASEDIR/etc/TIMEZONE $BASEDIR/etc/TIMEZONE.temp
     44 fi
     45 
     46 # mail.ABCsavedXYZ is processed and removed by postinstall
     47 if [ -h $BASEDIR/var/mail ] ; then
     48 	rm -rf $BASEDIR/var/mail.ABCsavedXYZ
     49 	mv $BASEDIR/var/mail $BASEDIR/var/mail.ABCsavedXYZ
     50 fi
     51 
     52 # news.ABCsavedXYZ is processed and removed by postinstall
     53 if [ -h $BASEDIR/var/news ] ; then
     54 	rm -rf $BASEDIR/var/news.ABCsavedXYZ
     55 	mv $BASEDIR/var/news $BASEDIR/var/news.ABCsavedXYZ
     56 fi
     57 
     58 CLEANUP=/tmp/CLEANUP
     59 
     60 print_dhcptags_warning() {
     61 
     62 	cat >> $CLEANUP <<-EOF
     63 	You have made changes to /etc/dhcp/dhcptags, which has been superseded
     64 	by /etc/dhcp/inittab, as documented in dhcp_inittab(4).  Please refer
     65 	to the DHCP documentation in the Answerbook for information on how to
     66 	convert your existing customizations.
     67 	EOF
     68 }
     69 
     70 if [ "x$UPDATE" = xyes ]; then
     71 
     72 	DHCPTAGS=$BASEDIR/etc/dhcp/dhcptags
     73 
     74 	# If the dhcptags file has been modified, then install moved
     75 	# it to a funky name like /etc/dhcp/dhcptags:8.  Use this as
     76 	# an opportunity to issue a warning to the user.  Since the
     77 	# file may be left over from a previous upgrade, only issue
     78 	# the warning if the current package database is familiar with
     79 	# the file.
     80 	#
     81 	# The construct ${PKG_INSTALL_ROOT:-/} is used instead of
     82 	# $PKG_INSTALL_ROOT/ because the packaging subsystem will
     83 	# think we're changing the path (from $PKG_INSTALL_ROOT to
     84 	# $PKG_INSTALL_ROOT/) and will output spurious warnings.
     85 	#
     86 	# We need to pass in the -R since otherwise we will get a
     87 	# warning from a `make install' on this package that we may
     88 	# be accessing a stale package database (in fact, this won't
     89 	# happen since installf and friends inherit the
     90 	# $PKG_INSTALL_ROOT environment variable).  Note that the -R
     91 	# must be on the same line as the command it's used with.
     92 	#
     93 	# ${CLIENT_BASEDIR}foo is used instead of $CLIENT_BASEDIR/foo
     94 	# because the packaging commands don't always realize that
     95 	# //foo and /foo are the same file.
     96 
     97 	if [ "`echo $DHCPTAGS:*`" != "$DHCPTAGS:*" ]; then
     98 		pkgchk -l -R ${PKG_INSTALL_ROOT:-/}			\
     99 		    -p ${CLIENT_BASEDIR}etc/dhcp/dhcptags $PKGINST |    \
    100 		    grep -i installed > /dev/null 2>&1 &&		\
    101 		    print_dhcptags_warning
    102 	fi	
    103 
    104 fi
    105 
    106 # We apply the limited profile on initial installs of the OS and on
    107 # initial installs of zones. We don't apply it on upgrades or patches.
    108 
    109 if [ "x$PKG_INIT_INSTALL" = "xTRUE" ]; then
    110 	touch $BASEDIR/var/SUNWcsr-apply-limited-net
    111 elif [ -n "$SUNW_PKG_INSTALL_ZONENAME" -a \
    112     "$SUNW_PKG_INSTALL_ZONENAME" != "global" ]; then
    113 	touch $BASEDIR/var/SUNWcsr-apply-limited-net
    114 fi
    115 
    116 if [ "$UPDATE" = yes ]; then
    117 	# Check for existing smf(5) manifests
    118 	BASEPREFIX=`echo $BASEDIR | sed "s/\//_/g"`
    119 	if [ -f ${PKG_INSTALL_ROOT}/var/svc/network/ipsec/ike.xml ]; then
    120 		IKEMANIFEST=`echo ike.xml"$BASEPREFIX" | cut -c 1-256`
    121 		touch /tmp/${IKEMANIFEST}
    122 	fi
    123 	if [ -f ${PKG_INSTALL_ROOT}/var/svc/network/ipsec/manual-key.xml ]; then
    124 		MANKEYMANIFEST=`echo manual-key.xml$BASEPREFIX" | cut -c 1-256`
    125 		touch /tmp/${MANKEYMANIFEST}
    126 	fi
    127 fi
    128 
    129 # Presence of this temp file will tell postinstall script
    130 # that the vtdaemon service is already installed, in which case
    131 # the current service state will be preserved, be it enabled
    132 # or disabled.
    133 rm -f $PKG_INSTALL_ROOT/var/tmp/vtdaemon_installed.tmp > /dev/null 2>&1
    134 
    135 if [ -f $PKG_INSTALL_ROOT/var/svc/manifest/system/vtdaemon.xml ]; then
    136         touch $PKG_INSTALL_ROOT/var/tmp/vtdaemon_installed.tmp
    137 fi
    138 
    139 exit 0
    140