#!/bin/bash if [ $# -ne 5 ] then echo "Usage : $0 app-dir data_dir operation pacurl fixscript" echo " Where app-dir is the location where $APP points to;" echo " data-dir is the location where $DATA points to;" echo " operation is a pacman command like \"get\" or \"update\" or \"removeall\";" echo " pacurl is the web url where to download the pacman tarball" echo " fixscript is the name of the script to modify the MDS config file" exit 1 fi export ATLAS_APP=$1/atlas_app export ATLAS_DATA=$2/atlas_data export GRID3_APP=$1 # retrieve the correct pacman version to use, from the env. variable defined in env_def PACMAN_DOWNLOAD=$4 fixmds=$5 # http_proxy for BNL hostnm=`hostname -f` if [ "${hostnm:(-7)}" = "bnl.gov" ]; then export http_proxy=http://squid.sec.bnl.local:3128 echo "Using http_proxy on \"$hostnm\" : " ${http_proxy} fi # the following symbolic pacman command will only be used at the first time when # a pacman install is done on a site, i.e. for all the "get-XXX" commands. Later # on, the "update" and "remove" commands will not use them anymore, as a matter of # fact, they can't because pacman prevents some of the options to be used on # the same install area more than 2 times. echo "hostname is " $hostnm #if [ "$hostnm" = "citgrid3.cacr.caltech.edu" -o "${hostnm:(-7)}" = "vampire" -o "$hostnm" = "testwulf.hpcc.ttu.edu" ]; then if [ "$hostnm" = "citgrid3.cacr.caltech.edu" -o "${hostnm:(-7)}" = "vampire" ]; then PACMAN_CMD="pacman -pretend-platform:RHEL-3" #use a special pacman version for Chicago because of the confusion of the OS #PACMAN_DOWNLOAD=http://physics.bu.edu/pacman/sample_cache/tarballs/pacman-3.023.tar.gz elif [ "$hostnm" = "cmssrv05.fnal.gov" -o "$hostnm" = "cmssrv10.fnal.gov" ]; then PACMAN_CMD="pacman -allow unsupported-platforms" elif [ "$hostnm" = "ll03.alliance.unm.edu" ]; then PACMAN_CMD="pacman -pretend-platform:RedHat-8" elif [ "$hostnm" = "atlas.bu.edu" ]; then # PACMAN_CMD="pacman -v http" PACMAN_CMD=pacman elif [ "$hostnm" = "pdsfgrid2.nersc.gov" -o "$hostnm" = "alliance.unl.edu" -o "$hostnm" = "tp-osg" -o "$hostnm" = "tp-itb" -o "$hostnm" = "tp-grid1" ]; then #elif [ "$hostnm" = "fnpcg.fnal.gov" -o "$hostnm" = "cmssrv23.fnal.gov" -o "$hostnm" = "pdsfgrid2.nersc.gov" -o "$hostnm" = "alliance.unl.edu" -o "$hostnm" = "cmsp4.fnal.gov" ]; then # PACMAN_CMD="pacman -pretend-platform:SLC-3" PACMAN_CMD="pacman" #elif [ "${hostnm:(-8)}" = "fnal.gov" -o "${hostnm:(-12)}" = "uchicago.edu" ]; then # PACMAN_CMD="pacman -pretend-platform:SLC-3" else PACMAN_CMD="pacman" fi echo "PACMAN_CMD is " ${PACMAN_CMD} #mds_confil_perm=`stat -l $1/etc/grid3-locations.txt | grep -i uid | awk -F"/" '{print $1}' | awk -F"(" '{print $2}'` #echo "permision on VO spec. MDS config file is ${mds_confil_perm}" #echo $PACMAN_DOWNLOAD | awk -F : '{print $2}' middlename=`echo $PACMAN_DOWNLOAD | awk -F : '{print $2}'` #echo $middlename PACMAN_TARBALL=`basename $middlename` #echo $PACMAN_TARBALL PACMAN_DIR=`echo $PACMAN_TARBALL | sed 's/\.tar\.gz//g' ` #echo $PACMAN_DIR gensubdirs=($1/atlas_app $1/atlas_users $2/atlas_data $1/atlas_app/atlas_rel $1/atlas_app/dq2_cli $1/atlas_app/python $1/atlas_app/atlas_rel/kitval) relsubdirs=($1/atlas_app/atlas_rel/8.0.1 $1/atlas_app/atlas_rel/9.0.1 $1/atlas_app/atlas_rel/9.0.2 $1/atlas_app/atlas_rel/9.0.4 $1/atlas_app/atlas_rel/9.1.2 $1/atlas_app/atlas_rel/10.0.1 $1/atlas_app/atlas_rel/10.5.0) file_structure() { # create the install subdir and atlas_data dir if [ "$1" = "all" ] ; then for dirname in ${gensubdirs[@]} ${relsubdirs[@]}; do if [ -d $dirname ]; then echo "The directory \"$dirname\" already exists on `hostname`" else echo "The directory \"$dirname\" doesn't exist on `hostname`, create it" mkdir -p $dirname fi if [ "$1" = "${ATLAS_DATA}" -a -O $1 ]; then chmod go+w -R $1 fi done else if [ -d $1 ]; then echo "The directory \"$1\" already exists on `hostname`" if [ "$1" = "${ATLAS_DATA}" -a -O $1 ]; then chmod go+w -R $1 fi else echo "The directory \"$1\" doesn't exist on `hostname`, create it" mkdir -p $1 if [ "$1" = "${ATLAS_DATA}" -a -O $1 ]; then chmod go+w -R $1 fi fi fi } change_mdsfile() { if [ "$3" = "remove" ]; then sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_LOC_GCC sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_LOC_GCE sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_STAGE sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_LOC_Trfs sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_LOC_KitVal sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_APP sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_DATA fi if [ "$3" = "get" ]; then echo "ATLAS_LOC_GCC 3.2 $1/atlas_app/gcc32" >> $1/etc/grid3-locations.txt echo "ATLAS_LOC_GCE prod $1/atlas_app/GCE-Server/gce-server" >> $1/etc/grid3-locations.txt echo "ATLAS_STAGE prod $2/atlas_data" >> $1/etc/grid3-locations.txt echo "ATLAS_LOC_Trfs prod $1/atlas_app/Atlas-Trfs/atlas-trfs" >> $1/etc/grid3-locations.txt echo "ATLAS_LOC_KitVal prod $1/atlas_app/atlas_rel/kitval/KitValidation" >> $1/etc/grid3-locations.txt echo "ATLAS_APP prod $1/atlas_app" >> $1/etc/grid3-locations.txt echo "ATLAS_DATA prod $2/atlas_data" >> $1/etc/grid3-locations.txt echo "ATLAS_PYTHONHOME prod $2/atlas_app/python" >> $1/etc/grid3-locations.txt echo "ATLAS_DQ2Cli prod $2/atlas_app/dq2_cli/DQ2Cli" >> $1/etc/grid3-locations.txt fi } clean_subdir_info() { cd $1 # jump out of any possible non-existing subdirs for dirname in ${relsubdirs[@]}; do relname=`basename $dirname` if [ -f $dirname/setup.sh ]; then echo " $relname is installed, keep the record " else short_relname=`echo $relname | sed 's/\.//g'` echo " Removing the $relname info from MDS, since it's not installed " sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_LOC_${short_relname} if [ -d $dirname ]; then chmod 777 -R $dirname; rm -rf $dirname fi fi done # clean some duplicated items if existed by passing the script a dummy variable sh $1/$fixmds $1/etc/grid3-locations.txt CLEAN_DUPLICATE } test_command() { mkdir -p $1/atlas_app/atlas_rel ls -lrt $1/atlas_app/atlas_rel } collect_release_info() { mkdir -p $1/atlas_app/atlas_rel cd $1/atlas_app/atlas_rel # jump out of any possible non-existing subdirs relarray=(`ls -1 | grep -v kitval`) for dirname in ${relarray[@]}; do relname=`basename $dirname` short_relname=`echo $relname | sed 's/\.//g'` if [ -f $dirname/setup.sh ]; then echo " $relname is installed, keep the record " cat $1/etc/grid3-locations.txt | grep ATLAS_LOC_${short_relname} > /dev/null 2>&1 rc=$? if [ $rc -ne 0 ]; then echo ATLAS_LOC_${short_relname} ${relname} $ATLAS_APP/atlas_rel/${relname} >>$1/etc/grid3-locations.txt fi else echo " Removing the $relname info from MDS, since it's not installed " sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_LOC_${short_relname} if [ -d $dirname ]; then chmod 777 -R $dirname; rm -rf $dirname fi fi done # clean some duplicated items if existed by passing the script a dummy variable sh $1/$fixmds $1/etc/grid3-locations.txt CLEAN_DUPLICATE } #check pacman package # before doing anything, check if newer python version is available on this # site inside pacman-3.11 subdir, because some sites like bu still uses # python 1.5, which prevents pacman-3.13 from installing correctly. # set up PATH to find newer python version #export PATH=$1/atlas_app/python/python-2.4.1/Python-2.4.1/:$1/pacman-3.11/python/python/bin/:$PATH if [ -d $PACMAN_DIR ]; then cd $PACMAN_DIR # force yes answers to any possible pacman questions . ./setup.sh < /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then # Going into installation direcotry if [ ! -d $1/atlas_app ]; then echo "Directory $1/atlas_app already disappeared!" exit 0 fi cd $1/atlas_app chmod -R 777 * rm -rf * sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS fi echo $3 | grep -i "remove-ace-server" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then # Going into installation direcotry if [ ! -d $1/atlas_app ]; then echo "Directory $1/atlas_app already disappeared!" exit 0 fi cd $1/atlas_app # if [ -f o..pacman..o/is3.0 -o -d E ]; then # now just remove everything except for the atlas_rel dir. for oldstuff in `ls -1 | grep -v atlas_rel`; do echo "removing $oldstuff" chmod 777 -R $oldstuff; rm -rf $oldstuff done # else # pacman -remove-all # fi change_mdsfile $1 $2 remove fi echo $3 | grep -i "remove-python" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then # Going into installation direcotry if [ ! -d $1/atlas_app/python ]; then echo "Directory $1/atlas_app/python already disappeared!" exit 0 fi cd $1/atlas_app/python chmod 777 -R *; rm -rf * sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_PYTHONHOME fi echo $3 | grep -i "remove-atrel" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then atlas_release=`echo $3 | awk -F- '{print $3}'` short_atlas_release=`echo ${atlas_release} | sed 's/\.//g'` if [ ! -d $1/atlas_app/atlas_rel/${atlas_release} ]; then echo "Directory $1/atlas_app/atlas_rel/${atlas_release} already disappeared!" collect_release_info $1 exit 0 fi cd $1/atlas_app/atlas_rel/ chmod 777 -R ${atlas_release} rm -rf ${atlas_release} sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_LOC_${short_atlas_release} fi echo $3 | grep -i "remove-JobTransforms" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then # Going into installation direcotry if [ ! -d $1/atlas_app/atlas_rel/kitval ]; then echo "Directory $1/atlas_app/atlas_rel/kitval already disappeared!" collect_release_info $1 exit 0 fi cd $1/atlas_app/atlas_rel/kitval # clean the old pacman stuff if [ -d E ]; then chmod 777 -R E; rm -rf E fi pacman -remove-all cd $1/atlas_app/atlas_rel chmod 777 -R kitval; rm -rf kitval collect_release_info $1 exit 0 fi echo $3 | grep -i "clean_subdir_info" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then clean_subdir_info $1 exit 0 fi echo $3 | grep -i "test" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then test_command $1 exit 0 fi echo $3 | grep -i "collect_release_info" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then collect_release_info $1 exit 0 fi # usually don't use this command, too big an operation and RISKY! echo $3 | grep -i "update-all" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then echo "going to do \"$3\"..." file_structure all # Going into installation direcotry if [ ! -d $1/atlas_app ]; then echo "Directory $1/atlas_app already disappeared!" exit 0 fi cd $1/atlas_app pacman -update-check pacman -update for dirname in ${relsubdirs[@]}; do if [ ! -d $dirname ]; then echo "Directory $dirname already disappeared!" collect_release_info $1 exit 0 fi cd $dirname pacman -update-check pacman -update done if [ ! -d $1/atlas_app/atlas_rel/kitval ]; then echo "Directory $1/atlas_app/atlas_rel/kitval already disappeared!" collect_release_info $1 exit 0 fi cd $1/atlas_app/atlas_rel/kitval pacman -update-check pacman -update fi echo $3 | grep -i "update-ace-server" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then echo "going to do \"$3\"..." # Going into installation direcotry if [ ! -d $1/atlas_app ]; then echo "Directory $1/atlas_app already disappeared!" exit 0 fi cd $1/atlas_app pacman -update-check GCL:ACE-Server-dev -trust-all-caches -allow tar-overwrite pacman -update GCL:ACE-Server-dev -trust-all-caches -allow tar-overwrite fi echo $3 | grep -i "update-atrel" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then atlas_release=`echo $3 | awk -F- '{print $3}'` echo "going to do \"$3\"..." if [ ! -d $1/atlas_app/atlas_rel/${atlas_release} ]; then echo "Directory $1/atlas_app/atlas_rel/${atlas_release} already disappeared!" collect_release_info $1 exit 0 fi cd $1/atlas_app/atlas_rel/${atlas_release} pacman -update-check pacman -update collect_release_info $1 fi echo $3 | grep -i "update-JobTransforms" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then echo "going to do \"$3\"..." # Going into installation direcotry if [ ! -d $1/atlas_app/atlas_rel/kitval ]; then echo "Directory $1/atlas_app/atlas_rel/kitval already disappeared!" collect_release_info $1 exit 0 fi cd $1/atlas_app/atlas_rel/kitval # clean the old pacman stuff if [ -d E ]; then chmod 777 -R E; rm -rf E fi #pacman -update-check pacman -update GCL:JobTransforms -trust-all-caches # create a softlink of users to point to $APP/atlas_users cd $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/ if [ -L users ]; then echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users already exists" else echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users doesn't exist, create it" ln -s $1/atlas_users $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users fi fi echo $3 | grep -i "get-atrel" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then platform_spec=`echo $3 | awk -F- '{print $4}'` atlas_release=`echo $3 | awk -F- '{print $3}'` short_atlas_release=`echo ${atlas_release} | sed 's/\.//g'` file_structure $1/atlas_app/atlas_rel/${atlas_release} cd $1/atlas_app/atlas_rel/${atlas_release} if [ $? -eq 0 ]; then echo "Now we are in ", `pwd` else echo "failed to cd into the right dir, exit, now we are at ", `pwd` fi if [ -f $1/atlas_app/atlas_rel/${atlas_release}/setup.sh ]; then echo "${atlas_release} is already installed, please check first before starting another install!" else ${PACMAN_CMD} -allow bad-tar-filenames # ${PACMAN_CMD} -get GCL:${atlas_release}${platform_spec}+gcc -trust-all-caches -allow tar-overwrite ${PACMAN_CMD} -get http://www.usatlas.bnl.gov/BNL_ATLAS_Pacman:${atlas_release}${platform_spec}+gcc -trust-all-caches -allow tar-overwrite sleep 5 if [ -f $1/atlas_app/atlas_rel/${atlas_release}/setup.sh ]; then sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_LOC_${short_atlas_release} echo ATLAS_LOC_${short_atlas_release} ${atlas_release} ${ATLAS_APP}/atlas_rel/${atlas_release} >>$1/etc/grid3-locations.txt # do this post-install step for 10.0.1 and beyond, it's harmless anyway if [ "${atlas_release}" = "11.3.0" ];then echo "This is release ${atlas_release}, run some post-install recipe to set it up" source cmtsite/setup.sh -tag=11.3.0,AtlasOffline,opt source $SITEROOT/AtlasOffline/11.3.0/AtlasOfflineRunTime/cmt/setup.sh elif [ "${atlas_release}" != "9.0.4" ];then echo "This is release ${atlas_release}, run some post-install recipe to generate SEAL plug-in cache and library symbolic links" # post-install recipe to generate SEAL plug-in cache and library symbolic links cd $1/atlas_app/atlas_rel/${atlas_release} source setup.sh cd dist/${atlas_release}/Control/AthenaRunTime/*/cmt source setup.sh SealPluginRefresh cmt build library_links fi else # this installation failed somehow echo "The installation of ${atlas_release} failed, removing the directory, try again later" rm -rf $1/atlas_app/atlas_rel/${atlas_release} fi fi if [ -f $1/atlas_app/atlas_rel/${atlas_release}/sw/lcg/app/releases/SEAL/SEAL_1_7_1/slc3_ia32_gcc323/python ]; then chmod 755 $1/atlas_app/atlas_rel/${atlas_release}/sw/lcg/app/releases/SEAL/SEAL_1_7_1/slc3_ia32_gcc323/python fi fi echo $3 | grep -i "try-atrel" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then platform_spec=`echo $3 | awk -F- '{print $4}'` atlas_release=`echo $3 | awk -F- '{print $3}'` short_atlas_release=`echo ${atlas_release} | sed 's/\.//g'` mkdir -p $1/atlas_app/atlas_rel/testinstall-2/${atlas_release} cd $1/atlas_app/atlas_rel/testinstall-2/${atlas_release} if [ $? -eq 0 ]; then echo "Now we are in ", `pwd` else echo "failed to cd into the right dir, exit, now we are at ", `pwd` fi if [ -f $1/atlas_app/atlas_rel/testinstall-2/${atlas_release}/setup.sh ]; then echo "${atlas_release} is already installed, please check first before starting another install!" else ${PACMAN_CMD} -allow bad-tar-filenames ${PACMAN_CMD} -get http://www.usatlas.bnl.gov/BNL_ATLAS_Pacman:${atlas_release}${platform_spec}+gcc -trust-all-caches -allow tar-overwrite sleep 5 if [ -f $1/atlas_app/atlas_rel/testinstall-2/${atlas_release}/setup.sh ]; then echo "Test installation is done successfully" else # this installation failed somehow echo "The installation of ${atlas_release} failed" #rm -rf $1/atlas_app/atlas_rel/${atlas_release} fi fi if [ -f $1/atlas_app/atlas_rel/testinstall-2/${atlas_release}/sw/lcg/app/releases/SEAL/SEAL_1_7_1/slc3_ia32_gcc323/python ]; then chmod 755 $1/atlas_app/atlas_rel/testinstall-2/${atlas_release}/sw/lcg/app/releases/SEAL/SEAL_1_7_1/slc3_ia32_gcc323/python fi fi echo $3 | grep -i "get-snapshot-atrel" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then platform_spec=`echo $3 | awk -F- '{print $5}'` atlas_release=`echo $3 | awk -F- '{print $4}'` short_atlas_release=`echo ${atlas_release} | sed 's/\.//g'` file_structure $1/atlas_app/atlas_rel/${atlas_release} cd $1/atlas_app/atlas_rel/${atlas_release} if [ -f $1/atlas_app/atlas_rel/${atlas_release}/setup.sh ]; then echo "${atlas_release} is already installed, please check first before starting another install!" else wget http://grid.uchicago.edu/caches/ace-installation/atlas_release_snapshots/${atlas_release}/${atlas_release}${platform_spec}+gcc.snap pacman -allow bad-tar-filenames ${PACMAN_CMD} -get ./${atlas_release}${platform_spec}+gcc.snap:${atlas_release}${platform_spec}+gcc -trust-all-caches -allow tar-overwrite -allow bad-tar-filenames sleep 5 if [ -f $1/atlas_app/atlas_rel/${atlas_release}/setup.sh ]; then sh $1/$fixmds $1/etc/grid3-locations.txt ATLAS_LOC_${short_atlas_release} echo ATLAS_LOC_${short_atlas_release} ${atlas_release} ${ATLAS_APP}/atlas_rel/${atlas_release} >>$1/etc/grid3-locations.txt rm -rf ${atlas_release}${platform_spec}+gcc.snap # do this post-install step for 10.0.1 and beyond if [ "${atlas_release}" != "9.0.4" ];then echo "This is release ${atlas_release}, run some post-install recipe to generate SEAL plug-in cache and library symbolic links" # post-install recipe to generate SEAL plug-in cache and library symbolic links cd $1/atlas_app/atlas_rel/${atlas_release} source setup.sh cd dist/${atlas_release}/Control/AthenaRunTime/*/cmt source setup.sh SealPluginRefresh cmt build library_links fi else # this installation failed somehow echo "The installation of ${atlas_release} failed, removing the directory, try again later" rm -rf $1/atlas_app/atlas_rel/${atlas_release} fi if [ -f $1/atlas_app/atlas_rel/${atlas_release}/sw/lcg/app/releases/SEAL/SEAL_1_7_1/slc3_ia32_gcc323/python ]; then chmod 755 $1/atlas_app/atlas_rel/${atlas_release}/sw/lcg/app/releases/SEAL/SEAL_1_7_1/slc3_ia32_gcc323/python fi fi fi echo $3 | grep -i "get-ace-server" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then file_structure $1/atlas_app # file_structure $2/atlas_data cd $1/atlas_app ${PACMAN_CMD} -get GCL:ACE-Server-dev -trust-all-caches -allow tar-overwrite change_mdsfile $1 $2 get # clean some duplicated items if existed by passing the script a dummy variable sh $1/$fixmds $1/etc/grid3-locations.txt CLEAN_DUPLICATE fi echo $3 | grep -i "get-python" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then file_structure $1/atlas_app file_structure $1/atlas_app/python cd $1/atlas_app/python if [ -d $1/atlas_app/python/python-2.4.1 ]; then echo "python 2.4.1 is already installed" else ${PACMAN_CMD} -get "BU:Python | version ('2.4.1')" -trust-all-caches -allow tar-overwrite fi change_mdsfile $1 $2 get # clean some duplicated items if existed by passing the script a dummy variable sh $1/$fixmds $1/etc/grid3-locations.txt CLEAN_DUPLICATE fi echo $3 | grep -i "get-uberftp" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then file_structure $1/atlas_app file_structure $1/atlas_app/UberFTP cd $1/atlas_app/UberFTP ${PACMAN_CMD} -get VDT:UberFTP -trust-all-caches < /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then file_structure $1/atlas_app file_structure $1/atlas_app/dq2_cli cd $1/atlas_app/dq2_cli ${PACMAN_CMD} -get GCL:DQ2Cli -trust-all-caches -allow tar-overwrite change_mdsfile $1 $2 get # clean some duplicated items if existed by passing the script a dummy variable sh $1/$fixmds $1/etc/grid3-locations.txt CLEAN_DUPLICATE fi echo $3 | grep -i "get-kitval" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then file_structure $1/atlas_app/atlas_rel/kitval cd $1/atlas_app/atlas_rel/kitval ${PACMAN_CMD} -get GCL:KitValidation-dev -trust-all-caches -allow tar-overwrite rc=$? if [ $rc -eq 0 ]; then # create a softlink of users to point to $APP/atlas_users cd $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/ if [ -L users ]; then echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users already exists" else echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users doesn't exist, create it" ln -s $1/atlas_users $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users fi fi fi echo $3 | grep -i "get-one-kitval" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then jt_release=`echo $3 | awk -F- '{print $4}'` file_structure $1/atlas_app/atlas_rel/kitval cd $1/atlas_app/atlas_rel/kitval rm -rf o..pacman..o ${PACMAN_CMD} -get GCL:JobTransforms-dev-${jt_release} -trust-all-caches -allow tar-overwrite rc=$? if [ $rc -eq 0 ]; then # create a softlink of users to point to $APP/atlas_users cd $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/ if [ -L users ]; then echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users already exists" else echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users doesn't exist, create it" ln -s $1/atlas_users $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users fi fi # collect_release_info $1 fi echo $3 | grep -i "get-new-JobTransforms" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then atlas_release=`echo $3 | awk -F- '{print $4}'` dot_jt_release=`echo $3 | awk -F- '{print $5}'` jt_release=`echo ${dot_jt_release} | sed 's/\./_/g'` if [ -d $1/atlas_app/atlas_rel/${atlas_release} ]; then cd $1/atlas_app/atlas_rel/${atlas_release} if [ -d $1/atlas_app/atlas_rel/${atlas_release}/AtlasProduction/${dot_jt_release} ]; then echo "Python JobTransforms ${jt_release} is already installed, skip re-installing it" else source ./cmtsite/setup.sh -tag=${atlas_release} ${PACMAN_CMD} -allow lock-override -get http://cern.ch/atlas-computing/links/kitsDirectory/Production/cache:AtlasProduction_${jt_release}_i686_slc3_gcc323_opt -trust-all-caches rc=$? if [ $rc -eq 0 ]; then echo "Python JobTransforms ${jt_release} is installed" # apply some patches to AGLT2 site if [ "${hostnm}" = "gate02.grid.umich.edu" -o "${hostnm}" = "tp-grid1.ci.uchicago.edu" ]; then echo "sh $1/copy_libs_ATLAS.sh $1 ${atlas_release}" sh $1/copy_libs_ATLAS.sh $1 ${atlas_release} if [ $? -eq 0 ]; then echo "AGLT2 site is patched successfully" else echo "Failed to patch AGLT2 site" fi fi fi fi else echo "The directory \"$1/atlas_app/atlas_rel/${atlas_release}\" doesn't exist on `hostname`" fi fi echo $3 | grep -i "get-DB-Release" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then atlas_release=`echo $3 | awk -F- '{print $4}'` db_release=`echo $3 | awk -F- '{print $5}'` if [ -d $1/atlas_app/atlas_rel/${atlas_release} ]; then cd $1/atlas_app/atlas_rel/${atlas_release} cat cmtsite/requirements | grep DBRELEASE_INSTALLED | grep ${db_release} > /dev/null 2>&1 rc2=$? if [ $rc2 -eq 0 ]; then echo "DB release ${db_release} is already installed, skip re-installing it" else source cmtsite/setup.sh -tag=${atlas_release} source AtlasOffline/${atlas_release}/AtlasOfflineRunTime/cmt/setup.sh ${PACMAN_CMD} -get http://atlas.web.cern.ch/Atlas/GROUPS/DATABASE/pacman4/DBRelease:DBRelease-${db_release} -trust-all-caches rc=$? if [ $rc -eq 0 ]; then echo "DB release ${db_release} is installed for kit ${atlas_release}" fi fi else echo "The directory \"$1/atlas_app/atlas_rel/${atlas_release}\" doesn't exist on `hostname`" fi fi echo $3 | grep -i "get-JobTransforms" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then file_structure $1/atlas_app/atlas_rel/kitval cd $1/atlas_app/atlas_rel/kitval if [ -d E ]; then echo "deleting E " chmod 777 -R E rm -rf E fi if [ -d o..pacman..o ]; then chmod 777 -R o..pacman..o rm -rf o..pacman..o fi ${PACMAN_CMD} -get GCL:JobTransforms -trust-all-caches -allow tar-overwrite rc=$? if [ $rc -eq 0 ]; then # create a softlink of users to point to $APP/atlas_users cd $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/ if [ -L users ]; then echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users already exists" else echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users doesn't exist, create it" ln -s $1/atlas_users $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users fi fi # collect_release_info $1 fi echo $3 | grep -i "update-one-JobTransforms" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then jt_release=`echo $3 | awk -Fone- '{print $2}'` file_structure $1/atlas_app/atlas_rel/kitval cd $1/atlas_app/atlas_rel/kitval if [ -d E ]; then echo "deleting E " chmod 777 -R E rm -rf E fi if [ -d o..pacman..o ]; then chmod 777 -R o..pacman..o rm -rf o..pacman..o fi # temp. fix for updating 10.0.1.4 JobTransforms echo "Remove ${jt_release}, then re-install it" rm -rf $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/${jt_release} ${PACMAN_CMD} -get GCL:JobTransforms -trust-all-caches -allow tar-overwrite rc=$? if [ $rc -eq 0 ]; then # create a softlink of users to point to $APP/atlas_users cd $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/ if [ -L users ]; then echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users already exists" else echo " " echo "The softlink $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users doesn't exist, create it" ln -s $1/atlas_users $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/users fi fi # collect_release_info $1 fi echo $3 | grep -i "onetime_change" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then chmod +x $1/atlas_app/atlas_rel/kitval/KitValidation/JobTransforms/JobTransforms-11-00-42-10/share/csc.simul_cavern.trf fi echo $3 | grep -i "get-all-atlas" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then file_structure all for dirname in ${relsubdirs[@]}; do cd $dirname relname=`basename $dirname` ${PACMAN_CMD} -get GCL:${relname}+gcc -trust-all-caches -allow tar-overwrite done cd $1/atlas_app/atlas_rel/kitval ${PACMAN_CMD} -get GCL:KitValidation-dev -trust-all-caches -allow tar-overwrite fi # The way of running KV has changed, TBD echo $3 | grep -i "run-kitval" > /dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then echo "start kitval run" atlas_release=`echo $3 | awk -F- '{print $3}'` rm -rf /tmp/xin_kv_test mkdir -p /tmp/xin_kv_test; cd /tmp/xin_kv_test echo "sh $1/KVtest.sh $1/$PACMAN_DIR ${atlas_release} $1/atlas_app/atlas_rel/${atlas_release} AtlasProduction" sh $1/KVtest.sh $1/$PACMAN_DIR ${atlas_release} $1/atlas_app/atlas_rel/${atlas_release} AtlasProduction fi # last step is to check the consistency of the installed releases on the sites # AND remove all duplicate entries in the $1/etc/grid3-locations.txt file #collect_release_info $1