xref: /onnv-gate/usr/src/cmd/sgs/packages/common/preremove (revision 8881:554b7a9a07e8)
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
54242Sab196087# Common Development and Distribution License (the "License").
64242Sab196087# 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#
22*8881SAli.Bahrami@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate# Use is subject to license terms.
240Sstevel@tonic-gate#
250Sstevel@tonic-gate
260Sstevel@tonic-gate
270Sstevel@tonic-gate#
284242Sab196087# Remove any new files that SUNWonld added to the system
294242Sab196087#
304242Sab196087if [ -f $BASEDIR/${SGSBACKUPDIR}.newfiles ]; then
314242Sab196087	echo "Removing new files added by SUNWonld"
324242Sab196087	cat $BASEDIR/${SGSBACKUPDIR}.newfiles | while read file
334242Sab196087	do
344242Sab196087		if [ -d $BASEDIR/$file ]; then
354242Sab196087			rmdir $BASEDIR/$file
364242Sab196087		else
374242Sab196087			rm $BASEDIR/$file
384242Sab196087		fi
394242Sab196087	done
404242Sab196087	rm $BASEDIR/${SGSBACKUPDIR}.newfiles
414242Sab196087fi
424242Sab196087
434242Sab196087
444242Sab196087#
450Sstevel@tonic-gate# Restore previous SGSTOOLS
460Sstevel@tonic-gate#
47*8881SAli.Bahrami@Sun.COMif [ \( -d $BASEDIR/$SGSBACKUPDIR \) -a \
48*8881SAli.Bahrami@Sun.COM     \( -f $BASEDIR/${SGSBACKUPDIR}.origfiles \) ]; then
490Sstevel@tonic-gate	prev_bindnow=$LD_BIND_NOW
500Sstevel@tonic-gate	LD_BIND_NOW=1
510Sstevel@tonic-gate	export LD_BIND_NOW
520Sstevel@tonic-gate	echo "Restoring SGSTOOLS from $BASEDIR$SGSBACKUPDIR"
530Sstevel@tonic-gate	cd $BASEDIR/$SGSBACKUPDIR
54*8881SAli.Bahrami@Sun.COM	cpio -pdmu $BASEDIR < $BASEDIR/${SGSBACKUPDIR}.origfiles
550Sstevel@tonic-gate	rm -rf *
56*8881SAli.Bahrami@Sun.COM	rm $BASEDIR/${SGSBACKUPDIR}.origfiles
570Sstevel@tonic-gate	LD_BIND_NOW=$prev_bindnow
580Sstevel@tonic-gatefi
590Sstevel@tonic-gate
600Sstevel@tonic-gatecd $BASEDIR
61