Merge pull request #1630 from dotnet/pawelka/pinned

Do not download a pinned version of cli if it is already installed.
This commit is contained in:
Pawel Kadluczka 2016-03-01 08:41:54 -08:00
commit ab5df03700

View file

@ -174,21 +174,25 @@ install_dotnet()
if [ "$RELINK" = "0" ]; then
if [ "$FORCE" = "0" ]; then
# Check if we need to bother
local remoteData="$(curl -s https://dotnetcli.blob.core.windows.net/dotnet/$CHANNEL/dnvm/latest.$os.version)"
[ $? != 0 ] && say_err "Unable to determine latest version." && return 1
local remoteVersion=$(IFS="\n" && echo $remoteData | tail -n 1)
local remoteHash=$(IFS="\n" && echo $remoteData | head -n 1)
local localVersion=$(tail -n 1 "$installLocation/cli/.version" 2>/dev/null)
[ -z $localVersion ] && localVersion='<none>'
local localHash=$(head -n 1 "$installLocation/cli/.version" 2>/dev/null)
if [ "$VERSION" == "Latest" ]; then
# Check if we need to bother
local remoteData="$(curl -s https://dotnetcli.blob.core.windows.net/dotnet/$CHANNEL/dnvm/latest.$os.version)"
[ $? != 0 ] && say_err "Unable to determine latest version." && return 1
say "Latest Version: $remoteVersion"
say "Local Version: $localVersion"
local remoteVersion=$(IFS="\n" && echo $remoteData | tail -n 1)
local remoteHash=$(IFS="\n" && echo $remoteData | head -n 1)
[ "$remoteHash" = "$localHash" ] && say "${green}You already have the latest version.${normal}" && return 0
[ -z $localVersion ] && localVersion='<none>'
local localHash=$(head -n 1 "$installLocation/cli/.version" 2>/dev/null)
say "Latest Version: $remoteVersion"
say "Local Version: $localVersion"
[ "$remoteHash" = "$localHash" ] && say "${green}You already have the latest version.${normal}" && return 0
else
[ "$fileVersion" = "$localVersion" ] && say "${green}You already have the version $fileVersion.${normal}" && return 0
fi
fi
#This should noop if the directory already exists.