-
Notifications
You must be signed in to change notification settings - Fork 21
/
update_dependencies.sh
executable file
·80 lines (61 loc) · 2.24 KB
/
update_dependencies.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
74
75
76
77
78
79
80
#!/bin/bash
FILE=env.json
WORKING_DIR=Temp
FRAMEWORK_ZIP_FILE_NAME=libminotari_wallet_ffi.ios-xcframework.zip
FRAMEWORK_DIRECTORY=libminotari_wallet_ffi-ios-xcframework
FRAMEWORK_FILE_NAME=libminotari_wallet_ffi_ios.xcframework
PROJECT_FRAMEWORK_DIRECTORY=./MobileWallet/Libraries/TariLib
if test ! -f "$FILE"; then
echo "$FILE does not exist. Creating default."
cp env-example.json env.json
echo "Please adjust env.json as needed."
fi
echo "\n\n***Pulling latest Tari lib build***"
source dependencies.env
rm -rf $WORKING_DIR
mkdir $WORKING_DIR
curl -L "https://github.com/tari-project/tari/releases/download/v$FFI_VERSION/$FRAMEWORK_ZIP_FILE_NAME" -o "./$WORKING_DIR/$FRAMEWORK_ZIP_FILE_NAME"
unzip "./$WORKING_DIR/$FRAMEWORK_ZIP_FILE_NAME" -d "./$WORKING_DIR"
rm -f "./$WORKING_DIR/$FRAMEWORK_ZIP_FILE_NAME"
rm -rf $PROJECT_FRAMEWORK_DIRECTORY/$FRAMEWORK_FILE_NAME
mv $WORKING_DIR/$FRAMEWORK_DIRECTORY/$FRAMEWORK_FILE_NAME $PROJECT_FRAMEWORK_DIRECTORY
rm -rf $WORKING_DIR
# Check for cocoapods and install if missing.
if hash pod 2>/dev/null; then
echo "Cool, you have pods installed."
else
echo "You need cocoapods. Would you like it installed?"
read -e -p "y or n? " yn
if [[ "y" = "$yn" || "Y" = "$yn" ]]; then
sudo gem install cocoapods
fi
fi
echo "\n\n***Updating pods***"
pod install
echo "\n\n***Updating Property Lists***"
# Info.plist
INFO_PLIST_PATH="./MobileWallet/Info.plist"
DROPBOX_KEY="Dropbox"
API_KEY=$( jq -r '.dropboxApiKey' $FILE )
ELEMENTS_COUNT=$( plutil -extract CFBundleURLTypes raw $INFO_PLIST_PATH )
if [ $API_KEY != null ]; then
for (( i=0; i<$ELEMENTS_COUNT; i++ ))
do
KEY=$( plutil -extract CFBundleURLTypes.$i.CFBundleURLName raw $INFO_PLIST_PATH )
if [ $KEY == $DROPBOX_KEY ]; then
plutil -replace CFBundleURLTypes.$i.CFBundleURLSchemes -json "[\"db-$API_KEY\"]" $INFO_PLIST_PATH
fi
done
fi
# Git Hooks
echo "\n\n***Updating Git Hooks***"
PER_COMMIT_HOOK_PATH=".git/hooks/pre-commit"
PRE_HOOK_SCRIPT_PATH="./pre_commit.sh"
chmod 500 $PRE_HOOK_SCRIPT_PATH
if ! [[ -f $PER_COMMIT_HOOK_PATH ]]; then
touch $PER_COMMIT_HOOK_PATH
chmod 700 $PER_COMMIT_HOOK_PATH
fi
if ! $( grep -Fxq $PRE_HOOK_SCRIPT_PATH $PER_COMMIT_HOOK_PATH ); then
echo $PRE_HOOK_SCRIPT_PATH >> $PER_COMMIT_HOOK_PATH
fi