1
|
1 |
#!/bin/bash
|
|
2 |
#
|
|
3 |
# Script for uninstalling the common build environment for JDS on Solaris
|
|
4 |
#
|
|
5 |
# CDDL HEADER START
|
|
6 |
#
|
|
7 |
# The contents of this file are subject to the terms of the
|
|
8 |
# Common Development and Distribution License, Version 1.0 only
|
|
9 |
# (the "License"). You may not use this file except in compliance
|
|
10 |
# with the License.
|
|
11 |
#
|
|
12 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
13 |
# or http://www.opensolaris.org/os/licensing.
|
|
14 |
# See the License for the specific language governing permissions
|
|
15 |
# and limitations under the License.
|
|
16 |
#
|
|
17 |
# When distributing Covered Code, include this CDDL HEADER in each
|
|
18 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
19 |
# If applicable, add the following below this CDDL HEADER, with the
|
|
20 |
# fields enclosed by brackets "[]" replaced with your own identifying
|
|
21 |
# information: Portions Copyright [yyyy] [name of copyright owner]
|
|
22 |
#
|
|
23 |
# CDDL HEADER END
|
|
24 |
#
|
|
25 |
#
|
|
26 |
# Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
|
|
27 |
# Use is subject to license terms.
|
|
28 |
#
|
|
29 |
|
30
|
30 |
PKGRM="pfexec /usr/sbin/pkgrm"
|
1
|
31 |
ADMIN=`/usr/bin/mktemp /tmp/admin.XXXXX`
|
|
32 |
|
|
33 |
echo "mail=" > $ADMIN
|
|
34 |
echo "instance=unique" >> $ADMIN
|
|
35 |
echo "conflict=quit" >> $ADMIN
|
|
36 |
echo "setuid=nocheck" >> $ADMIN
|
|
37 |
echo "action=nocheck" >> $ADMIN
|
|
38 |
echo "partial=quit" >> $ADMIN
|
|
39 |
echo "idepend=nocheck" >> $ADMIN
|
|
40 |
echo "rdepend=nocheck" >> $ADMIN
|
|
41 |
echo "space=quit" >> $ADMIN
|
|
42 |
|
|
43 |
my_id=`/usr/xpg4/bin/id -u`
|
30
|
44 |
prof_sw_inst=`/bin/profiles | nl -s: | grep 'Software Installation' | cut -f1 -d:`
|
|
45 |
prof_pri_adm=`/bin/profiles | nl -s: | grep 'Primary Administrator' | cut -f1 -d:`
|
|
46 |
prof_basic_usr=`/bin/profiles | nl -s: | grep 'Basic Solaris User' | cut -f1 -d:`
|
|
47 |
|
|
48 |
if [ "x$my_id" = x0 ]; then
|
|
49 |
PKGRM="/usr/sbin/pkgrm"
|
|
50 |
elif [ "x$prof_sw_inst" = x -a "x$prof_pri_adm" = x ]; then
|
|
51 |
echo 'Run this script as a user with the "Software Installation"' 1>&2
|
|
52 |
echo 'or "Primary Administrator" profile.' 1>&2
|
|
53 |
test -x /usr/bin/users-admin && {
|
|
54 |
echo 1>&2
|
|
55 |
echo 'You can also use the users-admin program (System -> Administration ->' 1>&2
|
|
56 |
echo 'Users and Groups in the GNOME menu) to assign profiles.' 1>&2
|
|
57 |
echo 1>&2
|
|
58 |
}
|
|
59 |
echo 'See the user_attr(4) and profiles(1) manual pages for further details' 1>&2
|
|
60 |
exit 1
|
|
61 |
else
|
|
62 |
if [ "x$prof_basic_usr" != x ]; then
|
|
63 |
if [ "x$prof_sw_inst" != x ]; then
|
|
64 |
if [ $prof_sw_inst -gt $prof_basic_usr ]; then
|
|
65 |
echo 'The "Software Installation" profile in /etc/user_attr should appear' 1>&2
|
|
66 |
echo 'before Basic Solaris User.' 1>&2
|
|
67 |
exit 1
|
|
68 |
fi
|
|
69 |
fi
|
|
70 |
if [ "x$prof_pri_adm" != x ]; then
|
|
71 |
if [ $prof_pri_adm -gt $prof_basic_usr ]; then
|
|
72 |
echo 'The "Primary Administrator" profile in /etc/user_attr should appear' 1>&2
|
|
73 |
echo 'before Basic Solaris User.' 1>&2
|
|
74 |
exit 1
|
|
75 |
fi
|
|
76 |
fi
|
1
|
77 |
fi
|
|
78 |
fi
|
|
79 |
|
|
80 |
IFS="
|
|
81 |
"
|
|
82 |
for pkg in `pkginfo | grep 'JDS CBE' | awk '{ print $2; }'`; do
|
|
83 |
$PKGRM -a $ADMIN -n $pkg
|
|
84 |
done
|
10
|
85 |
for pkg in `pkginfo | grep 'Desktop CBE' | awk '{ print $2; }'`; do
|
|
86 |
$PKGRM -a $ADMIN -n $pkg
|
|
87 |
done
|
1
|
88 |
pkginfo -q SUNWpkgbuild && $PKGRM -a $ADMIN -n SUNWpkgbuild
|
|
89 |
pkginfo -q SFpkgbuild && $PKGRM -a $ADMIN -n SFpkgbuild
|
|
90 |
|
|
91 |
rm -f $ADMIN
|