Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve fetch-libraries script #1750

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this necessarily need its own folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, where do you like it better? Before it was in a tmp dir, so I made a dir with a clear name...

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