summaryrefslogtreecommitdiffhomepage
path: root/ios/prebuild.sh
blob: 903c5399d0515c1c34c6612f79a965e01214d81c (plain)
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
#!/bin/sh

if [ -z "$PROJECT_DIR" ]; then
  echo "This script is intended to be executed by Xcode"
  exit 1
fi

ASSETS_DIR_PATH="$PROJECT_DIR/Assets"

RELAYS_FILE="$ASSETS_DIR_PATH/relays.json"
API_IP_ADDRESS_LIST_FILE="$ASSETS_DIR_PATH/api-ip-address.json"

if [ $CONFIGURATION == "Release" ]; then
  echo "Remove relays file"
  if [ -f "$RELAYS_FILE" ]; then
    rm "$RELAYS_FILE"
  else
    echo "Relays file does not exist"
  fi

  echo "Remove API address list file"
  if [ -f "$API_IP_ADDRESS_LIST_FILE" ]; then
    rm "$API_IP_ADDRESS_LIST_FILE"
  else
    echo "API IP address list file does not exist"
  fi
fi

if [ ! -f "$RELAYS_FILE" ]; then
  echo "Download relays file"
  curl https://api.mullvad.net/app/v1/relays -s -o "$RELAYS_FILE"
fi

if [ ! -f "$API_IP_ADDRESS_LIST_FILE" ]; then
  echo "Download API address list"
  curl https://api.mullvad.net/app/v1/api-addrs -s -o "$API_IP_ADDRESS_LIST_FILE"
fi