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.
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.
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]
22 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
26 ONLDCPIO=/tmp/SUNWonld.cpio.$$
30 # This script handles the installation of the new sgstools on
31 # both Solaris10 systems (which libraries moved to '/lib') and
32 # pre Solaris10 systems where libraries reside under '/usr/lib'.
34 # We test to deterine if '/lib' is a symlink (pre Solaris10) or a
35 # directory (Solaris10 & later). We key off of that for
38 if [ -h ${BASEDIR}/lib ]
41 ETCLIST="etc/lib/ld.so.1 etc/lib/libdl.so.1"
51 # Build '/lib' file list for backing up
53 cd $BASEDIR/$SGSDIR/lib
54 find . \( -type f -o -type l \) -print | sed 's/^\.\///'g |
57 if [ \( -f $BASEDIR/$LIBBASE/$file \) -o \
58 \( -h $BASEDIR/$LIBBASE/$file \) ]; then
70 find usr \( -type f -o -type l \) -print | while read file
72 if [ \( -f $BASEDIR/$file \) -o \
73 \( -h $BASEDIR/$file \) ]; then
81 rm -f ${SGSBACKUPDIR}.newfiles
83 # Build a list of files/directories that this package is going
84 # add to the system that do not already exist.
85 cd $BASEDIR/$SGSDIR/lib
86 find . -depth -print | sed 's/^\.\///'g | while read file
88 # Built in /bin/sh test lacks -e
89 /usr/bin/test \! -e "$BASEDIR/$LIBBASE/$file"
91 echo $LIBBASE/$file >> ${SGSBACKUPDIR}.newfiles
96 find usr -depth -print | while read file
98 /usr/bin/test \! -e "$BASEDIR/$file"
100 echo $file >> ${SGSBACKUPDIR}.newfiles
105 # Generate a file containing the names of the files and directories
106 # that are being added (as opposed to being replaced) to the system.
107 # These items will need to be explicitly removed at uninstall.
110 # Generate a file containing the names of the original files backed
111 # up from the system. These items will be moved back at uninstall.
112 LIBLIST=`build_liblist`
113 FILELIST=`build_filelist`
114 for file in $LIBLIST $FILELIST $ETCLIST
117 done > ${SGSBACKUPDIR}.origfiles
120 # backup all existing SGStools.
122 echo "Backup up existing SGS tools to $SGSBACKUPDIR..."
124 cpio -pdm $BASEDIR/$SGSBACKUPDIR < ${SGSBACKUPDIR}.origfiles
128 # Overwrite SGSTOOLS onto existing system. We use CPIO
129 # because it unlinks a file and then creates a new one
130 # instead of copying over an existing inode. This is
131 # required when updating libraries (and the run-time linker)
132 # which are currently being used.
137 # First '/lib' components
139 echo "Installing new SGSTOOLS from $BASEDIR/$SGSDIR"
141 prev_bindnow=$LD_BIND_NOW
145 cd $BASEDIR/$SGSDIR/lib
146 find . -depth -print | cpio -o -O $ONLDCPIO
148 cpio -imdu < $ONLDCPIO
152 # Then everything else
155 find usr -depth -print | cpio -o -O $ONLDCPIO
157 cpio -imdu < $ONLDCPIO
162 # Populate '/etc/lib' directories on systems with the
163 # run-time linker installed under '/usr/lib/ld.so.1'
165 if [ "${ETCLIST}x" != "x" ]; then
166 cp $BASEDIR/usr/lib/ld.so.1 $BASEDIR/etc/lib/ld.so.1.onld
167 cp $BASEDIR/usr/lib/libdl.so.1 $BASEDIR/etc/lib/libdl.so.1.onld
169 mv ld.so.1.onld ld.so.1
170 mv libdl.so.1.onld libdl.so.1
173 LD_BIND_NOW=$prev_bindnow