# # # PROTECT.pl # # 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 ############################################################ $PN = "\"$ENV{'CLEARCASE_PN'}\""; ####################################### # Only use ONE of the next two lines. # ####################################### $OWNER=`cleartool desc -fmt %u -vob $PN`; # For ClearCase 3.2.1 or previous # $OWNER=`cleartool desc -fmt %u 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 5.0 # # # # But this is a teaching script so it shall suffice. # ########################################################################### $ELTYPE = "$ENV{'CLEARCASE_ELTYPE'}"; if ( ($ELTYPE eq "directory" ) || ($ELTYPE =~ /.*script/ ) || ($ELTYPE =~ /.*program/ ) ) ##################################################################### # All element types that are known to be 775 should be placed here. # ##################################################################### {`cleartool protect -chmod 775 -chown $OWNER $PN`; } elsif ( ($ELTYPE eq "makefile" ) || ($ELTYPE =~ /.*include/ ) || ($ELTYPE =~ /.*source/ ) ) ##################################################################### # All element types that are known to be 664 should be placed here. # ##################################################################### {`cleartool protect -chmod 664 -chown $OWNER $PN`; } elsif ($ELTYPE eq "report" ) ##################################################################### # All element types that are known to be 644 should be placed here. # ##################################################################### {`cleartool protect -chmod 644 -chown $OWNER $PN`; } else ##################################################################### # All other element types should just have the ownership changed. # ##################################################################### {`cleartool protect -chown $OWNER $PN`; } exit 0