forked from WorldHealthOrganization/smart-immunizations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_updateCQFTooling.sh
executable file
·61 lines (53 loc) · 1.59 KB
/
_updateCQFTooling.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
54
55
56
57
58
59
60
61
#!/bin/bash
#DO NOT EDIT WITH WINDOWS
#exit 1
r=releases
g=org.opencds.cqf
a=tooling-cli
v=2.4.0
dlurl='https://oss.sonatype.org/service/local/artifact/maven/redirect?r='${r}'&g='${g}'&a='${a}'&v='${v}''
echo ${dlurl}
input_cache_path=./input-cache/
tooling_jar=tooling-cli-2.4.0.jar
set -e
if ! type "curl" > /dev/null; then
echo "ERROR: Script needs curl to download latest IG Tooling. Please install curl."
exit 1
fi
tooling="$input_cache_path$tooling_jar"
if test -f "$tooling"; then
echo "IG Tooling FOUND in input-cache"
jarlocation="$tooling"
jarlocationname="Input Cache"
upgrade=true
else
tooling="../$tooling_jar"
upgrade=true
if test -f "$tooling"; then
echo "IG Tooling FOUND in parent folder"
jarlocation="$tooling"
jarlocationname="Parent Folder"
upgrade=true
else
echo IG Tooling NOT FOUND in input-cache or parent folder...
jarlocation="$input_cache_path$tooling_jar"
jarlocationname="Input Cache"
upgrade=false
fi
fi
if $upgrade ; then
message="Overwrite $jarlocation? [Y/N] "
else
#echo Will place tooling jar here: $input_cache_path$tooling_jar
echo Will place tooling jar here: $jarlocation
message="Ok? [Y/N]"
fi
read -r -p "$message" response
if [[ "$response" =~ ^([yY])$ ]]; then
echo "Downloading most recent tooling to $jarlocationname - it's ~110 MB, so this may take a bit"
# wget "https://oss.sonatype.org/service/local/repositories/snapshots/content/org/opencds/cqf/tooling/1.0-SNAPSHOT/tooling-1.0-20200107.163002-6-jar-with-dependencies.jar" -O "$jarlocation"
curl $dlurl -L -o "$jarlocation" --create-dirs
echo "Download complete."
else
echo cancel...
fi