xref: /onnv-gate/usr/src/cmd/sgs/packages/common/preremove (revision 4242:a71ab6949017)
10Sstevel@tonic-gate#
20Sstevel@tonic-gate# CDDL HEADER START
30Sstevel@tonic-gate#
40Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5*4242Sab196087# Common Development and Distribution License (the "License").
6*4242Sab196087# You may not use this file except in compliance with the License.
70Sstevel@tonic-gate#
80Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate# See the License for the specific language governing permissions
110Sstevel@tonic-gate# and limitations under the License.
120Sstevel@tonic-gate#
130Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate#
190Sstevel@tonic-gate# CDDL HEADER END
200Sstevel@tonic-gate#
210Sstevel@tonic-gate#
220Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
230Sstevel@tonic-gate#
24*4242Sab196087# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
250Sstevel@tonic-gate# Use is subject to license terms.
260Sstevel@tonic-gate#
270Sstevel@tonic-gate
280Sstevel@tonic-gate
290Sstevel@tonic-gate#
30*4242Sab196087# Remove any new files that SUNWonld added to the system
31*4242Sab196087#
32*4242Sab196087if [ -f $BASEDIR/${SGSBACKUPDIR}.newfiles ]; then
33*4242Sab196087	echo "Removing new files added by SUNWonld"
34*4242Sab196087	cat $BASEDIR/${SGSBACKUPDIR}.newfiles | while read file
35*4242Sab196087	do
36*4242Sab196087		if [ -d $BASEDIR/$file ]; then
37*4242Sab196087			rmdir $BASEDIR/$file
38*4242Sab196087		else
39*4242Sab196087			rm $BASEDIR/$file
40*4242Sab196087		fi
41*4242Sab196087	done
42*4242Sab196087	rm $BASEDIR/${SGSBACKUPDIR}.newfiles
43*4242Sab196087fi
44*4242Sab196087
45*4242Sab196087
46*4242Sab196087#
470Sstevel@tonic-gate# Restore previous SGSTOOLS
480Sstevel@tonic-gate#
490Sstevel@tonic-gateif [ -d $BASEDIR/$SGSBACKUPDIR ]; then
500Sstevel@tonic-gate	prev_bindnow=$LD_BIND_NOW
510Sstevel@tonic-gate	LD_BIND_NOW=1
520Sstevel@tonic-gate	export LD_BIND_NOW
530Sstevel@tonic-gate	echo "Restoring SGSTOOLS from $BASEDIR$SGSBACKUPDIR"
540Sstevel@tonic-gate	cd $BASEDIR/$SGSBACKUPDIR
550Sstevel@tonic-gate	find . -depth -print | cpio -pdmu $BASEDIR
560Sstevel@tonic-gate	rm -rf *
570Sstevel@tonic-gate	LD_BIND_NOW=$prev_bindnow
580Sstevel@tonic-gatefi
590Sstevel@tonic-gate
600Sstevel@tonic-gatecd $BASEDIR
61