#!/bin/sh # # PROTECT.sh # # When new elements are created in the VOB change the # elements ownership to the owner of the VOB and change element # permissions to appropiate for element_type. # # NOTE: If a particular file_type is not implemented in # your VOB then comment it out. Unspecified file_types # will have origional permissions, but will have # ownership changed. # # Author: Charles W. Clarke III (ABS) # email: charles@abs-consulting.com # URL: http://www.abs-consulting.com # Date: Apr. 08, 1998 ############################################################ # History: 04/08/98 : Created for A Better Solution, Inc. # : 11/19/02 : Made change to handle spaces in names # : - thanx Marlene Trone ############################################################ ####################################### # Only use ONE of the next two lines. # ####################################### VOB_OWNER=`cleartool describe -fmt %u -vob "$CLEARCASE_VOB_PN"` # For ClearCase 3.2.1 or previous # VOB_OWNER=`cleartool describe -fmt %u vob:"$CLEARCASE_VOB_PN"` # For ClearCase 4.0 or later # ########################################################################### # In actuality this does not return the "owner" it returns the "creator". # # cleatool describe -fmt %[owner]p vob:{vot_tag} should return the owner # # of the VOB like it does for many other objects but is doesn't as of 4.1 # # # # If you might change VOB ownership after "creation" and it has to be # # right then use code like below: # # # # VOB_OWNER=`cleartool describe -vob $CLEARCASE_VOB_PN | \ # # grep " owner " | awk '{ print $2 }'` # # # # But this is a teaching script so it shall suffice. # ########################################################################### case $CLEARCASE_ELTYPE in directory |\ *script) ##################################################################### # All element types that are known to be 775 should be placed here. # ##################################################################### cleartool protect -chmod 775 -chown $VOB_OWNER "$CLEARCASE_PN" ;; makefile |\ *include |\ *source) ##################################################################### # All element types that are known to be 664 should be placed here. # ##################################################################### cleartool protect -chmod 664 -chown $VOB_OWNER "$CLEARCASE_PN" ;; report) ##################################################################### # All element types that are known to be 664 should be placed here. # ##################################################################### cleartool protect -chmod 644 -chown $VOB_OWNER "$CLEARCASE_PN" ;; *) ##################################################################### # All other element types should just have the ownership changed. # ##################################################################### cleartool protect -chown $VOB_OWNER "$CLEARCASE_PN" ;; esac exit 0