forked from ZeusLN/zeus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch-libraries.sh
73 lines (54 loc) · 1.93 KB
/
fetch-libraries.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
62
63
64
65
66
67
68
69
70
71
72
73
VERSION=v0.18.3-beta-zeus.previous-events
ANDROID_FILE=Lndmobile.aar
IOS_FILE=Lndmobile.xcframework
ANDROID_SHA256='a48b39675d1442611546cb22b07c8440f44d7917a77962f1f50fe558a679c220'
IOS_SHA256='de9831c586b31008bfca1d48d9b4e11bbae2adcd2127b614530d8e7259f1bcf4'
FILE_PATH=https://github.com/ZeusLN/lnd/releases/download/$VERSION/
ANDROID_LINK=$FILE_PATH$ANDROID_FILE
IOS_LINK=$FILE_PATH$IOS_FILE.zip
# test that curl and unzip are installed
if ! command -v curl &> /dev/null
then
echo "curl could not be found. Please install it and run the script again."
exit
fi
if ! command -v unzip &> /dev/null
then
echo "unzip could not be found. Please install it and run the script again."
exit
fi
###########
# Android #
###########
if ! echo "$ANDROID_SHA256 android/lndmobile/$ANDROID_FILE" | sha256sum -c -; then
echo "Android library file missing or checksum failed" >&2
# delete old instance of library file
rm android/lndmobile/$ANDROID_FILE
# download Android LND library file
curl -L $ANDROID_LINK > android/lndmobile/$ANDROID_FILE
# check checksum
if ! echo "$ANDROID_SHA256 android/lndmobile/$ANDROID_FILE" | sha256sum -c -; then
echo "Android checksum failed" >&2
exit 1
fi
fi
#######
# iOS #
#######
mkdir ios/LndMobileLibZipFile
if ! echo "$IOS_SHA256 ios/LndMobileLibZipFile/$IOS_FILE.zip" | sha256sum -c -; then
echo "iOS library file missing or checksum failed" >&2
# delete old instance of library file
rm ios/LndMobileLibZipFile/$IOS_FILE.zip
# download iOS LND library file
curl -L $IOS_LINK > ios/LndMobileLibZipFile/$IOS_FILE.zip
# check checksum
if ! echo "$IOS_SHA256 ios/LndMobileLibZipFile/$IOS_FILE.zip" | sha256sum -c -; then
echo "iOS checksum failed" >&2
exit 1
fi
fi
# delete old instances of library files
rm -rf ios/LncMobile/$IOS_FILE
# unzip LND library file
unzip ios/LndMobileLibZipFile/$IOS_FILE.zip -d ios/LncMobile