3 # install_garsoft_mrb.sh
4 # Install the ups products needed by novasoft
5 # Created by Brian Rebel on 9/15/16.
7 if [ "$#" -ne 5 ]; then
8 echo "Usage: install_garsoft_mrb.sh <external ups directory> <garsoft base version> <garsoft qualifiers> <buildtype> <garsoft destination directory>"
9 echo " For example: install_garsoft_mrb.sh $HOME/gar/products vXX_YY_ZZ sJJ:eII <debug | prof> $HOME/gar/"
10 #echo " the lastest version of the garsoft bundle can be found at http://scisoft.fnal.gov/scisoft/bundles/garsoft/"
11 echo " use the lastest version of the larsoft bundle to get external products, the bundle can be found at http://scisoft.fnal.gov/scisoft/bundles/larsoft/"
12 echo " If running on Fermilab dunegpvm nodes, set the <external ups directory> to be /cvmfs/fermilab.opensciencegrid.org/products/larsoft"
22 BUNDLEQUALS=`echo ${QUALS} | sed -e 's/:/-/g'`
25 echo " External UPS destination: ${PRODUCTS}"
26 echo " GArSoft Base version: ${BASEV}"
27 echo " GArSoft Qualifiers: ${QUALS}"
28 echo " Build type: ${BUILDTYPE}"
29 echo " GArSoft destination: ${GARDIR}"
33 if [ "${OS}" = "Linux" ]
35 flvr=slf`lsb_release -r | sed -e 's/[[:space:]]//g' | cut -f2 -d":" | cut -f1 -d"."`
36 elif [ "${OS}" = "Darwin" ]
38 flvr=d`uname -r | cut -f1 -d"."`
41 echo "ERROR: unrecognized operating system ${OS}"
45 # check the product directory to see if we are wanting to use the gpvm node
46 # product installation or not
48 if [[ ${PRODDIR} != *"fermilab"* ]] ; then
50 curl -O http://scisoft.fnal.gov/scisoft/bundles/tools/pullProducts
52 ./pullProducts ${PRODDIR} ${flvr} garsoft-${BASEV} ${BUNDLEQUALS} ${BUILDTYPE}
54 echo "NB the bundle may not yet be available. If that is the case, try developing on the dunegpvm nodes at FNAL"
57 # source the ups products setup
58 source ${PRODDIR}/setup
60 # setup mrb and create the project
61 echo "setting up the mrb working area"
63 if [ ! -d "${GARDIR}" ]; then
64 echo "GArSoft destination directory not found, make it"
72 export MRB_PROJECT=garsoft
74 mrb newDev -v develop -q ${QUALS}:${BUILDTYPE}
76 # make the local products directory name a bit more generic
77 BUNDLEQUALS=`echo ${QUALS} | sed -e 's/:/_/g'`
79 mv localProducts_${MRB_PROJECT}_develop_${BUNDLEQUALS}_${BUILDTYPE} localProducts_${MRB_PROJECT}
81 sed -i~ 's/localProducts_'"${MRB_PROJECT}"'_develop_'"${BUNDLEQUALS}_${BUILDTYPE}"'/localProducts_'"${MRB_PROJECT}"'/g' localProducts_${MRB_PROJECT}/setup
83 rm localProducts_${MRB_PROJECT}/*~
85 source localProducts_${MRB_PROJECT}/setup
87 echo "checking out the garsoft code"
90 mrb g -d garsoft garsoft-garsoft
93 echo "set the build environment"
97 echo "If no errors were reported, you are good to go"
99 echo "Here is an example function you can add to your $HOME/.bash_profile to setup for garsoft development:"
101 echo "develop_gar ()"
104 echo " source ${PRODDIR}/setup"
106 echo " setup ninja v1_6_0b #optional if using ninja to build the code, requires mrb i --generator ninja"
107 echo " source ${GARDIR}/localProducts_${MRB_PROJECT}/setup"
108 echo " cd ${MRB_BUILDDIR}"
110 echo " echo ready to build in ${PWD} "
114 echo "Here is an example function you can add to your $HOME/.bash_profile to setup garsoft for running:"
119 echo " source ${PRODDIR}/setup"
120 echo " export PRODUCTS=/grid/fermiapp/products/common/db:${PRODUCTS}"
121 echo " export PRODUCTS=${GARDIR}/localProducts_${MRB_PROJECT}/:${PRODUCTS}"
123 echo " # setup sam to be able to find files"
126 echo " #voms-proxy-init --rfc --voms=fermilab:/fermilab/gar/Role=Analysis --noregen"
127 echo " #export X509_USER_PROXY=/tmp/x509up_u`id -u`"
129 echo " #setup the garsoft ups product"
130 echo " setup garsoft develop -q ${QUALS}:${BUILDTYPE}"
133 echo " echo ready to run gar in ${GARDIR} "