1 #! /usr/bin/ksh -p
   2 #
   3 # CDDL HEADER START
   4 #
   5 # The contents of this file are subject to the terms of the
   6 # Common Development and Distribution License (the "License").
   7 # You may not use this file except in compliance with the License.
   8 #
   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 
  23 #
  24 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 #
  27 
  28 zone=`/bin/zonename`
  29 if [ "$zone" == "global" ]
  30 then
  31         echo "Resource Management:"
  32         echo "\tDeleting resource pool $ctx_resourcepool"
  33         poolcfg -c "destroy pool $ctx_resourcepool" -d
  34 
  35         echo "\tDeleting resource pool $ctx_default_resourcepool"
  36         poolcfg -c "destroy pool $ctx_default_resourcepool" -d
  37         [ -f resourcepools ] && {
  38                 rm -f resourcepools
  39                 echo "\tDisabling resource pools"
  40                 pooladm -d
  41         }
  42 fi
  43 
  44 
  45 echo "User Attributes:"
  46 echo "\tRemoving $ctx_user from /etc/user_attr"
  47 grep -v "^$ctx_user:" /etc/user_attr > /etc/user_attr.new
  48 cp /etc/user_attr /etc/user_attr.old && \
  49         cp /etc/user_attr.new /etc/user_attr && \
  50         rm /etc/user_attr.old
  51 
  52 echo "Project:"
  53 echo "\tDeleting project $ctx_project"
  54 projdel $ctx_project
  55 if [ $? -ne 0 ]; then
  56         echo "--DIAG: Could not delete project $ctx_project"
  57         exit 1
  58 fi
  59 
  60 echo "User and Group:"
  61 echo "\tDeleting user $ctx_user"
  62 userdel $ctx_user
  63 if [ $? -ne 0 ]; then
  64         echo "--DIAG: Could not remove user $ctx_user"
  65         exit 1
  66 fi
  67 
  68 echo "\tDeleting user $ctx_lockeduser"
  69 userdel $ctx_lockeduser
  70 if [ $? -ne 0 ]; then
  71         echo "--DIAG: could not remove user $ctx_lockeduser"
  72         exit 1
  73 fi
  74 
  75 echo "\tDeleting group $ctx_group"
  76 groupdel $ctx_group
  77 if [ $? -ne 0 ]; then
  78         echo "--DIAG: could not remove group $ctx_group"
  79         exit 1
  80 fi
  81 
  82 echo "Security attributes:"
  83 echo "\tRemoving '$ctx_profilename' from exec_attr"
  84 cp /etc/security/exec_attr /etc/security/exec_attr.old
  85 grep -v "^$ctx_profilename:" /etc/security/exec_attr \
  86         > /etc/security/exec_attr.new
  87 cp /etc/security/exec_attr.new /etc/security/exec_attr
  88 if [ $? -ne 0 ]; then
  89         echo "--DIAG: Could not remove profile from exec_attr"
  90         exit 1
  91 fi
  92 
  93 echo "\tRemoving '$ctx_profilename' from prof_attr"
  94 cp /etc/security/prof_attr /etc/security/prof_attr.old
  95 grep -v "^$ctx_profilename:" /etc/security/prof_attr \
  96         > /etc/security/prof_attr.new
  97 cp /etc/security/prof_attr.new /etc/security/prof_attr
  98 if [ $? -ne 0 ]; then
  99         echo "--DIAG: Could not remove profile from prof_attr"
 100         exit 1
 101 fi
 102 
 103 exit 0