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 2009 Sun Microsystems, Inc. All rights reserved. 25 # Use is subject to license terms. 26 # 27 # ident "@(#)srv_setup.ksh 1.1 09/04/27 SMI" 28 # 29 30 DIR=$(dirname $0) 31 NAME=$(basename $0) 32 33 Usage="Usage: $NAME -s | -c \n 34 -s: to setup the server\n 35 -c: to cleanup the server\n 36 " 37 if (( $# < 1 )); then 38 echo $Usage 39 exit 99 40 fi 41 42 # Include common STC utility functions for SMF 43 . ${DIR}/srv_env.vars 44 . ${DIR}/nfs-util.kshlib 45 46 # Turn on debug info, if requested 47 export _NFS_STF_DEBUG=$_NFS_STF_DEBUG:$NFSGEN_DEBUG 48 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \ 49 && set -x 50 51 getopts sc opt 52 case $opt in 53 s) 54 # Create test group 55 groupdel $TGROUP >/dev/null 2>&1 56 RUN_CHECK groupadd -g $TGID $TGROUP || exit 1 57 # Create test user 58 userdel $TUSER01 >/dev/null 2>&1 59 RUN_CHECK useradd -u $TUID01 -g $TGROUP -d /tmp $TUSER01 || exit 1 60 userdel $TUSER02 >/dev/null 2>&1 61 RUN_CHECK useradd -u $TUID02 -g $TGROUP -d /tmp $TUSER02 || exit 1 62 63 # Set mapid domain 64 set_nfs_property NFSMAPID_DOMAIN $NFSMAPID_DOMAIN $DIR/mapid_backup \ 65 || exit 1 66 # Set delegation 67 set_nfs_property NFS_SERVER_DELEGATION on $DIR/deleg_backup \ 68 || exit 1 69 ;; 70 c) 71 # Delete test user and group 72 RUN_CHECK userdel $TUSER01 || exit 1 73 RUN_CHECK userdel $TUSER02 || exit 1 74 RUN_CHECK groupdel $TGROUP || exit 1 75 76 # Restore mapid domain 77 restore_nfs_property NFSMAPID_DOMAIN $DIR/mapid_backup || exit 1 78 # Restore delegation 79 restore_nfs_property NFS_SERVER_DELEGATION $DIR/deleg_backup || exit 1 80 ;; 81 \?) 82 echo $Usage 83 exit 99 84 ;; 85 esac 86 87 exit 0 88