preinstall revision e3320f40ba20e6851e73a3237eedf089700bf001
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrens# CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrens# The contents of this file are subject to the terms of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock# Common Development and Distribution License (the "License").
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock# You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrens# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens# or http://www.opensolaris.org/os/licensing.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens# and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrens# When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens# fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens# information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrens# CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
44cb6abc89aa591c23f5e58296c6d2a29302344abmc# Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrens# When first introduced the /etc/inet/ipnodes file was seperate from
fa9e4066f08beec538e775443c5be79dd423fcabahrens# /etc/inet/hosts. It is now a symbolic link to /etc/inet/hosts. The
c9431fa1e59a88c2f0abf611f25b97af964449e5ahl# i.hosts class action script merges the saved temporary ipnodes file
fa9e4066f08beec538e775443c5be79dd423fcabahrens# into a single hosts file.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrensif [ ! -h $BASEDIR/etc/inet/ipnodes ]; then
c9431fa1e59a88c2f0abf611f25b97af964449e5ahl if [ -f $BASEDIR/etc/inet/ipnodes ]; then
c9431fa1e59a88c2f0abf611f25b97af964449e5ahl cp -f $BASEDIR/etc/inet/ipnodes \
fa9e4066f08beec538e775443c5be79dd423fcabahrens $BASEDIR/etc/inet/ipnodes.hostsmerge
c9431fa1e59a88c2f0abf611f25b97af964449e5ahl fi
fa9e4066f08beec538e775443c5be79dd423fcabahrensfi
c9431fa1e59a88c2f0abf611f25b97af964449e5ahl
c9431fa1e59a88c2f0abf611f25b97af964449e5ahl#
95173954d2b811ceb583a9012c3b16e1d0dd6438ek# TIMEZONE.temp is processed and removed by the i.definit class action
5ad820458efd0fdb914baff9c1447c22b819fa23nd# script.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#
fa9e4066f08beec538e775443c5be79dd423fcabahrensif [ -f $BASEDIR/etc/TIMEZONE ] ; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens cp $BASEDIR/etc/TIMEZONE $BASEDIR/etc/TIMEZONE.temp
fa9e4066f08beec538e775443c5be79dd423fcabahrensfi
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens# mail.ABCsavedXYZ is processed and removed by postinstall
95173954d2b811ceb583a9012c3b16e1d0dd6438ekif [ -h $BASEDIR/var/mail ] ; then
95173954d2b811ceb583a9012c3b16e1d0dd6438ek rm -rf $BASEDIR/var/mail.ABCsavedXYZ
95173954d2b811ceb583a9012c3b16e1d0dd6438ek mv $BASEDIR/var/mail $BASEDIR/var/mail.ABCsavedXYZ
95173954d2b811ceb583a9012c3b16e1d0dd6438ekfi
95173954d2b811ceb583a9012c3b16e1d0dd6438ek
fa9e4066f08beec538e775443c5be79dd423fcabahrens# news.ABCsavedXYZ is processed and removed by postinstall
fa9e4066f08beec538e775443c5be79dd423fcabahrensif [ -h $BASEDIR/var/news ] ; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens rm -rf $BASEDIR/var/news.ABCsavedXYZ
fa9e4066f08beec538e775443c5be79dd423fcabahrens mv $BASEDIR/var/news $BASEDIR/var/news.ABCsavedXYZ
fa9e4066f08beec538e775443c5be79dd423fcabahrensfi
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensCLEANUP=/tmp/CLEANUP
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensprint_dhcptags_warning() {
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens cat >> $CLEANUP <<-EOF
fa9e4066f08beec538e775443c5be79dd423fcabahrens You have made changes to /etc/dhcp/dhcptags, which has been superseded
fa9e4066f08beec538e775443c5be79dd423fcabahrens by /etc/dhcp/inittab, as documented in dhcp_inittab(4). Please refer
fa9e4066f08beec538e775443c5be79dd423fcabahrens to the DHCP documentation in the Answerbook for information on how to
fa9e4066f08beec538e775443c5be79dd423fcabahrens convert your existing customizations.
fa9e4066f08beec538e775443c5be79dd423fcabahrens EOF
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens
44cb6abc89aa591c23f5e58296c6d2a29302344abmcif [ "x$UPDATE" = xyes ]; then
44cb6abc89aa591c23f5e58296c6d2a29302344abmc
44cb6abc89aa591c23f5e58296c6d2a29302344abmc DHCPTAGS=$BASEDIR/etc/dhcp/dhcptags
44cb6abc89aa591c23f5e58296c6d2a29302344abmc
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # If the dhcptags file has been modified, then install moved
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # it to a funky name like /etc/dhcp/dhcptags:8. Use this as
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # an opportunity to issue a warning to the user. Since the
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # file may be left over from a previous upgrade, only issue
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # the warning if the current package database is familiar with
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # the file.
44cb6abc89aa591c23f5e58296c6d2a29302344abmc #
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # The construct ${PKG_INSTALL_ROOT:-/} is used instead of
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # $PKG_INSTALL_ROOT/ because the packaging subsystem will
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # think we're changing the path (from $PKG_INSTALL_ROOT to
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # $PKG_INSTALL_ROOT/) and will output spurious warnings.
44cb6abc89aa591c23f5e58296c6d2a29302344abmc #
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # We need to pass in the -R since otherwise we will get a
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # warning from a `make install' on this package that we may
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # be accessing a stale package database (in fact, this won't
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # happen since installf and friends inherit the
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # $PKG_INSTALL_ROOT environment variable). Note that the -R
44cb6abc89aa591c23f5e58296c6d2a29302344abmc # must be on the same line as the command it's used with.
44cb6abc89aa591c23f5e58296c6d2a29302344abmc #
fa9e4066f08beec538e775443c5be79dd423fcabahrens # ${CLIENT_BASEDIR}foo is used instead of $CLIENT_BASEDIR/foo
fa9e4066f08beec538e775443c5be79dd423fcabahrens # because the packaging commands don't always realize that
fa9e4066f08beec538e775443c5be79dd423fcabahrens # //foo and /foo are the same file.
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ "`echo $DHCPTAGS:*`" != "$DHCPTAGS:*" ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens pkgchk -l -R ${PKG_INSTALL_ROOT:-/} \
fa9e4066f08beec538e775443c5be79dd423fcabahrens -p ${CLIENT_BASEDIR}etc/dhcp/dhcptags $PKGINST | \
fa9e4066f08beec538e775443c5be79dd423fcabahrens grep -i installed > /dev/null 2>&1 && \
fa9e4066f08beec538e775443c5be79dd423fcabahrens print_dhcptags_warning
c25056de36a33f2a76f79dcf64593f731d258013gw fi
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensfi
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens# We apply the limited profile on initial installs of the OS and of
fa9e4066f08beec538e775443c5be79dd423fcabahrens# initial installs of zones. We don't apply it on upgrades or patches.
fa9e4066f08beec538e775443c5be79dd423fcabahrens
c25056de36a33f2a76f79dcf64593f731d258013gwif [ "x$PKG_INIT_INSTALL" = "xTRUE" ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens touch $BASEDIR/var/SUNWcsr-apply-limited-net
fa9e4066f08beec538e775443c5be79dd423fcabahrenselif [ -n "$SUNW_PKG_INSTALL_ZONENAME" -a \
fa9e4066f08beec538e775443c5be79dd423fcabahrens "$SUNW_PKG_INSTALL_ZONENAME" != "global" ]; then
c25056de36a33f2a76f79dcf64593f731d258013gw touch $BASEDIR/var/SUNWcsr-apply-limited-net
fa9e4066f08beec538e775443c5be79dd423fcabahrensfi
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensif [ "$UPDATE" = yes ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens # Check for existing smf(5) manifests
fa9e4066f08beec538e775443c5be79dd423fcabahrens BASEPREFIX=`echo $BASEDIR | sed "s/\//_/g"`
c25056de36a33f2a76f79dcf64593f731d258013gw if [ -f ${PKG_INSTALL_ROOT}/var/svc/network/ipsec/ike.xml ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens IKEMANIFEST=`echo ike.xml"$BASEPREFIX" | cut -c 1-256`
fa9e4066f08beec538e775443c5be79dd423fcabahrens touch /tmp/${IKEMANIFEST}
5ad820458efd0fdb914baff9c1447c22b819fa23nd fi
fa9e4066f08beec538e775443c5be79dd423fcabahrens if [ -f ${PKG_INSTALL_ROOT}/var/svc/network/ipsec/manual-key.xml ]; then
fa9e4066f08beec538e775443c5be79dd423fcabahrens MANKEYMANIFEST=`echo manual-key.xml$BASEPREFIX" | cut -c 1-256`
fa9e4066f08beec538e775443c5be79dd423fcabahrens touch /tmp/${MANKEYMANIFEST}
fa9e4066f08beec538e775443c5be79dd423fcabahrens fi
fa9e4066f08beec538e775443c5be79dd423fcabahrensfi
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensexit 0
c25056de36a33f2a76f79dcf64593f731d258013gw