From a897dbaec6dfaf667a58cfc1adf43550d6a8f2fd Mon Sep 17 00:00:00 2001 From: Davis Goodin Date: Mon, 16 Oct 2017 13:00:37 -0500 Subject: [PATCH 1/4] Source (.) init-tools.sh rather than executing it --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index ac80fa476a..192dd00fd5 100755 --- a/build.sh +++ b/build.sh @@ -15,7 +15,7 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 export DOTNET_MULTILEVEL_LOOKUP=0 export NUGET_PACKAGES="$SCRIPT_ROOT/packages/" -"$SCRIPT_ROOT/init-tools.sh" +. "$SCRIPT_ROOT/init-tools.sh" CLIPATH="$SCRIPT_ROOT/Tools/dotnetcli" SDKPATH="$CLIPATH/sdk/$SDK_VERSION" From ef41642820528ed1b003fd09715eaf2c8c36cc17 Mon Sep 17 00:00:00 2001 From: Davis Goodin Date: Mon, 16 Oct 2017 13:21:13 -0500 Subject: [PATCH 2/4] Unset eu, pipefail: init-tools.sh not compatible --- build.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 192dd00fd5..43810a6f5b 100755 --- a/build.sh +++ b/build.sh @@ -15,7 +15,11 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 export DOTNET_MULTILEVEL_LOOKUP=0 export NUGET_PACKAGES="$SCRIPT_ROOT/packages/" -. "$SCRIPT_ROOT/init-tools.sh" +( + # init-tools.sh isn't compatible with these flags. Unset them in this subshell. + set +euo pipefail + . "$SCRIPT_ROOT/init-tools.sh" +) CLIPATH="$SCRIPT_ROOT/Tools/dotnetcli" SDKPATH="$CLIPATH/sdk/$SDK_VERSION" From 59dc793249fa7fb5e568ab2f556cce5b530179f6 Mon Sep 17 00:00:00 2001 From: Davis Goodin Date: Mon, 16 Oct 2017 15:27:15 -0500 Subject: [PATCH 3/4] Fix init-tools.sh to work with -euo pipefail --- build.sh | 6 +----- init-tools.sh | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index 43810a6f5b..192dd00fd5 100755 --- a/build.sh +++ b/build.sh @@ -15,11 +15,7 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 export DOTNET_MULTILEVEL_LOOKUP=0 export NUGET_PACKAGES="$SCRIPT_ROOT/packages/" -( - # init-tools.sh isn't compatible with these flags. Unset them in this subshell. - set +euo pipefail - . "$SCRIPT_ROOT/init-tools.sh" -) +. "$SCRIPT_ROOT/init-tools.sh" CLIPATH="$SCRIPT_ROOT/Tools/dotnetcli" SDKPATH="$CLIPATH/sdk/$SDK_VERSION" diff --git a/init-tools.sh b/init-tools.sh index 4f152a5d0d..2b0253408a 100755 --- a/init-tools.sh +++ b/init-tools.sh @@ -6,7 +6,7 @@ __PACKAGES_DIR=$__scriptpath/packages __TOOLRUNTIME_DIR=$__scriptpath/Tools __DOTNET_PATH=$__TOOLRUNTIME_DIR/dotnetcli __DOTNET_CMD=$__DOTNET_PATH/dotnet -if [ -z "$__BUILDTOOLS_SOURCE" ]; then __BUILDTOOLS_SOURCE=https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json; fi +if [ -z "${__BUILDTOOLS_SOURCE:-}" ]; then __BUILDTOOLS_SOURCE=https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json; fi export __BUILDTOOLS_USE_CSPROJ=true __BUILD_TOOLS_PACKAGE_VERSION=$(cat $__scriptpath/BuildToolsVersion.txt) __DOTNET_TOOLS_VERSION=$(cat $__scriptpath/DotnetCLIVersion.txt) @@ -21,7 +21,7 @@ fi if [ -e $__TOOLRUNTIME_DIR ]; then rm -rf -- $__TOOLRUNTIME_DIR; fi -if [ -d "$DotNetBuildToolsDir" ]; then +if [ -d "${DotNetBuildToolsDir:-}" ]; then echo "Using tools from '$DotNetBuildToolsDir'." ln -s "$DotNetBuildToolsDir" "$__TOOLRUNTIME_DIR" @@ -38,7 +38,7 @@ fi echo "Running: $__scriptpath/init-tools.sh" > $__init_tools_log if [ ! -e $__DOTNET_PATH ]; then - if [ -z "$__DOTNET_PKG" ]; then + if [ -z "${__DOTNET_PKG:-}" ]; then if [ "$(uname -m | grep "i[3456]86")" = "i686" ]; then echo "Warning: build not supported on 32 bit Unix" fi From 3d340c10ff5f43a4472697c3fcc6435d73dff8d6 Mon Sep 17 00:00:00 2001 From: Davis Goodin Date: Mon, 16 Oct 2017 18:01:08 -0500 Subject: [PATCH 4/4] Use "source" rather than "." for readability --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 192dd00fd5..0db5c686c3 100755 --- a/build.sh +++ b/build.sh @@ -15,7 +15,7 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 export DOTNET_MULTILEVEL_LOOKUP=0 export NUGET_PACKAGES="$SCRIPT_ROOT/packages/" -. "$SCRIPT_ROOT/init-tools.sh" +source "$SCRIPT_ROOT/init-tools.sh" CLIPATH="$SCRIPT_ROOT/Tools/dotnetcli" SDKPATH="$CLIPATH/sdk/$SDK_VERSION"