All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbndpoms_metadata_injector.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 #Take in all of the arguments
4 while :; do
5  case $1 in
6  -h|-\?|--help)
7  show_help # Display a usage synopsis.
8  exit
9  ;;
10  --mdappfamily) # Takes an option argument; ensure it has been specified.
11  if [ "$2" ]; then
13  shift
14  else
15  echo "$0 ERROR: mdappfamily requires a non-empty option argument."
16  exit 1
17  fi
18  ;;
19 
20  --mdappversion) # Takes an option argument; ensure it has been specified.
21  if [ "$2" ]; then
23  shift
24  else
25  echo "$0 ERROR: mdappversion requires a non-empty option argument."
26  exit 1
27  fi
28  ;;
29 
30  --inputfclname) # Takes an option argument; ensure it has been specified.
31  if [ "$2" ]; then
33  shift
34  else
35  echo "$0 ERROR: inputfclname requires a non-empty option argument."
36  exit 1
37  fi
38  ;;
39 
40  --mdfiletype) # Takes an option argument; ensure it has been specified.
41  if [ "$2" ]; then
43  shift
44  else
45  echo "$0 ERROR: mdfiletype requires a non-empty option argument."
46  exit 1
47  fi
48  ;;
49  --mdruntype) # Takes an option argument; ensure it has been specified.
50  if [ "$2" ]; then
51  MDRUNTYPE="$2"
52  shift
53  else
54  echo "$0 ERROR: mdruntype requires a non-empty option argument."
55  exit 1
56  fi
57  ;;
58  --mdgroupname) # Takes an option argument; ensure it has been specified.
59  if [ "$2" ]; then
61  shift
62  else
63  echo "$0 ERROR: mdgroupname requires a non-empty option argument."
64  exit 1
65  fi
66  ;;
67  --mdfclname) # Takes an option argument; ensure it has been specified.
68  if [ "$2" ]; then
69  MDFCLNAME="$2"
70  shift
71  else
72  echo "$0 ERROR: mdfclname requires a non-empty option argument."
73  exit 1
74  fi
75  ;;
76  --mdprojectname) # Takes an option argument; ensure it has been specified.
77  if [ "$2" ]; then
79  shift
80  else
81  echo "$0 ERROR: mdprojectname requires a non-empty option argument."
82  exit 1
83  fi
84  ;;
85  --mdprojectstage) # Takes an option argument; ensure it has been specified.
86  if [ "$2" ]; then
88  shift
89  else
90  echo "$0 ERROR: mdprojectstage requires a non-empty option argument."
91  exit 1
92  fi
93  ;;
94  --mdprojectversion) # Takes an option argument; ensure it has been specified.
95  if [ "$2" ]; then
97  shift
98  else
99  echo "$0 ERROR: mdprojectversion requires a non-empty option argument."
100  exit 1
101  fi
102  ;;
103  --mdprojectsoftware) # Takes an option argument; ensure it has been specified.
104  if [ "$2" ]; then
106  shift
107  else
108  echo "$0 ERROR: mdprojectsoftware requires a non-empty option argument."
109  exit 1
110  fi
111  ;;
112  --mdproductionname) # Takes an option argument; ensure it has been specified.
113  if [ "$2" ]; then
115  shift
116  else
117  echo "$0 ERROR: mdproductionname requires a non-empty option argument."
118  exit 1
119  fi
120  ;;
121  --mdproductiontype) # Takes an option argument; ensure it has been specified.
122  if [ "$2" ]; then
124  shift
125  else
126  echo "$0 ERROR: mdproductiontype requires a non-empty option argument."
127  exit 1
128  fi
129  ;;
130  --tfilemdjsonname) # Takes an option argument; ensure it has been specified.
131  if [ "$2" ]; then
133  shift
134  else
135  echo "$0 ERROR: tfilemdjsonname requires a non-empty option argument."
136  exit 1
137  fi
138  ;;
139  --cafname) # Takes an option argument; ensure it has been specified.
140  if [ "$2" ]; then
141  CAFNAME="$2"
142  shift
143  else
144  echo "$0 ERROR: cafname requires a non-empty option argument."
145  exit 1
146  fi
147  ;;
148 #
149 # --file=?*)
150 # file=${1#*=} # Delete everything up to "=" and assign the remainder.
151 # ;;
152 # --file=) # Handle the case of an empty --file=
153 # echo 'ERROR: "--file" requires a non-empty option argument.'
154 # ;;
155  -v|--verbose)
156  verbose=$((verbose + 1)) # Each -v adds 1 to verbosity.
157  ;;
158  --) # End of all options.
159  shift
160  break
161  ;;
162  -?*)
163  printf "$0 WARN: Unknown option (ignored): %s\n" "$1" >&2
164  ;;
165  *) # Default case: No more options, so break out of the loop.
166  break
167  esac
168  shift
169 done
170 
171 if [ -z "$MDAPPFAMILY" ]; then
172  echo "$0 ERROR: mdappfamily is mandatory"
173  exit 2
174 fi
175 
176 if [ -z "$MDAPPVERSION" ]; then
177  echo "$0 ERROR: mdappversion is mandatory"
178  exit 2
179 fi
180 
181 if [ -z "$INPUTFCLNAME" ]; then
182  echo "$0 ERROR: inputfclname is mandatory"
183  exit 2
184 fi
185 
186 if [ -z "$MDFILETYPE" ]; then
187  echo "$0 ERROR: mdfiletype is mandatory"
188  exit 2
189 fi
190 
191 if [ -z "$MDRUNTYPE" ]; then
192  echo "$0 ERROR: mdruntype is mandatory"
193  exit 2
194 fi
195 
196 if [ -z "$MDGROUPNAME" ]; then
197  echo "$0 ERROR: mdgroupname is mandatory"
198  exit 2
199 fi
200 
201 if [ -z "$MDFCLNAME" ]; then
202  echo "$0 ERROR: mdfclname is mandatory"
203  exit 2
204 fi
205 
206 if [ -z "$MDPROJECTNAME" ]; then
207  echo "$0 ERROR: mdprojectname is mandatory"
208  exit 2
209 fi
210 
211 if [ -z "$MDPROJECTSTAGE" ]; then
212  echo "$0 ERROR: mdprojectstage is mandatory"
213  exit 2
214 fi
215 
216 if [ -z "$MDPROJECTVERSION" ]; then
217  echo "$0 ERROR: mdprojectverson is mandatory"
218  exit 2
219 fi
220 
221 if [ -z "$MDPROJECTSOFTWARE" ]; then
222  echo "$0 ERROR: mdprojectsoftware is mandatory"
223  exit 2
224 fi
225 
226 if [ -z "$MDPRODUCTIONNAME" ]; then
227  echo "$0 ERROR: mdproductionname is mandatory"
228  exit 2
229 fi
230 
231 if [ -z "$MDPRODUCTIONTYPE" ]; then
232  echo "$0 ERROR: mdproductiontype is mandatory"
233  exit 2
234 fi
235 
236 #Start the injection
237 echo -e "\n#Metadata injection by $0" >> $INPUTFCLNAME
238 echo "services.FileCatalogMetadata.applicationFamily: \"$MDAPPFAMILY\"" >> $INPUTFCLNAME
239 echo "services.FileCatalogMetadata.applicationVersion: \"$MDAPPVERSION\"" >> $INPUTFCLNAME
240 echo "services.FileCatalogMetadata.fileType: \"$MDFILETYPE\"" >> $INPUTFCLNAME
241 echo "services.FileCatalogMetadata.runType: \"$MDRUNTYPE\"" >> $INPUTFCLNAME
242 echo "services.FileCatalogMetadata.group: \"$MDGROUPNAME\"" >> $INPUTFCLNAME
243 echo "services.FileCatalogMetadataSBN.FCLName: \"$MDFCLNAME\"" >> $INPUTFCLNAME
244 echo "services.FileCatalogMetadataSBN.ProjectName: \"$MDPROJECTNAME\"" >> $INPUTFCLNAME
245 echo "services.FileCatalogMetadataSBN.ProjectStage: \"$MDPROJECTSTAGE\"" >> $INPUTFCLNAME
246 echo "services.FileCatalogMetadataSBN.ProjectVersion: \"$MDPROJECTVERSION\"" >> $INPUTFCLNAME
247 echo "services.FileCatalogMetadataSBN.ProjectSoftware: \"$MDPROJECTSOFTWARE\"" >> $INPUTFCLNAME
248 echo "services.FileCatalogMetadataSBN.ProductionName: \"$MDPRODUCTIONNAME\"" >> $INPUTFCLNAME
249 echo "services.FileCatalogMetadataSBN.ProductionType: \"$MDPRODUCTIONTYPE\"" >> $INPUTFCLNAME
250 #only include the metadata json production if the name of the json has been specified
251 if [ "$TFILEMDJSONNAME" ]; then
252  echo "services.MetadataSBN: @local::sbnd_file_catalog_sbn" >> $INPUTFCLNAME
253  echo "services.MetadataSBN.JSONFileName: \"$TFILEMDJSONNAME\"" >> $INPUTFCLNAME
254 fi
255 # If we want to make caf files in production, lets set the output name here also
256 if [ "$CAFNAME" ]
257 then
258  echo "physics.producers.mycafmaker.CAFFilename: \"$CAFNAME\"" >> $INPUTFCLNAME
259  echo "services.MetadataSBN.dataTier: \"caf\"" >> $INPUTFCLNAME
260  echo "services.MetadataSBN.fileFormat: \"caf\"" >> $INPUTFCLNAME
261 fi
process_name opflash particleana ie ie ie z
then MDPROJECTSOFTWARE
#define the
shift
Definition: fcl_checks.sh:26
then MDPROJECTNAME
usage
Definition: doGit.sh:21
then echo Sam station was not specified(use option--sam_station)." exit 1 fi if [ x$SAM_GROUP
process_name gaushit a
while getopts h
v let verbose
then MDPROJECTVERSION
then shift fi
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker options
do i e
then echo fcl name
echo Invalid option
Definition: TrainMVA.sh:17
basic_json<> json
default JSON class
Definition: json.hpp:2445
then echo find_global_symbol finds mangled or demangled symbols in libraries echo within LD_LIBRARY_PATH match any symbol that echo contains name echo Default
then MDPROJECTSTAGE
shift break
Definition: just_cmake.sh:60
then TFILEMDJSONNAME