Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't download/install if already present on system #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions WebDeploy/WebDeploy.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>webdeploy</id>
<title>Web Deploy</title>
<version>3.5.1</version>
<version>3.5.2</version>
<authors>Microsoft</authors>
<owners>Jason Capriotti</owners>
<summary>Web Deploy 3.5 (July 2013) - The Web Deployment Tool simplifies migration, management and deployment of IIS Web servers, Web applications and Web sites.</summary>
Expand All @@ -13,9 +13,9 @@
<copyright></copyright>
<licenseUrl>http://www.iis.net/downloads/microsoft/web-deploy</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>3.5.1 - Cleaning up package metadata</releaseNotes>
<releaseNotes>3.5.2 - Now detects if already installed via another mechanism before downloading.</releaseNotes>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
</package>
34 changes: 28 additions & 6 deletions WebDeploy/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
$packageName = 'Web Deploy 3.5'
$installerType = 'MSI'
$url = 'http://download.microsoft.com/download/D/4/4/D446D154-2232-49A1-9D64-F5A9429913A4/WebDeploy_x86_en-US.msi'
$url64 = 'http://download.microsoft.com/download/D/4/4/D446D154-2232-49A1-9D64-F5A9429913A4/WebDeploy_amd64_en-US.msi'
$silentArgs = '/qn /passive /norestart ADDLOCAL=ALL'
$validExitCodes = @(0)

Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" "$url64" -validExitCodes $validExitCodes
$alreadyInstalled = $false
$registryTestPath = "hklm:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3"
$minimumVersionLong = "000000000009 000000000000 000000001764 000000000000"

if (Test-Path $registryTestPath)
{
$value = Get-ItemProperty $registryTestPath

# Compare version (convert to long format first so we can do a simple text CompareTo)
[string]$longVersion = $value.Version.Split('.') | %{('0' * (12 - $_.Length)) + $_}
if ($longVersion.CompareTo($minimumVersionLong) -ge 0)
{
$alreadyInstalled = $true
}
}

if(-not $alreadyInstalled) {
$installerType = 'MSI'
$url = 'http://download.microsoft.com/download/D/4/4/D446D154-2232-49A1-9D64-F5A9429913A4/WebDeploy_x86_en-US.msi'
$url64 = 'http://download.microsoft.com/download/D/4/4/D446D154-2232-49A1-9D64-F5A9429913A4/WebDeploy_amd64_en-US.msi'
$silentArgs = '/qn /passive /norestart ADDLOCAL=ALL'
$validExitCodes = @(0)

Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" "$url64" -validExitCodes $validExitCodes
}
else {
Write-Host "Microsoft MSDeploy 3.5 or later is already installed on your machine."
}