All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
grid_setup.sh
Go to the documentation of this file.
1 # this script must be sourced
2 
4 {
5  echo "USAGE: source grid_setup.sh <product_dir>"
6  echo " sets up all ups products found in <product_dir>"
7  echo ""
8  echo " This script is designed to be used when copying a localProducts directory"
9  echo " to the grid for testing."
10  echo " DO NOT setup mrb when using this script."
11  echo ""
12 }
13 
15 {
16  ( cd / ; /bin/pwd -P ) >/dev/null 2>&1
17  if (( $? == 0 )); then
18  pwd_P_arg="-P"
19  fi
20 echo "bash source $BASH_SOURCE"
21  reldir=`dirname "$BASH_SOURCE"`
22  thisdir=`cd ${reldir} && /bin/pwd ${pwd_P_arg}`
23 }
24 
26 
27 test $?shell = 1 && set ss=csh || ss=sh
28 echo Shell type is $ss.
29 
30 if [ -z ${MRB_INSTALL} ]
31 then
32  echo "ERROR: please specify the product directory"
33  usage
34  return 1
35 fi
36 
37 if [ -n "${MRB_BUILDDIR}" ]; then
38  echo "ERROR: the mrb development environment is enabled."
39  echo "ERROR: please run this script in a clean environment."
40  return 1
41 fi
42 if [ -n "${MRB_SOURCE}" ]; then
43  echo "ERROR: the mrb development environment is enabled."
44  echo "ERROR: please run this script in a clean environment."
45  return 1
46 fi
47 
48 if [ ! -d ${MRB_INSTALL} ]
49 then
50  echo "ERROR: cannot find ${MRB_INSTALL}"
51  usage
52  return 1
53 fi
54 
56 
57 if [ -z ${UPS_DIR} ]
58 then
59  echo "ERROR: please setup ups"
60  return 1
61 fi
62 source `${UPS_DIR}/bin/ups setup ${SETUP_UPS}`
63 
64 localP=$MRB_INSTALL
65 
66 ##echo
67 ##ups active
68 ##echo
69 
70 tmpfl=/tmp/`basename $localP`_setup_$$$$
71 rm -f $tmpfl
72 echo > $tmpfl
73 echo "## checking $localP for products" >> $tmpfl
74 echo "source \`${UPS_DIR}/bin/ups setup ${SETUP_UPS}\`" >> $tmpfl
75 
76 # deal with UPS_OVERRIDE
77 echo "# incoming UPS_OVERRIDE $UPS_OVERRIDE" >> $tmpfl
78 if [ -z "${UPS_OVERRIDE}" ]; then
79  new_override="-B"
80 else
81  tempover=`echo ${UPS_OVERRIDE} | sed -e 's/\-B//'`
82  new_override="-B ${tempover}"
83 fi
84 echo "export UPS_OVERRIDE=\"${new_override}\"" >> $tmpfl
85 
86 ups list -aK+ -z $localP | while read line
87 do
88  ##echo "got line: $line"
89  words=($(echo $line | tr " " "\n"))
90  ##echo "split into ${#words[@]} pieces"
91  product=$(echo ${words[0]} | tr "\"" " ")
92  version=$(echo ${words[1]} | tr "\"" " ")
93  quals=$(echo ${words[3]} | tr "\"" " ")
94  product_uc=$(echo ${product} | tr '[a-z]' '[A-z]')
95  echo "product_setup=\$(printenv | grep SETUP_${product_uc} | wc -l)" >> $tmpfl
96  echo "if [[ \"\${product_setup}\" > 0 ]]; then" >> $tmpfl
97  echo "unsetup -j $product" >> $tmpfl
98  echo "fi" >> $tmpfl
99  if [ -z $quals ]
100  then
101  cmd="setup -B $product $version"
102  else
103  pq=+`echo ${quals} | sed -e 's/:/:+/g'`
104  cmd="setup -B $product $version -q $pq"
105  fi
106  echo "$cmd -z $localP:${PRODUCTS}" >> $tmpfl
107 done
108 
109 echo "ready to source $tmpfl"
110 source $tmpfl
111 
112 
113 return 0
process_name opflash particleana ie ie ie z
then source grid fermiapp products dune setup_dune_fermiapp sh exit else echo No setup file found exit fi setup
do source
usage
Definition: doGit.sh:21
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
then shift fi
do cd
*export UPS_OVERRIDE
MRB_INSTALL
Definition: grid_setup.sh:25
do i e
BEGIN_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree showermakertwo END_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree sequence::inline_paths sequence::inline_paths sequence::inline_paths showermakers test
get_this_dir()
Definition: grid_setup.sh:14
list
Definition: file_to_url.sh:28