diff --git a/cipd b/cipd index 099526bd6..b20afe5b8 100755 --- a/cipd +++ b/cipd @@ -8,6 +8,7 @@ set -e -o pipefail # Export for other depot_tools scripts to re-use. export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "${BASH_SOURCE[0]}")}" +export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}" MYPATH="${DEPOT_TOOLS_DIR}" CYGWIN=false @@ -15,7 +16,7 @@ CYGWIN=false # Make sure this starts empty ARCH= -UNAME=`uname -s | tr '[:upper:]' '[:lower:]'` +UNAME="${DEPOT_TOOLS_UNAME_S}" case "${UNAME}" in aix) OS="${UNAME}" diff --git a/cipd_bin_setup.sh b/cipd_bin_setup.sh index 38ec886aa..a36df7e38 100644 --- a/cipd_bin_setup.sh +++ b/cipd_bin_setup.sh @@ -7,7 +7,7 @@ function cipd_bin_setup { local ENSURE="$MYPATH/cipd_manifest.txt" local ROOT="$MYPATH/.cipd_bin" - UNAME=`uname -s | tr '[:upper:]' '[:lower:]'` + UNAME="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}" case $UNAME in cygwin*) ENSURE="$(cygpath -w $ENSURE)" diff --git a/vpython b/vpython index 08ed05baf..42d112fa7 100755 --- a/vpython +++ b/vpython @@ -37,12 +37,13 @@ fi # Export for other depot_tools scripts to re-use. export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}" +export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}" source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh" cipd_bin_setup &> /dev/null -case $(uname -s) in -MINGW*|CYGWIN*) +case "${DEPOT_TOOLS_UNAME_S}" in +mingw*|cygwin*) cmd.exe //c $0.bat "$@" ;; *) diff --git a/vpython3 b/vpython3 index 307fcbd3b..3f2373dd3 100755 --- a/vpython3 +++ b/vpython3 @@ -35,12 +35,13 @@ fi # Export for other depot_tools scripts to re-use. export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}" +export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}" source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh" cipd_bin_setup &> /dev/null -case $(uname -s) in -MINGW*|CYGWIN*) +case "${DEPOT_TOOLS_UNAME_S}" in +mingw*|cygwin*) cmd.exe //c $0.bat "$@" ;; *)