Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1630 from dotnet/pawelka/pinned
Browse files Browse the repository at this point in the history
Do not download a pinned version of cli if it is already installed.
  • Loading branch information
moozzyk committed Mar 1, 2016
2 parents 7582649 + 3f43386 commit ab5df03
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions scripts/obtain/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 localVersion=$(tail -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

local remoteVersion=$(IFS="\n" && echo $remoteData | tail -n 1)
local remoteHash=$(IFS="\n" && echo $remoteData | head -n 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)
[ -z $localVersion ] && localVersion='<none>'
local localHash=$(head -n 1 "$installLocation/cli/.version" 2>/dev/null)

say "Latest Version: $remoteVersion"
say "Local Version: $localVersion"
say "Latest Version: $remoteVersion"
say "Local Version: $localVersion"

[ "$remoteHash" = "$localHash" ] && say "${green}You already have the latest version.${normal}" && return 0
[ "$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.
Expand Down

0 comments on commit ab5df03

Please sign in to comment.