cbe-remove
author xlucas
Tue, 28 Apr 2009 09:49:26 +0000
changeset 41 31570364d0f1
parent 30 3fcf6ebb59f2
permissions -rwxr-xr-x
2009-03-16 Lukas (Luc) Oboril <[email protected]> * bump pkgbuild to latest version 1.3.98.4 * add Sun Studio Express 03/09 as known compiler

#!/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="pfexec /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`
prof_sw_inst=`/bin/profiles | nl -s: | grep 'Software Installation' | cut -f1 -d:`
prof_pri_adm=`/bin/profiles | nl -s: | grep 'Primary Administrator' | cut -f1 -d:`
prof_basic_usr=`/bin/profiles | nl -s: | grep 'Basic Solaris User' | cut -f1 -d:`

if [ "x$my_id" = x0 ]; then
    PKGRM="/usr/sbin/pkgrm"
elif [ "x$prof_sw_inst" = x -a "x$prof_pri_adm" = x ]; then
    echo 'Run this script as a user with the "Software Installation"' 1>&2
    echo 'or "Primary Administrator" profile.' 1>&2
    test -x /usr/bin/users-admin && {
	echo 1>&2
	echo 'You can also use the users-admin program (System -> Administration ->' 1>&2
	echo 'Users and Groups in the GNOME menu) to assign profiles.' 1>&2
	echo 1>&2
    }
    echo 'See the user_attr(4) and profiles(1) manual pages for further details' 1>&2
    exit 1
else
    if [ "x$prof_basic_usr" != x ]; then
	if [ "x$prof_sw_inst" != x ]; then
	    if [ $prof_sw_inst -gt $prof_basic_usr ]; then
		echo 'The "Software Installation" profile in /etc/user_attr should appear' 1>&2
		echo 'before Basic Solaris User.' 1>&2
		exit 1
	    fi
	fi
	if [ "x$prof_pri_adm" != x ]; then
	    if [ $prof_pri_adm -gt $prof_basic_usr ]; then
		echo 'The "Primary Administrator" profile in /etc/user_attr should appear' 1>&2
		echo 'before Basic Solaris User.' 1>&2
		exit 1
	    fi
	fi
    fi
fi

IFS=" 	
"
for pkg in `pkginfo | grep 'JDS CBE' | awk '{ print $2; }'`; do
    $PKGRM -a $ADMIN -n $pkg
done
for pkg in `pkginfo | grep 'Desktop 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