#! /bin/sh # # rmrel # # Shell script to remove a release from # the BaBar code system # # Bob Jacobsen Mar 1995 # # Checking that various files exist is desperately needed # # Function for a production release: # # Prompt to confirm # delete # # (Test releases are not yet supported - just use # rm for now.) # # Options: # -p Reference a production release. (required) # # Arguments: # Release to delete # # G. Cooper 12-Mar-1997; don't chmod 777 the links to package dirs. # replace "rm .experiment" etc. with "rm .[A-z]*" # R. Harris 3-Jan-1997; fixed argument list length problem for tmp/*/*/* area # R. Harris Dec. 20, 1996: removal of ups directory and and .experiment file # AMJonckheere:FNAL:9/12/97 need to handle subdirectories of arbitrary depth # modify chmod and rm calls to handle this. # 8-Dec-1997 jonckheere@fnal.gov # Added "ide" removal for NT. # ################################################################ # 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 1 ]; then echo "One argument required" exit 2 fi if [ ! -r $BFDIST/releases/$1 ]; then echo "Production release $1 does not exist" exit fi ls $BFDIST/releases/$1 echo -n "Completely remove release $1? " read reply if [ "$reply" != "y" ]; then echo "Not removed" exit fi # start removal process cd $BFDIST/releases chmod 777 $1 cd $1 # Don't chmod the links to packages, as this changes # the package dirs rather than the links; # Keep it for BaBar, though. if [ -r .experiment ]; then experiment=`cat .experiment` else experiment="BABAR" fi if [ $experiment = "BABAR" ]; then chmod 777 * fi echo "Remove results, man and doc" chmod -R 777 man doc results rm -r man rm -r doc rm -r results echo "Remove bin" chmod -R 777 bin rm -r bin echo "Remove include" # soft links say I can't use rm -r rm include/* rmdir include echo "Remove tmp" chmod -R 777 tmp rm -r tmp echo "Remove lib" chmod -R 777 lib rm -r lib echo "Remove ups" chmod -R 777 ups rm -r ups if [ -d ide ]; then echo "Remove ide" chmod -R 777 ide rm -r ide fi echo "Remove the packages and files" rm * rm .[A-z]* echo "Remove the release directory" cd .. rmdir $1 exit