@@ -17,6 +17,7 @@ update=false
17
17
repo_path=" $DIR "
18
18
channel=' '
19
19
tools_source=' '
20
+ tools_source_suffix=' '
20
21
21
22
#
22
23
# Functions
@@ -29,13 +30,14 @@ __usage() {
29
30
echo " <Arguments>... Arguments passed to the command. Variable number of arguments allowed."
30
31
echo " "
31
32
echo " Options:"
32
- echo " --verbose Show verbose output."
33
- echo " -c|--channel <CHANNEL> The channel of KoreBuild to download. Overrides the value from the config file.."
34
- echo " --config-file <FILE> The path to the configuration file that stores values. Defaults to korebuild.json."
35
- echo " -d|--dotnet-home <DIR> The directory where .NET Core tools will be stored. Defaults to '\$ DOTNET_HOME' or '\$ HOME/.dotnet."
36
- echo " --path <PATH> The directory to build. Defaults to the directory containing the script."
37
- echo " -s|--tools-source|-ToolsSource <URL> The base url where build tools can be downloaded. Overrides the value from the config file."
38
- echo " -u|--update Update to the latest KoreBuild even if the lock file is present."
33
+ echo " --verbose Show verbose output."
34
+ echo " -c|--channel <CHANNEL> The channel of KoreBuild to download. Overrides the value from the config file.."
35
+ echo " --config-file <FILE> The path to the configuration file that stores values. Defaults to korebuild.json."
36
+ echo " -d|--dotnet-home <DIR> The directory where .NET Core tools will be stored. Defaults to '\$ DOTNET_HOME' or '\$ HOME/.dotnet."
37
+ echo " --path <PATH> The directory to build. Defaults to the directory containing the script."
38
+ echo " -s|--tools-source|-ToolsSource <URL> The base url where build tools can be downloaded. Overrides the value from the config file."
39
+ echo " --tools-source-suffix|-ToolsSourceSuffix <SUFFIX> The suffix to append to tools-source. Useful for query strings."
40
+ echo " -u|--update Update to the latest KoreBuild even if the lock file is present."
39
41
echo " "
40
42
echo " Description:"
41
43
echo " This function will create a file \$ DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be."
@@ -50,7 +52,7 @@ get_korebuild() {
50
52
local version
51
53
local lock_file=" $repo_path /korebuild-lock.txt"
52
54
if [ ! -f " $lock_file " ] || [ " $update " = true ]; then
53
- __get_remote_file " $tools_source /korebuild/channels/$channel /latest.txt" " $lock_file "
55
+ __get_remote_file " $tools_source /korebuild/channels/$channel /latest.txt" " $lock_file " " $tools_source_suffix "
54
56
fi
55
57
version=" $( grep ' version:*' -m 1 " $lock_file " ) "
56
58
if [[ " $version " == ' ' ]]; then
@@ -66,7 +68,7 @@ get_korebuild() {
66
68
local remote_path=" $tools_source /korebuild/artifacts/$version /korebuild.$version .zip"
67
69
tmpfile=" $( mktemp) "
68
70
echo -e " ${MAGENTA} Downloading KoreBuild ${version}${RESET} "
69
- if __get_remote_file " $remote_path " " $tmpfile " ; then
71
+ if __get_remote_file " $remote_path " " $tmpfile " " $tools_source_suffix " ; then
70
72
unzip -q -d " $korebuild_path " " $tmpfile "
71
73
fi
72
74
rm " $tmpfile " || true
@@ -98,6 +100,7 @@ __machine_has() {
98
100
__get_remote_file () {
99
101
local remote_path=$1
100
102
local local_path=$2
103
+ local remote_path_suffix=$3
101
104
102
105
if [[ " $remote_path " != ' http' * ]]; then
103
106
cp " $remote_path " " $local_path "
@@ -106,14 +109,14 @@ __get_remote_file() {
106
109
107
110
local failed=false
108
111
if __machine_has wget; then
109
- wget --tries 10 --quiet -O " $local_path " " $remote_path " || failed=true
112
+ wget --tries 10 --quiet -O " $local_path " " ${ remote_path}${remote_path_suffix} " || failed=true
110
113
else
111
114
failed=true
112
115
fi
113
116
114
117
if [ " $failed " = true ] && __machine_has curl; then
115
118
failed=false
116
- curl --retry 10 -sSL -f --create-dirs -o " $local_path " " $remote_path " || failed=true
119
+ curl --retry 10 -sSL -f --create-dirs -o " $local_path " " ${ remote_path}${remote_path_suffix} " || failed=true
117
120
fi
118
121
119
122
if [ " $failed " = true ]; then
@@ -164,6 +167,11 @@ while [[ $# -gt 0 ]]; do
164
167
tools_source=" ${1:- } "
165
168
[ -z " $tools_source " ] && __usage
166
169
;;
170
+ --tools-source-suffix|-ToolsSourceSuffix)
171
+ shift
172
+ tools_source_suffix=" ${1:- } "
173
+ [ -z " $tools_source_suffix " ] && __usage
174
+ ;;
167
175
-u|--update|-Update)
168
176
update=true
169
177
;;
0 commit comments