-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_envs.sh
executable file
·53 lines (45 loc) · 1.35 KB
/
build_envs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
PSANADIR=""
DEPSDIR=""
usage() { echo "Usage: $0 [-d <lcls1 deps dir>] [-p <lcls2 psana dir>]" 1>&2; exit 1; }
# parse cli args
while getopts ":d:p:" o; do
case "${o}" in
d)
DEPSDIR=${OPTARG}
;;
p)
PSANADIR=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
# check if specified lcls2 psana directory exists and if so resolve paths to absolute paths
if [ -n "${PSANADIR}" ]; then
if [ -d "${PSANADIR}" ]; then
PSANADIR="$(cd "$(readlink -f "${PSANADIR}")"; pwd -P)"
else
echo "The specified psana install directory does not exist: ${PSANADIR}"
exit 1
fi
fi
# check if specified lcls1 deps directory exists and if so resolve paths to absolute paths
if [ -n "${DEPSDIR}" ]; then
if [ -d "${DEPSDIR}" ]; then
DEPSDIR="$(cd "$(readlink -f "${DEPSDIR}")"; pwd -P)"
else
echo "The specified dependencies directory does not exist: ${DEPSDIR}"
exit 1
fi
fi
# find directory of the script
export RELDIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"; pwd -P)"
# change to that directory
cd -P -- "${RELDIR}"
# build the lcls1 version of the environment
"${RELDIR}/build_lcls1_env.sh" "${DEPSDIR}"
# build the lcls2 version of the environment
"${RELDIR}/build_lcls2_env.sh" "${PSANADIR}"