@@ -17,6 +17,7 @@ update=false
1717repo_path=" $DIR "
1818channel=' '
1919tools_source=' '
20+ tools_source_suffix=' '
2021
2122#
2223# Functions
@@ -29,13 +30,14 @@ __usage() {
2930 echo " <Arguments>... Arguments passed to the command. Variable number of arguments allowed."
3031 echo " "
3132 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."
3941 echo " "
4042 echo " Description:"
4143 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() {
5052 local version
5153 local lock_file=" $repo_path /korebuild-lock.txt"
5254 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 "
5456 fi
5557 version=" $( grep ' version:*' -m 1 " $lock_file " ) "
5658 if [[ " $version " == ' ' ]]; then
@@ -66,7 +68,7 @@ get_korebuild() {
6668 local remote_path=" $tools_source /korebuild/artifacts/$version /korebuild.$version .zip"
6769 tmpfile=" $( mktemp) "
6870 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
7072 unzip -q -d " $korebuild_path " " $tmpfile "
7173 fi
7274 rm " $tmpfile " || true
@@ -98,6 +100,7 @@ __machine_has() {
98100__get_remote_file () {
99101 local remote_path=$1
100102 local local_path=$2
103+ local remote_path_suffix=$3
101104
102105 if [[ " $remote_path " != ' http' * ]]; then
103106 cp " $remote_path " " $local_path "
@@ -106,14 +109,14 @@ __get_remote_file() {
106109
107110 local failed=false
108111 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
110113 else
111114 failed=true
112115 fi
113116
114117 if [ " $failed " = true ] && __machine_has curl; then
115118 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
117120 fi
118121
119122 if [ " $failed " = true ]; then
@@ -164,6 +167,11 @@ while [[ $# -gt 0 ]]; do
164167 tools_source=" ${1:- } "
165168 [ -z " $tools_source " ] && __usage
166169 ;;
170+ --tools-source-suffix|-ToolsSourceSuffix)
171+ shift
172+ tools_source_suffix=" ${1:- } "
173+ [ -z " $tools_source_suffix " ] && __usage
174+ ;;
167175 -u|--update|-Update)
168176 update=true
169177 ;;
0 commit comments