#! /bin/sh # # rmver # # Shell script to remove a package version from # the BaBar code system # # Note that this is not intended for removing a particular # version _from_a_release_, but removing it entirely. # # # Bob Jacobsen Mar 1995 # # Bob Jacobsen Dec 95 discovered that protection against deleting # a version that's inuse does not work on SunOS5, # added warning until thats undersootd & fixed # Terry Hung Aug 20 protection on SunOS5 is fixed with `sh -c pwd` # # G Cooper 13-Feb-1998 Change "sh -c pwd" back to "/bin/pwd", as the # shell builtin reports the PWD if you got there # through a symbolic link. # # Function for a production version: # # Test that no existing production release includes this # Prompt to confirm # delete # # (Test versions are not yet supported - just use # rm for now.) # # Options: # -p Reference a production version. (required) # # Arguments: # Name of package # Version to delete # # ################################################################ # process options test=0 prod=0 #amj:FNAL: getopts has replaced getopt as recommended usage on SGI and # DECUnix. Only getopts exists in the cygnus NT system. while getopts tpv c do case $c in p) prod=1; test=0;; esac done shift `expr $OPTIND - 1` if [ "$prod" -ne 1 ]; then echo "-p option is currently required" exit 2 fi # check for correct number of arguments if [ "$#" -ne 2 ]; then echo "Two arguments required" exit 2 fi cd $BFDIST/packages/$1/$2 verdir=`/bin/pwd` inuse=0 for var in $BFDIST/releases/*/$1 do if [ "$var" != "$BFDIST/releases/*/$1" ]; then cd $var heredir=`/bin/pwd` if [ "$heredir" = "$verdir" ]; then inuse=1 echo "Version in use by" $var fi fi done if [ "$inuse" -eq 0 ]; then echo "Completely remove version $2 of the $1 package? (y/n) \c" read reply if [ "$reply" = "y" ]; then #FNAL-amj, have to do undeclare 1st for ups v4.x #FNAL-GC 5-May-1997 # Find out whether UPS is available; # if so, undeclare this version (instance). if [ "$UPS_DIR" ]; then $UPS_DIR/bin/ups undeclare -z$RUN2_PRODUCTS $1 $2 fi find $BFDIST/packages/$1/$2 -exec chmod 777 {} \; rm -r $BFDIST/packages/$1/$2 echo Removed else echo Not removed fi fi exit