forked from rsksmart/rskj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·54 lines (48 loc) · 1.44 KB
/
configure.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
#!/bin/sh
GRADLE_WITNESS="1b8eaa3a788aac37ee78fa65579246d1ad268e3c8cf42cd2caeffc50b3e50056"
GRADLE_WRAPPER="0f49043be582d7a39b671f924c66bd9337b92fa88ff5951225acc60560053067"
DOWNLOADED_HASH1=''
DOWNLOADED_HASH2=''
DOWNLOAD_FILE1=$(mktemp)
DOWNLOAD_FILE2=$(mktemp)
unamestr=`uname`
trap 'rm -f "$DOWNLOAD_FILE1" "$DOWNLOAD_FILE2"' EXIT INT QUIT TERM
downloadJar() {
platform
if [ ! -d ./rskj-core/libs ]; then
mkdir ./rskj-core/libs
fi
curl https://deps.rsklabs.io/rsk-gradle-witness.jar -o "$DOWNLOAD_FILE1"
curl https://deps.rsklabs.io/gradle-wrapper.jar -o "$DOWNLOAD_FILE2"
if [ x"$PLATFORM" = x'linux' ] || [ x"$PLATFORM" = x'windows' ]; then
DOWNLOADED_HASH1=$(sha256sum "$DOWNLOAD_FILE1" | cut -d' ' -f1)
DOWNLOADED_HASH2=$(sha256sum "$DOWNLOAD_FILE2" | cut -d' ' -f1)
elif [ x"$PLATFORM" = x'mac' ]; then
DOWNLOADED_HASH1=$(shasum -a 256 "$DOWNLOAD_FILE1" | cut -d' ' -f1)
DOWNLOADED_HASH2=$(shasum -a 256 "$DOWNLOAD_FILE2" | cut -d' ' -f1)
fi
if [ "$GRADLE_WITNESS" != "$DOWNLOADED_HASH1" ]; then
exit 1
else
mv "$DOWNLOAD_FILE1" ./rskj-core/libs/rsk-gradle-witness.jar
fi
if [ "$GRADLE_WRAPPER" != "$DOWNLOADED_HASH2" ]; then
exit 1
else
mv "$DOWNLOAD_FILE2" ./gradle/wrapper/gradle-wrapper.jar
fi
}
platform() {
case $unamestr in
Linux) PLATFORM='linux' ;;
Darwin) PLATFORM='mac' ;;
*MINGW*)
PLATFORM='windows'
;;
*) printf "\e[1m\e[31m[ ERROR ]\e[0m UNRECOGNIZED PLATFORM"
exit 2
;;
esac
}
downloadJar
exit 0