-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathconfigure.sh
More file actions
executable file
·114 lines (90 loc) · 2.99 KB
/
configure.sh
File metadata and controls
executable file
·114 lines (90 loc) · 2.99 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# SPDX-FileCopyrightText: AdGuard Software Limited
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -e
# Load toolchain setup
source "`dirname $0`/Support/Scripts/include/configure_toolchain.inc"
# Check for newer version of a git repository.
# Usage: check_latest_version <repo_url> <current_tag> <friendly_name>
check_latest_version() {
local repo_url="$1"
local current_tag="$2"
local name="$3"
if [ "${SKIP_VERSION_CHECK:-}" = "1" ]; then
return
fi
local latest_tag
latest_tag=$(git ls-remote --tags --sort=-v:refname "$repo_url" 2>/dev/null \
| grep -o 'refs/tags/v[0-9][^{}]*$' \
| head -1 \
| sed 's|refs/tags/||')
if [ -n "$latest_tag" ] && [ "$latest_tag" != "$current_tag" ]; then
echo ""
echo "========================================================"
echo " UPDATE AVAILABLE: $name"
echo " Current: $current_tag → Latest: $latest_tag"
echo "========================================================"
echo ""
sleep 1
fi
}
if [ "$1" == "dev" ]; then
ENV_NAME=Development
else
ENV_NAME=Production
fi
echo "==== Configure environment for: $ENV_NAME ===="
echo
if [ -f ../adguard-mini-private/config.env ]; then
source ../adguard-mini-private/config.env
fi
setup_toolchain
if [[ "$1" == "dev" ]]; then
# Clone support-scripts
SUPPORT_SCRIPTS_TAG="v1.2"
if [ -z "$SUPPORT_SCRIPTS_GIT" ]; then
echo "Error: SUPPORT_SCRIPTS_GIT not set. Source ../adguard-mini-private/config.env or set via environment."
exit 1
fi
rm -rf support-scripts
git clone -c advice.detachedHead=false --depth 1 --branch "$SUPPORT_SCRIPTS_TAG" "$SUPPORT_SCRIPTS_GIT" support-scripts
rm -rf support-scripts/.git
pushd support-scripts
bundle config set --local path '../.bundle/vendor'
bundle install
popd
check_latest_version "$SUPPORT_SCRIPTS_GIT" "$SUPPORT_SCRIPTS_TAG" "support-scripts"
fi
bundle config --local path '.bundle/vendor'
bundle config unset --local without
if [ "$1" != "dev" ]; then
bundle config set --local without 'development'
fi
bundle install
# Generate Bundler binstubs with bin/ruby shebang
bundle binstubs --all --force --shebang "$PWD/bin/ruby"
if [ ! ${bamboo_no_need_private_vars} ]; then
if [ -z "$KEYCHAIN_GIT" ]; then
echo "Error: KEYCHAIN_GIT not set. Source ../adguard-mini-private/config.env or set via environment."
exit 1
fi
pushd fastlane
rm -rf keychain
git clone $KEYCHAIN_GIT
popd
bin/fastlane create_sens_config
fi
# Activate python venv and install components
echo
echo "Configure Python"
echo
source "`dirname $0`/Support/Scripts/include/configure_python.inc"
if [ "$1" == "dev" ]; then
# Install protoc tools
"`dirname $0`/Support/Scripts/install_protoc_tools.sh"
# syncs certificates for `MAS` distribution
bin/fastlane certs config:MAS
# syncs certificates for `Standalone` distribution
bin/fastlane certs config:Debug
fi