1*0Sstevel@tonic-gate# 2*0Sstevel@tonic-gate# CDDL HEADER START 3*0Sstevel@tonic-gate# 4*0Sstevel@tonic-gate# The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate# with the License. 8*0Sstevel@tonic-gate# 9*0Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate# See the License for the specific language governing permissions 12*0Sstevel@tonic-gate# and limitations under the License. 13*0Sstevel@tonic-gate# 14*0Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate# 20*0Sstevel@tonic-gate# CDDL HEADER END 21*0Sstevel@tonic-gate# 22*0Sstevel@tonic-gate# 23*0Sstevel@tonic-gate#ident "%Z%%M% %I% %E% SMI" 24*0Sstevel@tonic-gate# 25*0Sstevel@tonic-gate# Copyright 2003 Sun Microsystems, Inc. All rights reserved. 26*0Sstevel@tonic-gate# Use is subject to license terms. 27*0Sstevel@tonic-gate# 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gateONLDCPIO=/tmp/SUNWonld.cpio.$$ 30*0Sstevel@tonic-gateLINKERALIAS=linker_install@eng.sun.com 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate# 34*0Sstevel@tonic-gate# This script handles the installation of the new sgstools on 35*0Sstevel@tonic-gate# both Solaris10 systems (which libraries moved to '/lib') and 36*0Sstevel@tonic-gate# pre Solaris10 systems where libraries reside under '/usr/lib'. 37*0Sstevel@tonic-gate# 38*0Sstevel@tonic-gate# We test to deterine if '/lib' is a symlink (pre Solaris10) or a 39*0Sstevel@tonic-gate# directory (Solaris10 & later). We key off of that for 40*0Sstevel@tonic-gate# everything below. 41*0Sstevel@tonic-gate# 42*0Sstevel@tonic-gateif [ -h ${BASEDIR}/lib ] 43*0Sstevel@tonic-gatethen 44*0Sstevel@tonic-gate LIBBASE=usr/lib 45*0Sstevel@tonic-gate ETCLIST="etc/lib/ld.so.1 etc/lib/libdl.so.1" 46*0Sstevel@tonic-gateelse 47*0Sstevel@tonic-gate LIBBASE=lib 48*0Sstevel@tonic-gatefi 49*0Sstevel@tonic-gateexport LIBBASE 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate 52*0Sstevel@tonic-gatebuild_liblist () 53*0Sstevel@tonic-gate{ 54*0Sstevel@tonic-gate # 55*0Sstevel@tonic-gate # Build '/lib' file list for backing up 56*0Sstevel@tonic-gate # 57*0Sstevel@tonic-gate cd $BASEDIR/$SGSDIR/lib 58*0Sstevel@tonic-gate find . \( -type f -o -type l \) -print | while read file 59*0Sstevel@tonic-gate do 60*0Sstevel@tonic-gate if [ \( -f $BASEDIR/$LIBBASE/$file \) -o \ 61*0Sstevel@tonic-gate \( -h $BASEDIR/$LIBBASE/$file \) ]; then 62*0Sstevel@tonic-gate echo $LIBBASE/$file 63*0Sstevel@tonic-gate fi 64*0Sstevel@tonic-gate done 65*0Sstevel@tonic-gate} 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gatebuild_filelist() 68*0Sstevel@tonic-gate{ 69*0Sstevel@tonic-gate # 70*0Sstevel@tonic-gate # Build rest of files 71*0Sstevel@tonic-gate # 72*0Sstevel@tonic-gate cd $BASEDIR/$SGSDIR 73*0Sstevel@tonic-gate find usr \( -type f -o -type l \) -print | while read file 74*0Sstevel@tonic-gate do 75*0Sstevel@tonic-gate if [ \( -f $BASEDIR/$file \) -o \ 76*0Sstevel@tonic-gate \( -h $BASEDIR/$file \) ]; then 77*0Sstevel@tonic-gate echo $file 78*0Sstevel@tonic-gate fi 79*0Sstevel@tonic-gate done 80*0Sstevel@tonic-gate} 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gateLIBLIST=`build_liblist` 83*0Sstevel@tonic-gateFILELIST=`build_filelist` 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate# 86*0Sstevel@tonic-gate# backup all existing SGStools. 87*0Sstevel@tonic-gate# 88*0Sstevel@tonic-gateecho "Backup up existing SGS tools to $SGSBACKUPDIR..." 89*0Sstevel@tonic-gatecd $BASEDIR 90*0Sstevel@tonic-gatefor file in $LIBLIST $FILELIST $ETCLIST 91*0Sstevel@tonic-gatedo 92*0Sstevel@tonic-gate echo $file 93*0Sstevel@tonic-gatedone | cpio -pdm $BASEDIR/$SGSBACKUPDIR 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate# 97*0Sstevel@tonic-gate# Overwrite SGSTOOLS onto existing system. We use CPIO 98*0Sstevel@tonic-gate# because rm's a file and then installs a new one 99*0Sstevel@tonic-gate# instead of copying over a existing file. This is 100*0Sstevel@tonic-gate# required when updating libraries (and the run-time linker) 101*0Sstevel@tonic-gate# which are currently being used. 102*0Sstevel@tonic-gate# 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate# 106*0Sstevel@tonic-gate# First '/lib' components 107*0Sstevel@tonic-gate# 108*0Sstevel@tonic-gateecho "Installing new SGSTOOLS from $BASEDIR/$SGSDIR" 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gateprev_bindnow=$LD_BIND_NOW 111*0Sstevel@tonic-gateLD_BIND_NOW=1 112*0Sstevel@tonic-gateexport LD_BIND_NOW 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gatecd $BASEDIR/$SGSDIR/lib 115*0Sstevel@tonic-gatefind . -depth -print | cpio -o -O $ONLDCPIO 116*0Sstevel@tonic-gatecd $BASEDIR/$LIBBASE 117*0Sstevel@tonic-gatecpio -imdu < $ONLDCPIO 118*0Sstevel@tonic-gaterm -f $ONLDCPIO 119*0Sstevel@tonic-gate 120*0Sstevel@tonic-gate# 121*0Sstevel@tonic-gate# Then everything else 122*0Sstevel@tonic-gate# 123*0Sstevel@tonic-gatecd $BASEDIR/$SGSDIR 124*0Sstevel@tonic-gatefind usr -depth -print | cpio -o -O $ONLDCPIO 125*0Sstevel@tonic-gatecd $BASEDIR 126*0Sstevel@tonic-gatecpio -imdu < $ONLDCPIO 127*0Sstevel@tonic-gaterm -f $ONLDCPIO 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate# 131*0Sstevel@tonic-gate# Populate '/etc/lib' directories on systems with the 132*0Sstevel@tonic-gate# run-time linker installed under '/usr/lib/ld.so.1' 133*0Sstevel@tonic-gate# 134*0Sstevel@tonic-gateif [ "${ETCLIST}x" != "x" ]; then 135*0Sstevel@tonic-gate cp $BASEDIR/usr/lib/ld.so.1 $BASEDIR/etc/lib/ld.so.1.onld 136*0Sstevel@tonic-gate cp $BASEDIR/usr/lib/libdl.so.1 $BASEDIR/etc/lib/libdl.so.1.onld 137*0Sstevel@tonic-gate cd $BASEDIR/etc/lib 138*0Sstevel@tonic-gate mv ld.so.1.onld ld.so.1 139*0Sstevel@tonic-gate mv libdl.so.1.onld libdl.so.1 140*0Sstevel@tonic-gatefi 141*0Sstevel@tonic-gate 142*0Sstevel@tonic-gateLD_BIND_NOW=$prev_bindnow 143*0Sstevel@tonic-gate 144*0Sstevel@tonic-gate# 145*0Sstevel@tonic-gate# E-mail sent to track installations of SUNWonld package. 146*0Sstevel@tonic-gate# purely for statistical purposes. 147*0Sstevel@tonic-gate# 148*0Sstevel@tonic-gateif [ -f /usr/lib/sendmail ] 149*0Sstevel@tonic-gatethen 150*0Sstevel@tonic-gate HOSTINFO=`uname -a` 151*0Sstevel@tonic-gate DATE=`date` 152*0Sstevel@tonic-gate ENVLIST=`env` 153*0Sstevel@tonic-gate /usr/lib/sendmail $LINKERALIAS << EOF 154*0Sstevel@tonic-gateTo: $LINKERALIAS 155*0Sstevel@tonic-gateSubject: SUNWonld Linker Package Installation: $PRODVERS 156*0Sstevel@tonic-gateContent-type: text/plain 157*0Sstevel@tonic-gatePrecedence: junk 158*0Sstevel@tonic-gate-------- 159*0Sstevel@tonic-gate 160*0Sstevel@tonic-gatePackage Installation 161*0Sstevel@tonic-gateuname: $HOSTINFO 162*0Sstevel@tonic-gatedate: $DATE 163*0Sstevel@tonic-gateVERSION: $VERSION 164*0Sstevel@tonic-gateENV: 165*0Sstevel@tonic-gate$ENVLIST 166*0Sstevel@tonic-gate$ENV 167*0Sstevel@tonic-gate 168*0Sstevel@tonic-gate. 169*0Sstevel@tonic-gateEOF 170*0Sstevel@tonic-gatefi 171*0Sstevel@tonic-gate 172