postinstall revision 4fa4b40c293f36427faa4e3a8b0a4a82f3cb96cc
154N/A#
154N/A# CDDL HEADER START
154N/A#
154N/A# The contents of this file are subject to the terms of the
154N/A# Common Development and Distribution License (the "License").
154N/A# You may not use this file except in compliance with the License.
154N/A#
154N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
154N/A# or http://www.opensolaris.org/os/licensing.
154N/A# See the License for the specific language governing permissions
154N/A# and limitations under the License.
154N/A#
154N/A# When distributing Covered Code, include this CDDL HEADER in each
154N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
154N/A# If applicable, add the following below this CDDL HEADER, with the
154N/A# fields enclosed by brackets "[]" replaced with your own identifying
154N/A# information: Portions Copyright [yyyy] [name of copyright owner]
154N/A#
154N/A# CDDL HEADER END
154N/A#
533N/A#
154N/A#ident "%Z%%M% %I% %E% SMI"
1173N/A#
154N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
154N/A# Use is subject to license terms.
533N/A#
62N/A
61N/AONLDCPIO=/tmp/SUNWonld.cpio.$$
61N/ALINKERALIAS=linker_install@eng.sun.com
61N/A
61N/A
61N/A#
61N/A# This script handles the installation of the new sgstools on
61N/A# both Solaris10 systems (which libraries moved to '/lib') and
61N/A# pre Solaris10 systems where libraries reside under '/usr/lib'.
61N/A#
61N/A# We test to deterine if '/lib' is a symlink (pre Solaris10) or a
289N/A# directory (Solaris10 & later). We key off of that for
357N/A# everything below.
357N/A#
1510N/Aif [ -h ${BASEDIR}/lib ]
289N/Athen
61N/A LIBBASE=usr/lib
289N/A ETCLIST="etc/lib/ld.so.1 etc/lib/libdl.so.1"
289N/Aelse
289N/A LIBBASE=lib
289N/Afi
289N/Aexport LIBBASE
289N/A
1510N/A
1510N/Abuild_liblist ()
1510N/A{
1510N/A #
289N/A # Build '/lib' file list for backing up
61N/A #
155N/A cd $BASEDIR/$SGSDIR/lib
155N/A find . \( -type f -o -type l \) -print | while read file
61N/A do
61N/A if [ \( -f $BASEDIR/$LIBBASE/$file \) -o \
62N/A \( -h $BASEDIR/$LIBBASE/$file \) ]; then
62N/A echo $LIBBASE/$file
62N/A fi
62N/A done
155N/A}
62N/A
155N/Abuild_filelist()
62N/A{
155N/A #
62N/A # Build rest of files
155N/A #
62N/A cd $BASEDIR/$SGSDIR
155N/A find usr \( -type f -o -type l \) -print | while read file
62N/A do
62N/A if [ \( -f $BASEDIR/$file \) -o \
62N/A \( -h $BASEDIR/$file \) ]; then
62N/A echo $file
62N/A fi
62N/A done
62N/A}
62N/A
155N/Abuild_newitemsfile ()
62N/A{
62N/A rm -f ${SGSBACKUPDIR}.newfiles
62N/A
155N/A # Build a list of files/directories that this package is going
62N/A # add to the system that do not already exist.
1510N/A cd $BASEDIR/$SGSDIR/lib
289N/A find . -depth -print | while read file
76N/A do
62N/A # Built in /bin/sh test lacks -e
289N/A /usr/bin/test \! -e "$BASEDIR/$LIBBASE/$file"
289N/A if [ $? = 0 ]; then
289N/A echo $LIBBASE/$file >> ${SGSBACKUPDIR}.newfiles
155N/A fi
62N/A done
62N/A
155N/A cd $BASEDIR/$SGSDIR
62N/A find usr -depth -print | while read file
155N/A do
62N/A /usr/bin/test \! -e "$BASEDIR/$file"
62N/A if [ $? = 0 ]; then
62N/A echo $file >> ${SGSBACKUPDIR}.newfiles
62N/A fi
62N/A done
62N/A}
62N/A
62N/A# Generate a file containing the names of the files and directories
155N/A# that are being added (as opposed to being replaced) to the system.
62N/A# These items will need to be explicitly removed at uninstall.
155N/Abuild_newitemsfile
62N/A
155N/A
62N/A#
62N/A# backup all existing SGStools.
62N/A#
62N/ALIBLIST=`build_liblist`
62N/AFILELIST=`build_filelist`
62N/Aecho "Backup up existing SGS tools to $SGSBACKUPDIR..."
62N/Acd $BASEDIR
62N/Afor file in $LIBLIST $FILELIST $ETCLIST
155N/Ado
155N/A echo $file
62N/Adone | cpio -pdm $BASEDIR/$SGSBACKUPDIR
155N/A
62N/A
155N/A#
62N/A# Overwrite SGSTOOLS onto existing system. We use CPIO
155N/A# because rm's a file and then installs a new one
62N/A# instead of copying over a existing file. This is
62N/A# required when updating libraries (and the run-time linker)
62N/A# which are currently being used.
154N/A#
61N/A
61N/A
61N/A#
61N/A# First '/lib' components
1173N/A#
1173N/Aecho "Installing new SGSTOOLS from $BASEDIR/$SGSDIR"
1173N/A
1173N/Aprev_bindnow=$LD_BIND_NOW
1173N/ALD_BIND_NOW=1
154N/Aexport LD_BIND_NOW
533N/A
154N/Acd $BASEDIR/$SGSDIR/lib
154N/Afind . -depth -print | cpio -o -O $ONLDCPIO
154N/Acd $BASEDIR/$LIBBASE
154N/Acpio -imdu < $ONLDCPIO
154N/Arm -f $ONLDCPIO
533N/A
154N/A#
154N/A# Then everything else
154N/A#
61N/Acd $BASEDIR/$SGSDIR
61N/Afind usr -depth -print | cpio -o -O $ONLDCPIO
61N/Acd $BASEDIR
61N/Acpio -imdu < $ONLDCPIO
61N/Arm -f $ONLDCPIO
61N/A
61N/A
61N/A#
61N/A# Populate '/etc/lib' directories on systems with the
61N/A# run-time linker installed under '/usr/lib/ld.so.1'
533N/A#
61N/Aif [ "${ETCLIST}x" != "x" ]; then
155N/A cp $BASEDIR/usr/lib/ld.so.1 $BASEDIR/etc/lib/ld.so.1.onld
61N/A cp $BASEDIR/usr/lib/libdl.so.1 $BASEDIR/etc/lib/libdl.so.1.onld
61N/A cd $BASEDIR/etc/lib
61N/A mv ld.so.1.onld ld.so.1
61N/A mv libdl.so.1.onld libdl.so.1
61N/Afi
61N/A
61N/ALD_BIND_NOW=$prev_bindnow
61N/A
61N/A####
61N/A#### E-mail sent to track installations of SUNWonld package.
61N/A#### purely for statistical purposes.
61N/A####
61N/A###if [ -f /usr/lib/sendmail ]
61N/A###then
533N/A### HOSTINFO=`uname -a`
61N/A### DATE=`date`
533N/A### ENVLIST=`env`
533N/A### /usr/lib/sendmail $LINKERALIAS << EOF
533N/A###To: $LINKERALIAS
533N/A###Subject: SUNWonld Linker Package Installation: $PRODVERS
533N/A###Content-type: text/plain
533N/A###Precedence: junk
533N/A###--------
61N/A###
61N/A###Package Installation
62N/A###uname: $HOSTINFO
62N/A###date: $DATE
61N/A###VERSION: $VERSION
62N/A###ENV:
61N/A###$ENVLIST
533N/A###$ENV
533N/A###
533N/A###.
62N/A###EOF
533N/A###fi
155N/A
1173N/A