cbe-remove
changeset 1 102c9870ef63
child 10 a65a967018ee
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbe-remove	Mon Apr 14 10:39:56 2008 +0000
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# Script for uninstalling the common build environment for JDS on Solaris
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004-2005 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+PKGRM="/usr/sbin/pkgrm"
+ADMIN=`/usr/bin/mktemp /tmp/admin.XXXXX`
+
+echo "mail="             > $ADMIN
+echo "instance=unique"  >> $ADMIN
+echo "conflict=quit"    >> $ADMIN
+echo "setuid=nocheck"   >> $ADMIN
+echo "action=nocheck"   >> $ADMIN
+echo "partial=quit"     >> $ADMIN
+echo "idepend=nocheck"  >> $ADMIN
+echo "rdepend=nocheck"  >> $ADMIN
+echo "space=quit"       >> $ADMIN
+
+my_id=`/usr/xpg4/bin/id -u`
+if [ "x$my_id" != x0 ]; then
+    profiles | grep 'Software Installation' > /dev/null
+    if [ $? != 0 ]; then
+	echo 'Run this script as root or a user with the "Software Installation" profile'
+	echo 'See the user_attr(4) and profiles(1) manual pages for details'
+	exit 1
+    fi
+    PKGRM="pfexec /usr/sbin/pkgrm"
+fi
+
+IFS=" 	
+"
+for pkg in `pkginfo | grep 'JDS CBE' | awk '{ print $2; }'`; do
+    $PKGRM -a $ADMIN -n $pkg
+done
+pkginfo -q SUNWpkgbuild && $PKGRM -a $ADMIN -n SUNWpkgbuild
+pkginfo -q SFpkgbuild && $PKGRM -a $ADMIN -n SFpkgbuild
+
+rm -f $ADMIN