Skip to content

Commit

Permalink
Merge pull request #1750 from myxmaster/improve-fetch-libraries
Browse files Browse the repository at this point in the history
Improve fetch-libraries script
  • Loading branch information
kaloudis authored Oct 11, 2023
2 parents 61a5db5 + 2fffae5 commit dabd3af
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ ios/Pods

# Lnd binaries
android/lndmobile/Lndmobile.aar
ios/LncMobile/Lndmobile.xcframework
ios/LncMobile/Lndmobile.xcframework
ios/LndMobileLibZipFile
60 changes: 37 additions & 23 deletions fetch-libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,48 @@ then
exit
fi

# delete old instances of library files
rm android/lndmobile/$ANDROID_FILE
rm -rf ios/LncMobile/$IOS_FILE
###########
# Android #
###########

# create temp dir
mkdir tmp
if ! echo "$ANDROID_SHA256 android/lndmobile/$ANDROID_FILE" | sha256sum -c -; then
echo "Android library file missing or checksum failed" >&2

# download LND library files
curl -L $ANDROID_LINK > tmp/$ANDROID_FILE
curl -L $IOS_LINK > tmp/$IOS_FILE.zip
# delete old instance of library file
rm android/lndmobile/$ANDROID_FILE

# check checksums
if ! echo "$ANDROID_SHA256 tmp/$ANDROID_FILE" | sha256sum -c -; then
echo "Android checksum failed" >&2
exit 1
fi
# download Android LND library file
curl -L $ANDROID_LINK > android/lndmobile/$ANDROID_FILE

if ! echo "$IOS_SHA256 tmp/$IOS_FILE.zip" | sha256sum -c -; then
echo "iOS checksum failed" >&2
exit 1
# check checksum
if ! echo "$ANDROID_SHA256 android/lndmobile/$ANDROID_FILE" | sha256sum -c -; then
echo "Android checksum failed" >&2
exit 1
fi
fi

# unzip LND library files
unzip tmp/$IOS_FILE.zip -d tmp/
#######
# iOS #
#######

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

# move LND library files into place
mv tmp/$ANDROID_FILE android/lndmobile/$ANDROID_FILE
mv tmp/$IOS_FILE ios/LncMobile/$IOS_FILE
# 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

# delete temp dir
rm -rf tmp
# unzip LND library file
unzip ios/LndMobileLibZipFile/$IOS_FILE.zip -d ios/LncMobile

0 comments on commit dabd3af

Please sign in to comment.