From 1dcd276b1e42aaa2ee3c45707fca988e902263db Mon Sep 17 00:00:00 2001 From: Shady Ibraheem Date: Fri, 13 Dec 2019 09:48:00 -0500 Subject: [PATCH] Another mop up commit to add missing changes from the last mop-up. --- helpers/CreateAzureVMFromPackerTemplate.ps1 | 144 ++--- helpers/GenerateResourcesAndImage.ps1 | 318 +++++----- .../linux/scripts/helpers/containercache.sh | 4 + .../scripts/installers/1604/azpowershell.sh | 2 +- images/linux/scripts/installers/1604/basic.sh | 2 +- images/linux/scripts/installers/1604/go.sh | 72 +-- .../installers/1604/hosted-tool-cache.sh | 4 +- .../installers/1604/kubernetes-tools.sh | 80 +-- .../scripts/installers/1604/mercurial.sh | 50 +- images/linux/scripts/installers/1604/php.sh | 570 ++++++++---------- .../scripts/installers/1604/powershellcore.sh | 56 +- .../installers/1604/preparemetadata.sh | 24 +- .../linux/scripts/installers/1804/android.sh | 266 ++++---- .../scripts/installers/1804/azpowershell.sh | 2 +- images/linux/scripts/installers/1804/basic.sh | 308 +++++----- .../scripts/installers/1804/dotnetcore-sdk.sh | 1 - images/linux/scripts/installers/1804/go.sh | 68 +-- .../installers/1804/hosted-tool-cache.sh | 4 +- .../installers/1804/kubernetes-tools.sh | 84 +-- .../scripts/installers/1804/mercurial.sh | 42 +- images/linux/scripts/installers/1804/php.sh | 398 ++++++------ .../scripts/installers/1804/powershellcore.sh | 62 +- .../installers/1804/preparemetadata.sh | 24 +- images/linux/scripts/installers/7-zip.sh | 46 +- images/linux/scripts/installers/ansible.sh | 50 +- images/linux/scripts/installers/aws.sh | 52 +- images/linux/scripts/installers/azcopy.sh | 50 +- images/linux/scripts/installers/azure-cli.sh | 52 +- .../scripts/installers/azure-devops-cli.sh | 46 +- images/linux/scripts/installers/boost.sh | 62 +- .../scripts/installers/build-essential.sh | 48 +- images/linux/scripts/installers/clang.sh | 62 +- images/linux/scripts/installers/cmake.sh | 60 +- .../scripts/installers/docker-compose.sh | 52 +- .../linux/scripts/installers/docker-moby.sh | 86 +-- images/linux/scripts/installers/docker.sh | 68 +-- images/linux/scripts/installers/dotnetcore.sh | 29 + images/linux/scripts/installers/erlang.sh | 78 +-- images/linux/scripts/installers/example.sh | 62 +- images/linux/scripts/installers/firefox.sh | 50 +- images/linux/scripts/installers/gcc.sh | 50 +- images/linux/scripts/installers/git.sh | 74 +-- .../linux/scripts/installers/google-chrome.sh | 54 +- .../scripts/installers/google-cloud-sdk.sh | 50 +- images/linux/scripts/installers/haskell.sh | 128 ++-- images/linux/scripts/installers/heroku.sh | 44 +- images/linux/scripts/installers/hhvm.sh | 74 +-- .../linux/scripts/installers/image-magick.sh | 40 +- images/linux/scripts/installers/java-tools.sh | 7 +- images/linux/scripts/installers/kind.sh | 52 +- images/linux/scripts/installers/leiningen.sh | 70 +-- images/linux/scripts/installers/miniconda.sh | 46 +- images/linux/scripts/installers/mono.sh | 58 +- images/linux/scripts/installers/mysql.sh | 86 +-- images/linux/scripts/installers/nodejs.sh | 8 +- images/linux/scripts/installers/phantomjs.sh | 58 +- images/linux/scripts/installers/pollinate.sh | 44 +- images/linux/scripts/installers/python.sh | 134 ++-- images/linux/scripts/installers/ruby.sh | 22 +- images/linux/scripts/installers/rust.sh | 108 ++-- images/linux/scripts/installers/sbt.sh | 1 - images/linux/scripts/installers/sphinx.sh | 30 +- images/linux/scripts/installers/subversion.sh | 44 +- images/linux/scripts/installers/terraform.sh | 52 +- .../scripts/installers/test-toolcache.sh | 140 ++--- images/linux/scripts/installers/vcpkg.sh | 60 +- images/linux/scripts/installers/zeit-now.sh | 44 +- .../scripts/ImageHelpers/InstallHelpers.ps1 | 166 ++--- .../scripts/ImageHelpers/MarkdownHelpers.ps1 | 50 +- .../win/scripts/ImageHelpers/PathHelpers.ps1 | 136 ++--- .../ImageHelpers/test/PathHelpers.Tests.ps1 | 68 +-- .../scripts/Installers/Download-ToolCache.ps1 | 102 ++-- .../Installers/Enable-DeveloperMode.ps1 | 26 +- images/win/scripts/Installers/Finalize-VM.ps1 | 67 +- .../win/scripts/Installers/Install-7zip.ps1 | 12 +- .../scripts/Installers/Install-AzureCli.ps1 | 24 +- .../Install-AzureCosmosDbEmulator.ps1 | 16 +- .../Installers/Install-AzureDevOpsCli.ps1 | 12 +- .../Installers/Install-AzureModules.ps1 | 394 ++++++------ .../win/scripts/Installers/Install-Boost.ps1 | 90 +-- .../win/scripts/Installers/Install-Chrome.ps1 | 52 +- .../Installers/Install-CloudFoundryCli.ps1 | 48 +- .../win/scripts/Installers/Install-Cmake.ps1 | 12 +- .../Installers/Install-ContainersFeature.ps1 | 32 +- .../win/scripts/Installers/Install-DACFx.ps1 | 20 +- .../win/scripts/Installers/Install-Docker.ps1 | 32 +- .../scripts/Installers/Install-DotnetSDK.ps1 | 226 +++---- .../scripts/Installers/Install-Firefox.ps1 | 40 +- images/win/scripts/Installers/Install-Git.ps1 | 36 +- .../scripts/Installers/Install-GitVersion.ps1 | 12 +- images/win/scripts/Installers/Install-Go.ps1 | 142 ++--- .../scripts/Installers/Install-InnoSetup.ps1 | 12 +- .../scripts/Installers/Install-JavaTools.ps1 | 196 +++--- images/win/scripts/Installers/Install-Jq.ps1 | 12 +- .../win/scripts/Installers/Install-Kind.ps1 | 80 +-- .../Installers/Install-KubernetesCli.ps1 | 12 +- .../scripts/Installers/Install-Mercurial.ps1 | 20 +- .../win/scripts/Installers/Install-MinGW.ps1 | 26 +- .../scripts/Installers/Install-Miniconda.ps1 | 32 +- .../scripts/Installers/Install-MysqlCli.ps1 | 78 +-- .../win/scripts/Installers/Install-NET472.ps1 | 13 + .../win/scripts/Installers/Install-NET48.ps1 | 26 +- .../win/scripts/Installers/Install-NSIS.ps1 | 20 +- .../scripts/Installers/Install-NodeLts.ps1 | 67 +- .../scripts/Installers/Install-OpenSSL.ps1 | 12 +- images/win/scripts/Installers/Install-PHP.ps1 | 40 +- .../win/scripts/Installers/Install-Perl.ps1 | 12 +- .../Installers/Install-PowershellCore.ps1 | 12 +- .../win/scripts/Installers/Install-Ruby.ps1 | 40 +- .../win/scripts/Installers/Install-Rust.ps1 | 106 ++-- .../Installers/Install-SQLPowerShellTools.ps1 | 122 ++-- images/win/scripts/Installers/Install-Sbt.ps1 | 1 - .../Installers/Install-SeleniumWebDrivers.ps1 | 34 +- .../Installers/Install-ServiceFabricSDK.ps1 | 26 +- images/win/scripts/Installers/Install-Svn.ps1 | 12 +- .../scripts/Installers/Install-TypeScript.ps1 | 13 +- .../win/scripts/Installers/Install-Vcpkg.ps1 | 42 +- .../Installers/Install-WinAppDriver.ps1 | 16 +- .../Installers/Install-WindowsUpdates.ps1 | 20 +- .../scripts/Installers/Update-AndroidSDK.ps1 | 312 +++++----- .../scripts/Installers/Update-DotnetTLS.ps1 | 36 +- .../win/scripts/Installers/Validate-7zip.ps1 | 50 +- .../scripts/Installers/Validate-AzureCli.ps1 | 56 +- .../Validate-AzureCosmosDbEmulator.ps1 | 94 +-- .../Installers/Validate-AzureDevOpsCli.ps1 | 48 +- .../Installers/Validate-AzureModules.ps1 | 142 ++--- .../win/scripts/Installers/Validate-Boost.ps1 | 150 ++--- .../scripts/Installers/Validate-Chrome.ps1 | 50 +- .../Installers/Validate-CloudFoundryCli.ps1 | 56 +- .../win/scripts/Installers/Validate-Cmake.ps1 | 62 +- .../win/scripts/Installers/Validate-DACFx.ps1 | 66 +- .../scripts/Installers/Validate-Docker.ps1 | 92 +-- .../scripts/Installers/Validate-DotnetSDK.ps1 | 92 +-- .../scripts/Installers/Validate-DotnetTLS.ps1 | 56 +- .../scripts/Installers/Validate-Firefox.ps1 | 50 +- .../win/scripts/Installers/Validate-Git.ps1 | 98 +-- .../Installers/Validate-GitVersion.ps1 | 50 +- images/win/scripts/Installers/Validate-Go.ps1 | 140 ++--- .../scripts/Installers/Validate-InnoSetup.ps1 | 54 +- .../scripts/Installers/Validate-JavaTools.ps1 | 226 +++---- images/win/scripts/Installers/Validate-Jq.ps1 | 46 +- .../win/scripts/Installers/Validate-Kind.ps1 | 56 +- .../Installers/Validate-KubernetesCli.ps1 | 56 +- .../scripts/Installers/Validate-Mercurial.ps1 | 50 +- .../win/scripts/Installers/Validate-MinGW.ps1 | 114 ++-- .../scripts/Installers/Validate-Miniconda.ps1 | 72 +-- .../scripts/Installers/Validate-MysqlCli.ps1 | 54 +- .../scripts/Installers/Validate-NET472.ps1 | 54 +- .../win/scripts/Installers/Validate-NET48.ps1 | 54 +- .../win/scripts/Installers/Validate-NSIS.ps1 | 64 +- .../scripts/Installers/Validate-NodeLts.ps1 | 139 +++-- .../scripts/Installers/Validate-OpenSSL.ps1 | 58 +- .../win/scripts/Installers/Validate-PHP.ps1 | 98 +-- .../win/scripts/Installers/Validate-Perl.ps1 | 46 +- .../Installers/Validate-PowershellCore.ps1 | 56 +- .../scripts/Installers/Validate-Python.ps1 | 90 +-- .../win/scripts/Installers/Validate-Ruby.ps1 | 106 ++-- .../win/scripts/Installers/Validate-Rust.ps1 | 68 +-- .../Validate-SQLPowerShellTools.ps1 | 74 +-- .../win/scripts/Installers/Validate-Sbt.ps1 | 35 +- .../Validate-SeleniumWebDrivers.ps1 | 134 ++-- .../Installers/Validate-ServiceFabricSDK.ps1 | 88 +-- .../win/scripts/Installers/Validate-Svn.ps1 | 56 +- .../scripts/Installers/Validate-ToolCache.ps1 | 188 +++--- .../Installers/Validate-TypeScript.ps1 | 53 +- .../win/scripts/Installers/Validate-Vcpkg.ps1 | 92 +-- .../Installers/Validate-WinAppDriver.ps1 | 90 +-- .../Installers/Windows2016/Initialize-VM.ps1 | 293 +++++---- .../Installers/Windows2016/Install-Python.ps1 | 57 +- .../Installers/Windows2016/Install-SSDT.ps1 | 47 +- .../Installers/Windows2016/Install-VS2017.ps1 | 403 ++++++------- .../Installers/Windows2016/Install-WDK.ps1 | 103 ++-- .../Windows2016/Install-Win81SDK.ps1 | 29 +- .../Installers/Windows2016/Install-Wix.ps1 | 107 ++-- .../Installers/Windows2016/Run-Antivirus.ps1 | 39 +- .../Windows2016/Update-DockerImages.ps1 | 71 ++- .../Installers/Windows2016/Validate-SSDT.ps1 | 101 ++-- .../Installers/Windows2016/Validate-WDK.ps1 | 27 +- .../Installers/Windows2016/Validate-Wix.ps1 | 125 ++-- .../Installers/Windows2019/Initialize-VM.ps1 | 291 +++++---- .../Installers/Windows2019/Install-Python.ps1 | 57 +- .../Installers/Windows2019/Install-VS2019.ps1 | 380 ++++++------ .../Installers/Windows2019/Install-WDK.ps1 | 107 ++-- .../Installers/Windows2019/Install-Wix.ps1 | 107 ++-- .../Installers/Windows2019/Run-Antivirus.ps1 | 55 +- .../Windows2019/Update-DockerImages.ps1 | 73 ++- .../Installers/Windows2019/Validate-WDK.ps1 | 27 +- .../Installers/Windows2019/Validate-Wix.ps1 | 123 ++-- 188 files changed, 7333 insertions(+), 7393 deletions(-) create mode 100644 images/linux/scripts/installers/dotnetcore.sh create mode 100644 images/win/scripts/Installers/Install-NET472.ps1 diff --git a/helpers/CreateAzureVMFromPackerTemplate.ps1 b/helpers/CreateAzureVMFromPackerTemplate.ps1 index 5abd5742d..8c3f1ccb3 100644 --- a/helpers/CreateAzureVMFromPackerTemplate.ps1 +++ b/helpers/CreateAzureVMFromPackerTemplate.ps1 @@ -1,72 +1,72 @@ -Function CreateAzureVMFromPackerTemplate { - <# - .SYNOPSIS - Creates an Azure VM from a template. Also generates network resources in Azure to make the VM accessible. - - .DESCRIPTION - Creates Azure resources and kicks off a packer image generation for the selected image type. - - .PARAMETER SubscriptionId - The Azure subscription Id where resources will be created. - - .PARAMETER ResourceGroupName - The Azure resource group name where the Azure virtual machine will be created. - - .PARAMETER TemplatFilePath - The path for the json template generated by packer during image generation locally. - - .PARAMETER VirtualMachineName - The name of the virtual machine to be generated. - - .PARAMETER AdminUserName - The administrator username for the virtual machine to be created. - - .PARAMETER AdminPassword - The administrator password for the virtual machine to be created. - - .PARAMETER AzureLocation - The location where the Azure virtual machine will be provisioned. Example: "eastus" - - .EXAMPLE - CreateAzureVMFromPackerTemplate -SubscriptionId {YourSubscriptionId} -ResourceGroupName {ResourceGroupName} -TemplateFile "C:\BuildVmImages\temporaryTemplate.json" -VirtualMachineName "testvm1" -AdminUsername "shady1" -AdminPassword "SomeSecurePassword1" -AzureLocation "eastus" - #> - param ( - [Parameter(Mandatory = $True)] - [string] $SubscriptionId, - [Parameter(Mandatory = $True)] - [string] $ResourceGroupName, - [Parameter(Mandatory = $True)] - [string] $TemplateFilePath, - [Parameter(Mandatory = $True)] - [string] $VirtualMachineName, - [Parameter(Mandatory = $True)] - [string] $AdminUsername, - [Parameter(Mandatory = $True)] - [string] $AdminPassword, - [Parameter(Mandatory = $True)] - [string] $AzureLocation - ) - - $vmSize = "Standard_DS2_v2" - $vnetName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() - $subnetName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() - $nicName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() - $publicIpName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() - - Write-Host "Creating a Vnet and a Subnet" - az network vnet create -g $ResourceGroupName -l $AzureLocation --name $vnetName --address-prefix 10.0.0.0/16 --subscription $subscriptionId - az network vnet subnet create -g $ResourceGroupName --vnet-name $vnetName -n $subnetName --address-prefix 10.0.1.0/24 --subscription $subscriptionId - - Write-Host "Creating a network interface card (NIC)." - $nic = az network nic create -g $ResourceGroupName --vnet-name $vnetName --subnet $subnetName -n $nicName --subscription $subscriptionId - $networkId = ($nic | ConvertFrom-Json).NewNIC.id - - Write-Host "create public IP." - az network public-ip create -g $ResourceGroupName -n $publicIpName --subscription $subscriptionId --allocation-method Static --location $AzureLocation --sku Standard --version IPv4 - - Write-Host "Adding the public IP to the NIC." - az network nic ip-config update --name ipconfig1 --nic-name $nicName --resource-group $ResourceGroupName --subscription $subscriptionId --public-ip-address $publicIpName - - Write-Host "Creating the VM" - az group deployment create --resource-group $ResourceGroupName --subscription $subscriptionId --name $VirtualMachineName --template-file $templateFilePath --parameters vmSize=$vmSize vmName=$VirtualMachineName adminUserName=$AdminUsername adminPassword=$AdminPassword networkInterfaceId=$networkId -} +Function CreateAzureVMFromPackerTemplate { + <# + .SYNOPSIS + Creates an Azure VM from a template. Also generates network resources in Azure to make the VM accessible. + + .DESCRIPTION + Creates Azure resources and kicks off a packer image generation for the selected image type. + + .PARAMETER SubscriptionId + The Azure subscription Id where resources will be created. + + .PARAMETER ResourceGroupName + The Azure resource group name where the Azure virtual machine will be created. + + .PARAMETER TemplatFilePath + The path for the json template generated by packer during image generation locally. + + .PARAMETER VirtualMachineName + The name of the virtual machine to be generated. + + .PARAMETER AdminUserName + The administrator username for the virtual machine to be created. + + .PARAMETER AdminPassword + The administrator password for the virtual machine to be created. + + .PARAMETER AzureLocation + The location where the Azure virtual machine will be provisioned. Example: "eastus" + + .EXAMPLE + CreateAzureVMFromPackerTemplate -SubscriptionId {YourSubscriptionId} -ResourceGroupName {ResourceGroupName} -TemplateFile "C:\BuildVmImages\temporaryTemplate.json" -VirtualMachineName "testvm1" -AdminUsername "shady1" -AdminPassword "SomeSecurePassword1" -AzureLocation "eastus" + #> + param ( + [Parameter(Mandatory = $True)] + [string] $SubscriptionId, + [Parameter(Mandatory = $True)] + [string] $ResourceGroupName, + [Parameter(Mandatory = $True)] + [string] $TemplateFilePath, + [Parameter(Mandatory = $True)] + [string] $VirtualMachineName, + [Parameter(Mandatory = $True)] + [string] $AdminUsername, + [Parameter(Mandatory = $True)] + [string] $AdminPassword, + [Parameter(Mandatory = $True)] + [string] $AzureLocation + ) + + $vmSize = "Standard_DS2_v2" + $vnetName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() + $subnetName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() + $nicName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() + $publicIpName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() + + Write-Host "Creating a Vnet and a Subnet" + az network vnet create -g $ResourceGroupName -l $AzureLocation --name $vnetName --address-prefix 10.0.0.0/16 --subscription $subscriptionId + az network vnet subnet create -g $ResourceGroupName --vnet-name $vnetName -n $subnetName --address-prefix 10.0.1.0/24 --subscription $subscriptionId + + Write-Host "Creating a network interface card (NIC)." + $nic = az network nic create -g $ResourceGroupName --vnet-name $vnetName --subnet $subnetName -n $nicName --subscription $subscriptionId + $networkId = ($nic | ConvertFrom-Json).NewNIC.id + + Write-Host "create public IP." + az network public-ip create -g $ResourceGroupName -n $publicIpName --subscription $subscriptionId --allocation-method Static --location $AzureLocation --sku Standard --version IPv4 + + Write-Host "Adding the public IP to the NIC." + az network nic ip-config update --name ipconfig1 --nic-name $nicName --resource-group $ResourceGroupName --subscription $subscriptionId --public-ip-address $publicIpName + + Write-Host "Creating the VM" + az group deployment create --resource-group $ResourceGroupName --subscription $subscriptionId --name $VirtualMachineName --template-file $templateFilePath --parameters vmSize=$vmSize vmName=$VirtualMachineName adminUserName=$AdminUsername adminPassword=$AdminPassword networkInterfaceId=$networkId +} diff --git a/helpers/GenerateResourcesAndImage.ps1 b/helpers/GenerateResourcesAndImage.ps1 index 7a6b406b7..6d328171b 100644 --- a/helpers/GenerateResourcesAndImage.ps1 +++ b/helpers/GenerateResourcesAndImage.ps1 @@ -1,159 +1,159 @@ -$ErrorActionPreference = 'Stop' - -enum ImageType { - Windows2016 = 0 - Windows2019 = 1 - Ubuntu1604 = 2 - Ubuntu1804 = 3 -} - -Function Get-PackerTemplatePath { - param ( - [Parameter(Mandatory = $True)] - [string] $RepositoryRoot, - [Parameter(Mandatory = $True)] - [ImageType] $ImageType - ) - - $relativePath = "N/A" - - switch ($ImageType) { - ([ImageType]::Windows2016) { - $relativePath = "\images\win\Windows2016-Azure.json" - } - ([ImageType]::Windows2019) { - $relativePath = "\images\win\Windows2019-Azure.json" - } - ([ImageType]::Ubuntu1604) { - $relativePath = "\images\linux\ubuntu1604.json" - } - ([ImageType]::Ubuntu1804) { - $relativePath = "\images\linux\ubuntu1804.json" - } - } - - return $RepositoryRoot + $relativePath; -} - -Function GenerateResourcesAndImage { - <# - .SYNOPSIS - A helper function to help generate an image. - - .DESCRIPTION - Creates Azure resources and kicks off a packer image generation for the selected image type. - - .PARAMETER SubscriptionId - The Azure subscription Id where resources will be created. - - .PARAMETER ResourceGroupName - The Azure resource group name where the Azure resources will be created. - - .PARAMETER ImageGenerationRepositoryRoot - The root path of the image generation repository source. - - .PARAMETER ImageType - The type of the image being generated. Valid options are: {"Windows2016", "Windows2019", "Ubuntu1604", "Ubuntu1804"}. - - .PARAMETER AzureLocation - The location of the resources being created in Azure. For example "East US". - - .PARAMETER Force - Delete the resource group if it exists without user confirmation. - - .EXAMPLE - GenerateResourcesAndImage -SubscriptionId {YourSubscriptionId} -ResourceGroupName "shsamytest1" -ImageGenerationRepositoryRoot "C:\azure-pipelines-image-generation" -ImageType Ubuntu1604 -AzureLocation "East US" - #> - param ( - [Parameter(Mandatory = $True)] - [string] $SubscriptionId, - [Parameter(Mandatory = $True)] - [string] $ResourceGroupName, - [Parameter(Mandatory = $True)] - [string] $ImageGenerationRepositoryRoot, - [Parameter(Mandatory = $True)] - [ImageType] $ImageType, - [Parameter(Mandatory = $True)] - [string] $AzureLocation, - [Parameter(Mandatory = $False)] - [int] $SecondsToWaitForServicePrincipalSetup = 30, - [Parameter(Mandatory = $False)] - [Switch] $Force - ) - - $builderScriptPath = Get-PackerTemplatePath -RepositoryRoot $ImageGenerationRepositoryRoot -ImageType $ImageType - $ServicePrincipalClientSecret = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper(); - $InstallPassword = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper(); - - Login-AzureRmAccount - Set-AzureRmContext -SubscriptionId $SubscriptionId - - $alreadyExists = $true; - try { - Get-AzureRmResourceGroup -Name $ResourceGroupName - Write-Verbose "Resource group was found, will delete and recreate it." - } - catch { - Write-Verbose "Resource group was not found, will create it." - $alreadyExists = $false; - } - - if ($alreadyExists) { - if($Force -eq $true) { - # Cleanup the resource group if it already exitsted before - Remove-AzureRmResourceGroup -Name $ResourceGroupName -Force - New-AzureRmResourceGroup -Name $ResourceGroupName -Location $AzureLocation - } else { - $title = "Delete Resource Group" - $message = "The resource group you specified already exists. Do you want to clean it up?" - - $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", ` - "Delete the resource group including all resources." - - $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", ` - "Keep the resource group and continue." - - $stop = New-Object System.Management.Automation.Host.ChoiceDescription "&Stop", ` - "Stop the current action." - - $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no, $stop) - $result = $host.ui.PromptForChoice($title, $message, $options, 0) - - switch ($result) - { - 0 { Remove-AzureRmResourceGroup -Name $ResourceGroupName -Force; New-AzureRmResourceGroup -Name $ResourceGroupName -Location $AzureLocation } - 1 { <# Do nothing #> } - 2 { exit } - } - } - } else { - New-AzureRmResourceGroup -Name $ResourceGroupName -Location $AzureLocation - } - - # This script should follow the recommended naming conventions for azure resources - $storageAccountName = if($ResourceGroupName.EndsWith("-rg")) { - $ResourceGroupName.Substring(0, $ResourceGroupName.Length -3) - } else { $ResourceGroupName } - - # Resource group names may contain special characters, that are not allowed in the storage account name - $storageAccountName = $storageAccountName.Replace("-", "").Replace("_", "").Replace("(", "").Replace(")", "").ToLower() - $storageAccountName += "001" - - New-AzureRmStorageAccount -ResourceGroupName $ResourceGroupName -AccountName $storageAccountName -Location $AzureLocation -SkuName "Standard_LRS" - - $spDisplayName = [System.GUID]::NewGuid().ToString().ToUpper() - $sp = New-AzureRmADServicePrincipal -DisplayName $spDisplayName -Password (ConvertTo-SecureString $ServicePrincipalClientSecret -AsPlainText -Force) - - $spAppId = $sp.ApplicationId - $spClientId = $sp.ApplicationId - $spObjectId = $sp.Id - Start-Sleep -Seconds $SecondsToWaitForServicePrincipalSetup - - New-AzureRmRoleAssignment -RoleDefinitionName Contributor -ServicePrincipalName $spAppId - Start-Sleep -Seconds $SecondsToWaitForServicePrincipalSetup - $sub = Get-AzureRmSubscription -SubscriptionId $SubscriptionId - $tenantId = $sub.TenantId - # "", "Note this variable-setting script for running Packer with these Azure resources in the future:", "==============================================================================================", "`$spClientId = `"$spClientId`"", "`$ServicePrincipalClientSecret = `"$ServicePrincipalClientSecret`"", "`$SubscriptionId = `"$SubscriptionId`"", "`$tenantId = `"$tenantId`"", "`$spObjectId = `"$spObjectId`"", "`$AzureLocation = `"$AzureLocation`"", "`$ResourceGroupName = `"$ResourceGroupName`"", "`$storageAccountName = `"$storageAccountName`"", "`$install_password = `"$install_password`"", "" - - packer.exe build -on-error=ask -var "client_id=$($spClientId)" -var "client_secret=$($ServicePrincipalClientSecret)" -var "subscription_id=$($SubscriptionId)" -var "tenant_id=$($tenantId)" -var "object_id=$($spObjectId)" -var "location=$($AzureLocation)" -var "resource_group=$($ResourceGroupName)" -var "storage_account=$($storageAccountName)" -var "install_password=$($InstallPassword)" $builderScriptPath -} +$ErrorActionPreference = 'Stop' + +enum ImageType { + Windows2016 = 0 + Windows2019 = 1 + Ubuntu1604 = 2 + Ubuntu1804 = 3 +} + +Function Get-PackerTemplatePath { + param ( + [Parameter(Mandatory = $True)] + [string] $RepositoryRoot, + [Parameter(Mandatory = $True)] + [ImageType] $ImageType + ) + + $relativePath = "N/A" + + switch ($ImageType) { + ([ImageType]::Windows2016) { + $relativePath = "\images\win\Windows2016-Azure.json" + } + ([ImageType]::Windows2019) { + $relativePath = "\images\win\Windows2019-Azure.json" + } + ([ImageType]::Ubuntu1604) { + $relativePath = "\images\linux\ubuntu1604.json" + } + ([ImageType]::Ubuntu1804) { + $relativePath = "\images\linux\ubuntu1804.json" + } + } + + return $RepositoryRoot + $relativePath; +} + +Function GenerateResourcesAndImage { + <# + .SYNOPSIS + A helper function to help generate an image. + + .DESCRIPTION + Creates Azure resources and kicks off a packer image generation for the selected image type. + + .PARAMETER SubscriptionId + The Azure subscription Id where resources will be created. + + .PARAMETER ResourceGroupName + The Azure resource group name where the Azure resources will be created. + + .PARAMETER ImageGenerationRepositoryRoot + The root path of the image generation repository source. + + .PARAMETER ImageType + The type of the image being generated. Valid options are: {"Windows2016", "Windows2019", "Ubuntu1604", "Ubuntu1804"}. + + .PARAMETER AzureLocation + The location of the resources being created in Azure. For example "East US". + + .PARAMETER Force + Delete the resource group if it exists without user confirmation. + + .EXAMPLE + GenerateResourcesAndImage -SubscriptionId {YourSubscriptionId} -ResourceGroupName "shsamytest1" -ImageGenerationRepositoryRoot "C:\azure-pipelines-image-generation" -ImageType Ubuntu1604 -AzureLocation "East US" + #> + param ( + [Parameter(Mandatory = $True)] + [string] $SubscriptionId, + [Parameter(Mandatory = $True)] + [string] $ResourceGroupName, + [Parameter(Mandatory = $True)] + [string] $ImageGenerationRepositoryRoot, + [Parameter(Mandatory = $True)] + [ImageType] $ImageType, + [Parameter(Mandatory = $True)] + [string] $AzureLocation, + [Parameter(Mandatory = $False)] + [int] $SecondsToWaitForServicePrincipalSetup = 30, + [Parameter(Mandatory = $False)] + [Switch] $Force + ) + + $builderScriptPath = Get-PackerTemplatePath -RepositoryRoot $ImageGenerationRepositoryRoot -ImageType $ImageType + $ServicePrincipalClientSecret = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper(); + $InstallPassword = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper(); + + Login-AzureRmAccount + Set-AzureRmContext -SubscriptionId $SubscriptionId + + $alreadyExists = $true; + try { + Get-AzureRmResourceGroup -Name $ResourceGroupName + Write-Verbose "Resource group was found, will delete and recreate it." + } + catch { + Write-Verbose "Resource group was not found, will create it." + $alreadyExists = $false; + } + + if ($alreadyExists) { + if($Force -eq $true) { + # Cleanup the resource group if it already exitsted before + Remove-AzureRmResourceGroup -Name $ResourceGroupName -Force + New-AzureRmResourceGroup -Name $ResourceGroupName -Location $AzureLocation + } else { + $title = "Delete Resource Group" + $message = "The resource group you specified already exists. Do you want to clean it up?" + + $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", ` + "Delete the resource group including all resources." + + $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", ` + "Keep the resource group and continue." + + $stop = New-Object System.Management.Automation.Host.ChoiceDescription "&Stop", ` + "Stop the current action." + + $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no, $stop) + $result = $host.ui.PromptForChoice($title, $message, $options, 0) + + switch ($result) + { + 0 { Remove-AzureRmResourceGroup -Name $ResourceGroupName -Force; New-AzureRmResourceGroup -Name $ResourceGroupName -Location $AzureLocation } + 1 { <# Do nothing #> } + 2 { exit } + } + } + } else { + New-AzureRmResourceGroup -Name $ResourceGroupName -Location $AzureLocation + } + + # This script should follow the recommended naming conventions for azure resources + $storageAccountName = if($ResourceGroupName.EndsWith("-rg")) { + $ResourceGroupName.Substring(0, $ResourceGroupName.Length -3) + } else { $ResourceGroupName } + + # Resource group names may contain special characters, that are not allowed in the storage account name + $storageAccountName = $storageAccountName.Replace("-", "").Replace("_", "").Replace("(", "").Replace(")", "").ToLower() + $storageAccountName += "001" + + New-AzureRmStorageAccount -ResourceGroupName $ResourceGroupName -AccountName $storageAccountName -Location $AzureLocation -SkuName "Standard_LRS" + + $spDisplayName = [System.GUID]::NewGuid().ToString().ToUpper() + $sp = New-AzureRmADServicePrincipal -DisplayName $spDisplayName -Password (ConvertTo-SecureString $ServicePrincipalClientSecret -AsPlainText -Force) + + $spAppId = $sp.ApplicationId + $spClientId = $sp.ApplicationId + $spObjectId = $sp.Id + Start-Sleep -Seconds $SecondsToWaitForServicePrincipalSetup + + New-AzureRmRoleAssignment -RoleDefinitionName Contributor -ServicePrincipalName $spAppId + Start-Sleep -Seconds $SecondsToWaitForServicePrincipalSetup + $sub = Get-AzureRmSubscription -SubscriptionId $SubscriptionId + $tenantId = $sub.TenantId + # "", "Note this variable-setting script for running Packer with these Azure resources in the future:", "==============================================================================================", "`$spClientId = `"$spClientId`"", "`$ServicePrincipalClientSecret = `"$ServicePrincipalClientSecret`"", "`$SubscriptionId = `"$SubscriptionId`"", "`$tenantId = `"$tenantId`"", "`$spObjectId = `"$spObjectId`"", "`$AzureLocation = `"$AzureLocation`"", "`$ResourceGroupName = `"$ResourceGroupName`"", "`$storageAccountName = `"$storageAccountName`"", "`$install_password = `"$install_password`"", "" + + packer.exe build -on-error=ask -var "client_id=$($spClientId)" -var "client_secret=$($ServicePrincipalClientSecret)" -var "subscription_id=$($SubscriptionId)" -var "tenant_id=$($tenantId)" -var "object_id=$($spObjectId)" -var "location=$($AzureLocation)" -var "resource_group=$($ResourceGroupName)" -var "storage_account=$($storageAccountName)" -var "install_password=$($InstallPassword)" $builderScriptPath +} diff --git a/images/linux/scripts/helpers/containercache.sh b/images/linux/scripts/helpers/containercache.sh index bdf3a83f6..b4e389a7a 100644 --- a/images/linux/scripts/helpers/containercache.sh +++ b/images/linux/scripts/helpers/containercache.sh @@ -1,4 +1,8 @@ #!/bin/bash +################################################################################ +## File: containercache.sh +## Desc: Prepulls Docker images used in build tasks and templates +################################################################################ source $HELPER_SCRIPTS/apt.sh source $HELPER_SCRIPTS/document.sh diff --git a/images/linux/scripts/installers/1604/azpowershell.sh b/images/linux/scripts/installers/1604/azpowershell.sh index 73d229458..74503d1eb 100644 --- a/images/linux/scripts/installers/1604/azpowershell.sh +++ b/images/linux/scripts/installers/1604/azpowershell.sh @@ -57,4 +57,4 @@ DocumentInstalledItem "Az Module (1.6.0)" DocumentInstalledItem "Az Module (2.3.2)" DocumentInstalledItem "Az Module (2.6.0)" DocumentInstalledItem "Az Module (2.8.0)" -DocumentInstalledItem "Az Module (3.1.0)" \ No newline at end of file +DocumentInstalledItem "Az Module (3.1.0)" diff --git a/images/linux/scripts/installers/1604/basic.sh b/images/linux/scripts/installers/1604/basic.sh index b437f048b..b939cf581 100644 --- a/images/linux/scripts/installers/1604/basic.sh +++ b/images/linux/scripts/installers/1604/basic.sh @@ -85,4 +85,4 @@ DocumentInstalledItemIndent "time" DocumentInstalledItemIndent "unzip" DocumentInstalledItemIndent "wget" DocumentInstalledItemIndent "zip" -DocumentInstalledItemIndent "tzdata" \ No newline at end of file +DocumentInstalledItemIndent "tzdata" diff --git a/images/linux/scripts/installers/1604/go.sh b/images/linux/scripts/installers/1604/go.sh index 69c7afbe8..00aa8274b 100644 --- a/images/linux/scripts/installers/1604/go.sh +++ b/images/linux/scripts/installers/1604/go.sh @@ -1,36 +1,36 @@ -#!/bin/bash -################################################################################ -## File: go.sh -## Desc: Installs go, configures GOROOT, and adds go to the path -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# This function installs Go using the specified arguments: -# $1=MajorVersion (1.11) -# $2=MajorAndMinorVersion (1.11.1) -# $3=IsDefaultVersion (true or false) -function InstallGo () { - curl -sL https://dl.google.com/go/go$2.linux-amd64.tar.gz -o go$2.linux-amd64.tar.gz - mkdir -p /usr/local/go$1 - tar -C /usr/local/go$1 -xzf go$2.linux-amd64.tar.gz --strip-components=1 go - rm go$2.linux-amd64.tar.gz - echo "GOROOT_${1//./_}_X64=/usr/local/go$1" | tee -a /etc/environment - DocumentInstalledItem "Go $1 ($(/usr/local/go$1/bin/go version))" - - # If this version of Go is to be the default version, - # symlink it into the path and point GOROOT to it. - if [ $3 = true ] - then - ln -s /usr/local/go$1/bin/* /usr/bin/ - echo "GOROOT=/usr/local/go$1" | tee -a /etc/environment - fi -} - -# Install Go versions -InstallGo 1.9 1.9.7 false -InstallGo 1.10 1.10.8 false -InstallGo 1.11 1.11.12 false -InstallGo 1.12 1.12.7 true -InstallGo 1.13 1.13 false +#!/bin/bash +################################################################################ +## File: go.sh +## Desc: Installs go, configures GOROOT, and adds go to the path +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# This function installs Go using the specified arguments: +# $1=MajorVersion (1.11) +# $2=MajorAndMinorVersion (1.11.1) +# $3=IsDefaultVersion (true or false) +function InstallGo () { + curl -sL https://dl.google.com/go/go$2.linux-amd64.tar.gz -o go$2.linux-amd64.tar.gz + mkdir -p /usr/local/go$1 + tar -C /usr/local/go$1 -xzf go$2.linux-amd64.tar.gz --strip-components=1 go + rm go$2.linux-amd64.tar.gz + echo "GOROOT_${1//./_}_X64=/usr/local/go$1" | tee -a /etc/environment + DocumentInstalledItem "Go $1 ($(/usr/local/go$1/bin/go version))" + + # If this version of Go is to be the default version, + # symlink it into the path and point GOROOT to it. + if [ $3 = true ] + then + ln -s /usr/local/go$1/bin/* /usr/bin/ + echo "GOROOT=/usr/local/go$1" | tee -a /etc/environment + fi +} + +# Install Go versions +InstallGo 1.9 1.9.7 false +InstallGo 1.10 1.10.8 false +InstallGo 1.11 1.11.12 false +InstallGo 1.12 1.12.7 true +InstallGo 1.13 1.13 false diff --git a/images/linux/scripts/installers/1604/hosted-tool-cache.sh b/images/linux/scripts/installers/1604/hosted-tool-cache.sh index f49cffd66..64030e18d 100644 --- a/images/linux/scripts/installers/1604/hosted-tool-cache.sh +++ b/images/linux/scripts/installers/1604/hosted-tool-cache.sh @@ -27,13 +27,13 @@ for setup in $setups; do cd $original_directory; done; -DocumentInstalledItem "Python (available through the [setup-python](https://github.com/actions/setup-python/blob/master/README.md) task)" +DocumentInstalledItem "Python (available through the [Use Python Version](https://go.microsoft.com/fwlink/?linkid=871498) task)" pythons=$(ls $AGENT_TOOLSDIRECTORY/Python) for python in $pythons; do DocumentInstalledItemIndent "Python $python" done; -DocumentInstalledItem "Ruby (available through the [setup-ruby](https://github.com/actions/setup-ruby/blob/master/README.md) task)" +DocumentInstalledItem "Ruby (available through the [Use Ruby Version](https://go.microsoft.com/fwlink/?linkid=2005989) task)" rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby) for ruby in $rubys; do DocumentInstalledItemIndent "Ruby $ruby" diff --git a/images/linux/scripts/installers/1604/kubernetes-tools.sh b/images/linux/scripts/installers/1604/kubernetes-tools.sh index e4b8fd252..934fe92cd 100644 --- a/images/linux/scripts/installers/1604/kubernetes-tools.sh +++ b/images/linux/scripts/installers/1604/kubernetes-tools.sh @@ -1,40 +1,40 @@ -#!/bin/bash -################################################################################ -## File: kubernetes-tools.sh -## Desc: Installs kubectl, helm -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -## Install kubectl -apt-get install -y apt-transport-https -curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - -touch /etc/apt/sources.list.d/kubernetes.list -echo "deb http://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/kubernetes.list -apt-get update -apt-get install -y kubectl - -# Install Helm -curl -L https://git.io/get_helm.sh | bash - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v kubectl; then - echo "kubectl was not installed" - exit 1 -fi - -if ! command -v helm; then - echo "helm was not installed" - exit 1 -fi - -echo "Initializing helm" -helm init --client-only - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "kubectl ($(kubectl version --short |& head -n 1))" -DocumentInstalledItem "helm ($(helm version --short |& head -n 1))" +#!/bin/bash +################################################################################ +## File: kubernetes-tools.sh +## Desc: Installs kubectl, helm +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +## Install kubectl +apt-get install -y apt-transport-https +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - +touch /etc/apt/sources.list.d/kubernetes.list +echo "deb http://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/kubernetes.list +apt-get update +apt-get install -y kubectl + +# Install Helm +curl -L https://git.io/get_helm.sh | bash + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v kubectl; then + echo "kubectl was not installed" + exit 1 +fi + +if ! command -v helm; then + echo "helm was not installed" + exit 1 +fi + +echo "Initializing helm" +helm init --client-only + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "kubectl ($(kubectl version --short |& head -n 1))" +DocumentInstalledItem "helm ($(helm version --short |& head -n 1))" diff --git a/images/linux/scripts/installers/1604/mercurial.sh b/images/linux/scripts/installers/1604/mercurial.sh index 5c45a95c5..584131fe0 100644 --- a/images/linux/scripts/installers/1604/mercurial.sh +++ b/images/linux/scripts/installers/1604/mercurial.sh @@ -1,25 +1,25 @@ -#!/bin/bash -################################################################################ -## File: mercurial.sh -## Desc: Installs Mercurial -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Install Mercurial from the mercurial-ppa/releases repository for the latest version. -# https://www.mercurial-scm.org/wiki/Download -add-apt-repository ppa:mercurial-ppa/releases -y -apt-get update -apt-get install -y --no-install-recommends mercurial - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v hg; then - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))" +#!/bin/bash +################################################################################ +## File: mercurial.sh +## Desc: Installs Mercurial +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Mercurial from the mercurial-ppa/releases repository for the latest version. +# https://www.mercurial-scm.org/wiki/Download +add-apt-repository ppa:mercurial-ppa/releases -y +apt-get update +apt-get install -y --no-install-recommends mercurial + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v hg; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))" diff --git a/images/linux/scripts/installers/1604/php.sh b/images/linux/scripts/installers/1604/php.sh index fd5961da0..101bc177c 100644 --- a/images/linux/scripts/installers/1604/php.sh +++ b/images/linux/scripts/installers/1604/php.sh @@ -1,302 +1,268 @@ -#!/bin/bash -################################################################################ -## File: php.sh -## Desc: Installs php -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -LSB_RELEASE=$(lsb_release -rs) - -set -e - -apt-add-repository ppa:ondrej/php -y - -# Install php5.6 -apt-get update -apt-fast install -y --no-install-recommends \ - php5.6 \ - php5.6-bcmath \ - php5.6-bz2 \ - php5.6-cgi \ - php5.6-cli \ - php5.6-common \ - php5.6-curl \ - php5.6-dba \ - php5.6-dev \ - php5.6-enchant \ - php5.6-fpm \ - php5.6-gd \ - php5.6-gmp \ - php5.6-imap \ - php5.6-interbase \ - php5.6-intl \ - php5.6-json \ - php5.6-ldap \ - php5.6-mbstring \ - php5.6-mcrypt \ - php5.6-mysql \ - php5.6-odbc \ - php5.6-opcache \ - php5.6-pgsql \ - php5.6-phpdbg \ - php5.6-pspell \ - php5.6-readline \ - php5.6-recode \ - php5.6-snmp \ - php5.6-soap \ - php5.6-sqlite3 \ - php5.6-sybase \ - php5.6-tidy \ - php5.6-xml \ - php5.6-xmlrpc \ - php5.6-xsl \ - php5.6-zip -apt-get remove --purge -yq php5.6-dev - -# Install php7.0 -apt-fast install -y --no-install-recommends \ - php7.0 \ - php7.0-bcmath \ - php7.0-bz2 \ - php7.0-cgi \ - php7.0-cli \ - php7.0-common \ - php7.0-curl \ - php7.0-dba \ - php7.0-dev \ - php7.0-enchant \ - php7.0-fpm \ - php7.0-gd \ - php7.0-gmp \ - php7.0-imap \ - php7.0-interbase \ - php7.0-intl \ - php7.0-json \ - php7.0-ldap \ - php7.0-mbstring \ - php7.0-mcrypt \ - php7.0-mysql \ - php7.0-odbc \ - php7.0-opcache \ - php7.0-pgsql \ - php7.0-phpdbg \ - php7.0-pspell \ - php7.0-readline \ - php7.0-recode \ - php7.0-snmp \ - php7.0-soap \ - php7.0-sqlite3 \ - php7.0-sybase \ - php7.0-tidy \ - php7.0-xml \ - php7.0-xmlrpc \ - php7.0-xsl \ - php7.0-zip -apt-get remove --purge -yq php7.0-dev - -# Install php7.1 -apt-fast install -y --no-install-recommends \ - php7.1 \ - php7.1-bcmath \ - php7.1-bz2 \ - php7.1-cgi \ - php7.1-cli \ - php7.1-common \ - php7.1-curl \ - php7.1-dba \ - php7.1-dev \ - php7.1-enchant \ - php7.1-fpm \ - php7.1-gd \ - php7.1-gmp \ - php7.1-imap \ - php7.1-interbase \ - php7.1-intl \ - php7.1-json \ - php7.1-ldap \ - php7.1-mbstring \ - php7.1-mcrypt \ - php7.1-mysql \ - php7.1-odbc \ - php7.1-opcache \ - php7.1-pgsql \ - php7.1-phpdbg \ - php7.1-pspell \ - php7.1-readline \ - php7.1-recode \ - php7.1-snmp \ - php7.1-soap \ - php7.1-sqlite3 \ - php7.1-sybase \ - php7.1-tidy \ - php7.1-xml \ - php7.1-xmlrpc \ - php7.1-xsl \ - php7.1-zip -apt-get remove --purge -yq php7.1-dev - -# Install php7.2 -apt-fast install -y --no-install-recommends \ - php7.2 \ - php7.2-bcmath \ - php7.2-bz2 \ - php7.2-cgi \ - php7.2-cli \ - php7.2-common \ - php7.2-curl \ - php7.2-dba \ - php7.2-dev \ - php7.2-enchant \ - php7.2-fpm \ - php7.2-gd \ - php7.2-gmp \ - php7.2-imap \ - php7.2-interbase \ - php7.2-intl \ - php7.2-json \ - php7.2-ldap \ - php7.2-mbstring \ - php7.2-mysql \ - php7.2-odbc \ - php7.2-opcache \ - php7.2-pgsql \ - php7.2-phpdbg \ - php7.2-pspell \ - php7.2-readline \ - php7.2-recode \ - php7.2-snmp \ - php7.2-soap \ - php7.2-sqlite3 \ - php7.2-sybase \ - php7.2-tidy \ - php7.2-xml \ - php7.2-xmlrpc \ - php7.2-xsl \ - php7.2-zip - -# Install php7.3 -apt-fast install -y --no-install-recommends \ - php7.3 \ - php7.3-bcmath \ - php7.3-bz2 \ - php7.3-cgi \ - php7.3-cli \ - php7.3-common \ - php7.3-curl \ - php7.3-dba \ - php7.3-dev \ - php7.3-enchant \ - php7.3-fpm \ - php7.3-gd \ - php7.3-gmp \ - php7.3-imap \ - php7.3-interbase \ - php7.3-intl \ - php7.3-json \ - php7.3-ldap \ - php7.3-mbstring \ - php7.3-mysql \ - php7.3-odbc \ - php7.3-opcache \ - php7.3-pgsql \ - php7.3-phpdbg \ - php7.3-pspell \ - php7.3-readline \ - php7.3-recode \ - php7.3-snmp \ - php7.3-soap \ - php7.3-sqlite3 \ - php7.3-sybase \ - php7.3-tidy \ - php7.3-xml \ - php7.3-xmlrpc \ - php7.3-xsl \ - php7.3-zip - -# Install php7.4 -apt-fast install -y --no-install-recommends \ - php7.4 \ - php7.4-bcmath \ - php7.4-bz2 \ - php7.4-cgi \ - php7.4-cli \ - php7.4-common \ - php7.4-curl \ - php7.4-dba \ - php7.4-dev \ - php7.4-enchant \ - php7.4-fpm \ - php7.4-gd \ - php7.4-gmp \ - php7.4-imap \ - php7.4-interbase \ - php7.4-intl \ - php7.4-json \ - php7.4-ldap \ - php7.4-mbstring \ - php7.4-mysql \ - php7.4-odbc \ - php7.4-opcache \ - php7.4-pgsql \ - php7.4-phpdbg \ - php7.4-pspell \ - php7.4-readline \ - php7.4-snmp \ - php7.4-soap \ - php7.4-sqlite3 \ - php7.4-sybase \ - php7.4-tidy \ - php7.4-xml \ - php7.4-xmlrpc \ - php7.4-xsl \ - php7.4-zip - -apt-fast install -y --no-install-recommends \ - php-amqp \ - php-apcu \ - php-igbinary \ - php-memcache \ - php-memcached \ - php-mongodb \ - php-redis \ - php-xdebug \ - php-yaml \ - php-zmq - -apt-get remove --purge -yq php7.2-dev - -apt-fast install -y --no-install-recommends snmp - -# Install composer -php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -php composer-setup.php -sudo mv composer.phar /usr/bin/composer -php -r "unlink('composer-setup.php');" - -# Install phpunit (for PHP) -wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar -chmod +x phpunit -mv phpunit /usr/local/bin/phpunit - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in php php5.6 php7.0 php7.1 php7.2 php7.3 php7.4 composer phpunit; do - if ! command -v $cmd; then - echo "$cmd was not installed" - exit 1 - fi -done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "PHP 5.6 ($(php5.6 --version | head -n 1))" -DocumentInstalledItem "PHP 7.0 ($(php7.0 --version | head -n 1))" -DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))" -DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))" -DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))" -DocumentInstalledItem "PHP 7.4 ($(php7.4 --version | head -n 1))" -DocumentInstalledItem "Composer ($(composer --version))" -DocumentInstalledItem "PHPUnit ($(phpunit --version))" +#!/bin/bash +################################################################################ +## File: php.sh +## Desc: Installs php +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +set -e + +apt-add-repository ppa:ondrej/php -y + +# Install php5.6 +apt-get update +apt-fast install -y --no-install-recommends \ + php5.6 \ + php5.6-amqp \ + php5.6-bcmath \ + php5.6-bz2 \ + php5.6-cgi \ + php5.6-cli \ + php5.6-common \ + php5.6-curl \ + php5.6-dba \ + php5.6-dev \ + php5.6-enchant \ + php5.6-fpm \ + php5.6-gd \ + php5.6-gmp \ + php5.6-imap \ + php5.6-interbase \ + php5.6-intl \ + php5.6-json \ + php5.6-ldap \ + php5.6-mbstring \ + php5.6-mcrypt \ + php5.6-mysql \ + php5.6-odbc \ + php5.6-opcache \ + php5.6-pgsql \ + php5.6-phpdbg \ + php5.6-pspell \ + php5.6-readline \ + php5.6-recode \ + php5.6-snmp \ + php5.6-soap \ + php5.6-sqlite3 \ + php5.6-sybase \ + php5.6-tidy \ + php5.6-xml \ + php5.6-xmlrpc \ + php5.6-xsl \ + php5.6-zip +apt-get remove --purge -yq php5.6-dev + +# Install php7.0 +apt-fast install -y --no-install-recommends \ + php7.0 \ + php7.0-amqp \ + php7.0-bcmath \ + php7.0-bz2 \ + php7.0-cgi \ + php7.0-cli \ + php7.0-common \ + php7.0-curl \ + php7.0-dba \ + php7.0-dev \ + php7.0-enchant \ + php7.0-fpm \ + php7.0-gd \ + php7.0-gmp \ + php7.0-imap \ + php7.0-interbase \ + php7.0-intl \ + php7.0-json \ + php7.0-ldap \ + php7.0-mbstring \ + php7.0-mcrypt \ + php7.0-mysql \ + php7.0-odbc \ + php7.0-opcache \ + php7.0-pgsql \ + php7.0-phpdbg \ + php7.0-pspell \ + php7.0-readline \ + php7.0-recode \ + php7.0-snmp \ + php7.0-soap \ + php7.0-sqlite3 \ + php7.0-sybase \ + php7.0-tidy \ + php7.0-xml \ + php7.0-xmlrpc \ + php7.0-xsl \ + php7.0-zip +apt-get remove --purge -yq php7.0-dev + +# Install php7.1 +apt-fast install -y --no-install-recommends \ + php7.1 \ + php7.1-amqp \ + php7.1-bcmath \ + php7.1-bz2 \ + php7.1-cgi \ + php7.1-cli \ + php7.1-common \ + php7.1-curl \ + php7.1-dba \ + php7.1-dev \ + php7.1-enchant \ + php7.1-fpm \ + php7.1-gd \ + php7.1-gmp \ + php7.1-imap \ + php7.1-interbase \ + php7.1-intl \ + php7.1-json \ + php7.1-ldap \ + php7.1-mbstring \ + php7.1-mcrypt \ + php7.1-mysql \ + php7.1-odbc \ + php7.1-opcache \ + php7.1-pgsql \ + php7.1-phpdbg \ + php7.1-pspell \ + php7.1-readline \ + php7.1-recode \ + php7.1-snmp \ + php7.1-soap \ + php7.1-sqlite3 \ + php7.1-sybase \ + php7.1-tidy \ + php7.1-xml \ + php7.1-xmlrpc \ + php7.1-xsl \ + php7.1-zip +apt-get remove --purge -yq php7.1-dev + +# Install php7.2 +apt-fast install -y --no-install-recommends \ + php7.2 \ + php7.2-apcu \ + php7.2-amqp \ + php7.2-bcmath \ + php7.2-bz2 \ + php7.2-cgi \ + php7.2-cli \ + php7.2-common \ + php7.2-curl \ + php7.2-dba \ + php7.2-dev \ + php7.2-enchant \ + php7.2-fpm \ + php7.2-gd \ + php7.2-gmp \ + php7.2-imap \ + php7.2-interbase \ + php7.2-intl \ + php7.2-json \ + php7.2-ldap \ + php7.2-mbstring \ + php7.2-mysql \ + php7.2-odbc \ + php7.2-opcache \ + php7.2-pgsql \ + php7.2-phpdbg \ + php7.2-pspell \ + php7.2-readline \ + php7.2-recode \ + php7.2-snmp \ + php7.2-soap \ + php7.2-sqlite3 \ + php7.2-sybase \ + php7.2-tidy \ + php7.2-xml \ + php7.2-xmlrpc \ + php7.2-xsl \ + php7.2-zip + +# Install php7.3 +apt-fast install -y --no-install-recommends \ + php7.3 \ + php7.3-apcu \ + php7.3-amqp \ + php7.3-bcmath \ + php7.3-bz2 \ + php7.3-cgi \ + php7.3-cli \ + php7.3-common \ + php7.3-curl \ + php7.3-dba \ + php7.3-dev \ + php7.3-enchant \ + php7.3-fpm \ + php7.3-gd \ + php7.3-gmp \ + php7.3-imap \ + php7.3-interbase \ + php7.3-intl \ + php7.3-json \ + php7.3-ldap \ + php7.3-mbstring \ + php7.3-mysql \ + php7.3-odbc \ + php7.3-opcache \ + php7.3-pgsql \ + php7.3-phpdbg \ + php7.3-pspell \ + php7.3-readline \ + php7.3-recode \ + php7.3-snmp \ + php7.3-soap \ + php7.3-sqlite3 \ + php7.3-sybase \ + php7.3-tidy \ + php7.3-xml \ + php7.3-xmlrpc \ + php7.3-xsl \ + php7.3-zip + +apt-fast install -y --no-install-recommends \ + php-igbinary \ + php-memcache \ + php-memcached \ + php-mongodb \ + php-redis \ + php-xdebug \ + php-yaml \ + php-zmq + +apt-get remove --purge -yq php7.2-dev + +apt-fast install -y --no-install-recommends snmp + +# Install composer +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +php composer-setup.php +sudo mv composer.phar /usr/bin/composer +php -r "unlink('composer-setup.php');" + +# Install phpunit (for PHP) +wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar +chmod +x phpunit +mv phpunit /usr/local/bin/phpunit + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in php php5.6 php7.0 php7.1 php7.2 php7.3 composer phpunit; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "PHP 5.6 ($(php5.6 --version | head -n 1))" +DocumentInstalledItem "PHP 7.0 ($(php7.0 --version | head -n 1))" +DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))" +DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))" +DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))" +DocumentInstalledItem "Composer ($(composer --version))" +DocumentInstalledItem "PHPUnit ($(phpunit --version))" diff --git a/images/linux/scripts/installers/1604/powershellcore.sh b/images/linux/scripts/installers/1604/powershellcore.sh index 8b8278151..8ace4742c 100644 --- a/images/linux/scripts/installers/1604/powershellcore.sh +++ b/images/linux/scripts/installers/1604/powershellcore.sh @@ -1,28 +1,28 @@ -#!/bin/bash -################################################################################ -## File: powershellcore.sh -## Desc: Installs powershellcore -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -LSB_RELEASE=$(lsb_release -rs) - -# Install Powershell -apt-get install -y powershell - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v pwsh; then - echo "pwsh was not installed" - exit 1 -fi -if ! pwsh -c 'Write-Host Hello world'; then - echo "pwsh failed to run" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Powershell ($(pwsh --version))" +#!/bin/bash +################################################################################ +## File: powershellcore.sh +## Desc: Installs powershellcore +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +# Install Powershell +apt-get install -y powershell + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v pwsh; then + echo "pwsh was not installed" + exit 1 +fi +if ! pwsh -c 'Write-Host Hello world'; then + echo "pwsh failed to run" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Powershell ($(pwsh --version))" diff --git a/images/linux/scripts/installers/1604/preparemetadata.sh b/images/linux/scripts/installers/1604/preparemetadata.sh index be102d839..5b4c177e9 100644 --- a/images/linux/scripts/installers/1604/preparemetadata.sh +++ b/images/linux/scripts/installers/1604/preparemetadata.sh @@ -1,12 +1,12 @@ -#!/bin/bash -################################################################################ -## File: preparemetadata.sh -## Desc: This script adds a image title information to the metadata -## document -################################################################################ - -source $HELPER_SCRIPTS/document.sh - -AddTitle "Hosted Ubuntu 1604 Image ($(lsb_release -ds))" -WriteItem "The following software is installed on machines in the Hosted Ubuntu 1604 ($IMAGE_VERSION) pool" -WriteItem "***" +#!/bin/bash +################################################################################ +## File: preparemetadata.sh +## Desc: This script adds a image title information to the metadata +## document +################################################################################ + +source $HELPER_SCRIPTS/document.sh + +AddTitle "Hosted Ubuntu 1604 Image ($(lsb_release -ds))" +WriteItem "The following software is installed on machines in the Hosted Ubuntu 1604 ($IMAGE_VERSION) pool" +WriteItem "***" diff --git a/images/linux/scripts/installers/1804/android.sh b/images/linux/scripts/installers/1804/android.sh index df83a73e0..0c1fcad88 100644 --- a/images/linux/scripts/installers/1804/android.sh +++ b/images/linux/scripts/installers/1804/android.sh @@ -1,133 +1,133 @@ -#!/bin/bash -################################################################################ -## File: android.sh -## Desc: Installs Android SDK -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables) -ANDROID_ROOT=/usr/local/lib/android -ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk -echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" | tee -a /etc/environment - -# ANDROID_HOME is deprecated, but older versions of Gradle rely on it -echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" | tee -a /etc/environment - -# Download the latest command line tools so that we can accept all of the licenses. -# See https://developer.android.com/studio/#command-tools -wget -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -unzip android-sdk.zip -d ${ANDROID_ROOT} -rm -f android-sdk.zip - -# Install the following SDKs and build tools, passing in "y" to accept licenses. -echo "y" | ${ANDROID_ROOT}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} \ - "ndk-bundle" \ - "platform-tools" \ - "platforms;android-29" \ - "platforms;android-28" \ - "platforms;android-27" \ - "platforms;android-26" \ - "platforms;android-25" \ - "platforms;android-24" \ - "platforms;android-23" \ - "platforms;android-22" \ - "platforms;android-21" \ - "platforms;android-19" \ - "platforms;android-17" \ - "build-tools;29.0.2" \ - "build-tools;29.0.0" \ - "build-tools;28.0.3" \ - "build-tools;28.0.2" \ - "build-tools;28.0.1" \ - "build-tools;28.0.0" \ - "build-tools;27.0.3" \ - "build-tools;27.0.2" \ - "build-tools;27.0.1" \ - "build-tools;27.0.0" \ - "build-tools;26.0.3" \ - "build-tools;26.0.2" \ - "build-tools;26.0.1" \ - "build-tools;26.0.0" \ - "build-tools;25.0.3" \ - "build-tools;25.0.2" \ - "build-tools;25.0.1" \ - "build-tools;25.0.0" \ - "build-tools;24.0.3" \ - "build-tools;24.0.2" \ - "build-tools;24.0.1" \ - "build-tools;24.0.0" \ - "build-tools;23.0.3" \ - "build-tools;23.0.2" \ - "build-tools;23.0.1" \ - "build-tools;22.0.1" \ - "build-tools;21.1.2" \ - "build-tools;20.0.0" \ - "build-tools;19.1.0" \ - "build-tools;17.0.0" \ - "extras;android;m2repository" \ - "extras;google;m2repository" \ - "extras;google;google_play_services" \ - "add-ons;addon-google_apis-google-24" \ - "add-ons;addon-google_apis-google-23" \ - "add-ons;addon-google_apis-google-22" \ - "add-ons;addon-google_apis-google-21" \ - "cmake;3.6.4111459" \ - "patcher;v4" - -# Document what was added to the image -echo "Lastly, document what was added to the metadata file" -DocumentInstalledItem "Google Repository $(cat ${ANDROID_SDK_ROOT}/extras/google/m2repository/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" -DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/google/google_play_services/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" -DocumentInstalledItem "Google APIs 24" -DocumentInstalledItem "Google APIs 23" -DocumentInstalledItem "Google APIs 22" -DocumentInstalledItem "Google APIs 21" -DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)" -DocumentInstalledItem "Android Support Repository 47.0.0" -DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" -DocumentInstalledItem "Android SDK Platform 29" -DocumentInstalledItem "Android SDK Platform 28" -DocumentInstalledItem "Android SDK Platform 27" -DocumentInstalledItem "Android SDK Platform 26" -DocumentInstalledItem "Android SDK Platform 25" -DocumentInstalledItem "Android SDK Platform 24" -DocumentInstalledItem "Android SDK Platform 23" -DocumentInstalledItem "Android SDK Platform 22" -DocumentInstalledItem "Android SDK Platform 21" -DocumentInstalledItem "Android SDK Platform 19" -DocumentInstalledItem "Android SDK Platform 17" -DocumentInstalledItem "Android SDK Patch Applier v4" -DocumentInstalledItem "Android SDK Build-Tools 29.0.2" -DocumentInstalledItem "Android SDK Build-Tools 29.0.0" -DocumentInstalledItem "Android SDK Build-Tools 28.0.3" -DocumentInstalledItem "Android SDK Build-Tools 28.0.2" -DocumentInstalledItem "Android SDK Build-Tools 28.0.1" -DocumentInstalledItem "Android SDK Build-Tools 28.0.0" -DocumentInstalledItem "Android SDK Build-Tools 27.0.3" -DocumentInstalledItem "Android SDK Build-Tools 27.0.2" -DocumentInstalledItem "Android SDK Build-Tools 27.0.1" -DocumentInstalledItem "Android SDK Build-Tools 27.0.0" -DocumentInstalledItem "Android SDK Build-Tools 26.0.3" -DocumentInstalledItem "Android SDK Build-Tools 26.0.2" -DocumentInstalledItem "Android SDK Build-Tools 26.0.1" -DocumentInstalledItem "Android SDK Build-Tools 26.0.0" -DocumentInstalledItem "Android SDK Build-Tools 25.0.3" -DocumentInstalledItem "Android SDK Build-Tools 25.0.2" -DocumentInstalledItem "Android SDK Build-Tools 25.0.1" -DocumentInstalledItem "Android SDK Build-Tools 25.0.0" -DocumentInstalledItem "Android SDK Build-Tools 24.0.3" -DocumentInstalledItem "Android SDK Build-Tools 24.0.2" -DocumentInstalledItem "Android SDK Build-Tools 24.0.1" -DocumentInstalledItem "Android SDK Build-Tools 24.0.0" -DocumentInstalledItem "Android SDK Build-Tools 23.0.3" -DocumentInstalledItem "Android SDK Build-Tools 23.0.2" -DocumentInstalledItem "Android SDK Build-Tools 23.0.1" -DocumentInstalledItem "Android SDK Build-Tools 22.0.1" -DocumentInstalledItem "Android SDK Build-Tools 21.1.2" -DocumentInstalledItem "Android SDK Build-Tools 20.0.0" -DocumentInstalledItem "Android SDK Build-Tools 19.1.0" -DocumentInstalledItem "Android SDK Build-Tools 17.0.0" -DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)" +#!/bin/bash +################################################################################ +## File: android.sh +## Desc: Installs Android SDK +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables) +ANDROID_ROOT=/usr/local/lib/android +ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk +echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" | tee -a /etc/environment + +# ANDROID_HOME is deprecated, but older versions of Gradle rely on it +echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" | tee -a /etc/environment + +# Download the latest command line tools so that we can accept all of the licenses. +# See https://developer.android.com/studio/#command-tools +wget -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip +unzip android-sdk.zip -d ${ANDROID_ROOT} +rm -f android-sdk.zip + +# Install the following SDKs and build tools, passing in "y" to accept licenses. +echo "y" | ${ANDROID_ROOT}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} \ + "ndk-bundle" \ + "platform-tools" \ + "platforms;android-29" \ + "platforms;android-28" \ + "platforms;android-27" \ + "platforms;android-26" \ + "platforms;android-25" \ + "platforms;android-24" \ + "platforms;android-23" \ + "platforms;android-22" \ + "platforms;android-21" \ + "platforms;android-19" \ + "platforms;android-17" \ + "build-tools;29.0.2" \ + "build-tools;29.0.0" \ + "build-tools;28.0.3" \ + "build-tools;28.0.2" \ + "build-tools;28.0.1" \ + "build-tools;28.0.0" \ + "build-tools;27.0.3" \ + "build-tools;27.0.2" \ + "build-tools;27.0.1" \ + "build-tools;27.0.0" \ + "build-tools;26.0.3" \ + "build-tools;26.0.2" \ + "build-tools;26.0.1" \ + "build-tools;26.0.0" \ + "build-tools;25.0.3" \ + "build-tools;25.0.2" \ + "build-tools;25.0.1" \ + "build-tools;25.0.0" \ + "build-tools;24.0.3" \ + "build-tools;24.0.2" \ + "build-tools;24.0.1" \ + "build-tools;24.0.0" \ + "build-tools;23.0.3" \ + "build-tools;23.0.2" \ + "build-tools;23.0.1" \ + "build-tools;22.0.1" \ + "build-tools;21.1.2" \ + "build-tools;20.0.0" \ + "build-tools;19.1.0" \ + "build-tools;17.0.0" \ + "extras;android;m2repository" \ + "extras;google;m2repository" \ + "extras;google;google_play_services" \ + "add-ons;addon-google_apis-google-24" \ + "add-ons;addon-google_apis-google-23" \ + "add-ons;addon-google_apis-google-22" \ + "add-ons;addon-google_apis-google-21" \ + "cmake;3.6.4111459" \ + "patcher;v4" + +# Document what was added to the image +echo "Lastly, document what was added to the metadata file" +DocumentInstalledItem "Google Repository $(cat ${ANDROID_SDK_ROOT}/extras/google/m2repository/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/google/google_play_services/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Google APIs 24" +DocumentInstalledItem "Google APIs 23" +DocumentInstalledItem "Google APIs 22" +DocumentInstalledItem "Google APIs 21" +DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)" +DocumentInstalledItem "Android Support Repository 47.0.0" +DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Android SDK Platform 29" +DocumentInstalledItem "Android SDK Platform 28" +DocumentInstalledItem "Android SDK Platform 27" +DocumentInstalledItem "Android SDK Platform 26" +DocumentInstalledItem "Android SDK Platform 25" +DocumentInstalledItem "Android SDK Platform 24" +DocumentInstalledItem "Android SDK Platform 23" +DocumentInstalledItem "Android SDK Platform 22" +DocumentInstalledItem "Android SDK Platform 21" +DocumentInstalledItem "Android SDK Platform 19" +DocumentInstalledItem "Android SDK Platform 17" +DocumentInstalledItem "Android SDK Patch Applier v4" +DocumentInstalledItem "Android SDK Build-Tools 29.0.2" +DocumentInstalledItem "Android SDK Build-Tools 29.0.0" +DocumentInstalledItem "Android SDK Build-Tools 28.0.3" +DocumentInstalledItem "Android SDK Build-Tools 28.0.2" +DocumentInstalledItem "Android SDK Build-Tools 28.0.1" +DocumentInstalledItem "Android SDK Build-Tools 28.0.0" +DocumentInstalledItem "Android SDK Build-Tools 27.0.3" +DocumentInstalledItem "Android SDK Build-Tools 27.0.2" +DocumentInstalledItem "Android SDK Build-Tools 27.0.1" +DocumentInstalledItem "Android SDK Build-Tools 27.0.0" +DocumentInstalledItem "Android SDK Build-Tools 26.0.3" +DocumentInstalledItem "Android SDK Build-Tools 26.0.2" +DocumentInstalledItem "Android SDK Build-Tools 26.0.1" +DocumentInstalledItem "Android SDK Build-Tools 26.0.0" +DocumentInstalledItem "Android SDK Build-Tools 25.0.3" +DocumentInstalledItem "Android SDK Build-Tools 25.0.2" +DocumentInstalledItem "Android SDK Build-Tools 25.0.1" +DocumentInstalledItem "Android SDK Build-Tools 25.0.0" +DocumentInstalledItem "Android SDK Build-Tools 24.0.3" +DocumentInstalledItem "Android SDK Build-Tools 24.0.2" +DocumentInstalledItem "Android SDK Build-Tools 24.0.1" +DocumentInstalledItem "Android SDK Build-Tools 24.0.0" +DocumentInstalledItem "Android SDK Build-Tools 23.0.3" +DocumentInstalledItem "Android SDK Build-Tools 23.0.2" +DocumentInstalledItem "Android SDK Build-Tools 23.0.1" +DocumentInstalledItem "Android SDK Build-Tools 22.0.1" +DocumentInstalledItem "Android SDK Build-Tools 21.1.2" +DocumentInstalledItem "Android SDK Build-Tools 20.0.0" +DocumentInstalledItem "Android SDK Build-Tools 19.1.0" +DocumentInstalledItem "Android SDK Build-Tools 17.0.0" +DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)" diff --git a/images/linux/scripts/installers/1804/azpowershell.sh b/images/linux/scripts/installers/1804/azpowershell.sh index 73d229458..74503d1eb 100644 --- a/images/linux/scripts/installers/1804/azpowershell.sh +++ b/images/linux/scripts/installers/1804/azpowershell.sh @@ -57,4 +57,4 @@ DocumentInstalledItem "Az Module (1.6.0)" DocumentInstalledItem "Az Module (2.3.2)" DocumentInstalledItem "Az Module (2.6.0)" DocumentInstalledItem "Az Module (2.8.0)" -DocumentInstalledItem "Az Module (3.1.0)" \ No newline at end of file +DocumentInstalledItem "Az Module (3.1.0)" diff --git a/images/linux/scripts/installers/1804/basic.sh b/images/linux/scripts/installers/1804/basic.sh index baf3eea45..fdb2ec572 100644 --- a/images/linux/scripts/installers/1804/basic.sh +++ b/images/linux/scripts/installers/1804/basic.sh @@ -1,154 +1,154 @@ -#!/bin/bash -################################################################################ -## File: basic.sh -## Desc: Installs basic command line utilities and dev packages -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -set -e - -echo "Install curl" -apt-get install -y --no-install-recommends curl - -echo "Install dnsutils" -apt-get install -y --no-install-recommends dnsutils - -echo "Install file" -apt-get install -y --no-install-recommends file - -echo "Install ftp" -apt-get install -y --no-install-recommends ftp - -echo "Install iproute2" -apt-get install -y --no-install-recommends iproute2 - -echo "Install iputils-ping" -apt-get install -y --no-install-recommends iputils-ping - -echo "Install jq" -apt-get install -y --no-install-recommends jq - -echo "Install libcurl3" -apt-get install -y --no-install-recommends libcurl3 - -echo "Install libunwind8" -apt-get install -y --no-install-recommends libunwind8 - -echo "Install locales" -apt-get install -y --no-install-recommends locales - -echo "Install netcat" -apt-get install -y --no-install-recommends netcat - -echo "Install openssh-client" -apt-get install -y --no-install-recommends openssh-client - -echo "Install rsync" -apt-get install -y --no-install-recommends rsync - -echo "Install shellcheck" -apt-get install -y --no-install-recommends shellcheck - -echo "Install sudo" -apt-get install -y --no-install-recommends sudo - -echo "Install telnet" -apt-get install -y --no-install-recommends telnet - -echo "Install time" -apt-get install -y --no-install-recommends time - -echo "Install unzip" -apt-get install -y --no-install-recommends unzip - -echo "Install wget" -apt-get install -y --no-install-recommends wget - -echo "Install zip" -apt-get install -y --no-install-recommends zip - -echo "Install tzdata" -apt-get install -y --no-install-recommends tzdata - -echo "Install libxkbfile" -apt-get install -y --no-install-recommends libxkbfile-dev - -echo "Install pkg-config" -apt-get install -y --no-install-recommends pkg-config - -echo "Install libsecret-1-dev" -apt-get install -y --no-install-recommends libsecret-1-dev - -echo "Install libxss1" -apt-get install -y --no-install-recommends libxss1 - -echo "Install libgconf-2-4" -apt-get install -y --no-install-recommends libgconf-2-4 - -echo "Install dbus" -apt-get install -y --no-install-recommends dbus - -echo "Install xvfb" -apt-get install -y --no-install-recommends xvfb - -echo "Install libgtk" -apt-get install -y --no-install-recommends libgtk-3-0 - -echo "Install fakeroot" -apt-get install -y --no-install-recommends fakeroot - -echo "Install dpkg" -apt-get install -y --no-install-recommends dpkg - -echo "Install rpm" -apt-get install -y --no-install-recommends rpm - -echo "Install xz-utils" -apt-get install -y --no-install-recommends xz-utils - -echo "Install xorriso" -apt-get install -y --no-install-recommends xorriso - -echo "Install zsync" -apt-get install -y --no-install-recommends zsync - -echo "Install curl" -apt-get install -y --no-install-recommends curl - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in curl file ftp jq netcat ssh rsync shellcheck sudo telnet time unzip wget zip; do - if ! command -v $cmd; then - echo "$cmd was not installed" - exit 1 - fi -done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Basic CLI:" -DocumentInstalledItemIndent "curl" -DocumentInstalledItemIndent "dnsutils" -DocumentInstalledItemIndent "file" -DocumentInstalledItemIndent "ftp" -DocumentInstalledItemIndent "iproute2" -DocumentInstalledItemIndent "iputils-ping" -DocumentInstalledItemIndent "jq" -DocumentInstalledItemIndent "libcurl3" -DocumentInstalledItemIndent "libicu55" -DocumentInstalledItemIndent "libunwind8" -DocumentInstalledItemIndent "locales" -DocumentInstalledItemIndent "netcat" -DocumentInstalledItemIndent "openssh-client" -DocumentInstalledItemIndent "rsync" -DocumentInstalledItemIndent "shellcheck" -DocumentInstalledItemIndent "sudo" -DocumentInstalledItemIndent "telnet" -DocumentInstalledItemIndent "time" -DocumentInstalledItemIndent "unzip" -DocumentInstalledItemIndent "wget" -DocumentInstalledItemIndent "zip" -DocumentInstalledItemIndent "tzdata" +#!/bin/bash +################################################################################ +## File: basic.sh +## Desc: Installs basic command line utilities and dev packages +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +set -e + +echo "Install curl" +apt-get install -y --no-install-recommends curl + +echo "Install dnsutils" +apt-get install -y --no-install-recommends dnsutils + +echo "Install file" +apt-get install -y --no-install-recommends file + +echo "Install ftp" +apt-get install -y --no-install-recommends ftp + +echo "Install iproute2" +apt-get install -y --no-install-recommends iproute2 + +echo "Install iputils-ping" +apt-get install -y --no-install-recommends iputils-ping + +echo "Install jq" +apt-get install -y --no-install-recommends jq + +echo "Install libcurl3" +apt-get install -y --no-install-recommends libcurl3 + +echo "Install libunwind8" +apt-get install -y --no-install-recommends libunwind8 + +echo "Install locales" +apt-get install -y --no-install-recommends locales + +echo "Install netcat" +apt-get install -y --no-install-recommends netcat + +echo "Install openssh-client" +apt-get install -y --no-install-recommends openssh-client + +echo "Install rsync" +apt-get install -y --no-install-recommends rsync + +echo "Install shellcheck" +apt-get install -y --no-install-recommends shellcheck + +echo "Install sudo" +apt-get install -y --no-install-recommends sudo + +echo "Install telnet" +apt-get install -y --no-install-recommends telnet + +echo "Install time" +apt-get install -y --no-install-recommends time + +echo "Install unzip" +apt-get install -y --no-install-recommends unzip + +echo "Install wget" +apt-get install -y --no-install-recommends wget + +echo "Install zip" +apt-get install -y --no-install-recommends zip + +echo "Install tzdata" +apt-get install -y --no-install-recommends tzdata + +echo "Install libxkbfile" +apt-get install -y --no-install-recommends libxkbfile-dev + +echo "Install pkg-config" +apt-get install -y --no-install-recommends pkg-config + +echo "Install libsecret-1-dev" +apt-get install -y --no-install-recommends libsecret-1-dev + +echo "Install libxss1" +apt-get install -y --no-install-recommends libxss1 + +echo "Install libgconf-2-4" +apt-get install -y --no-install-recommends libgconf-2-4 + +echo "Install dbus" +apt-get install -y --no-install-recommends dbus + +echo "Install xvfb" +apt-get install -y --no-install-recommends xvfb + +echo "Install libgtk" +apt-get install -y --no-install-recommends libgtk-3-0 + +echo "Install fakeroot" +apt-get install -y --no-install-recommends fakeroot + +echo "Install dpkg" +apt-get install -y --no-install-recommends dpkg + +echo "Install rpm" +apt-get install -y --no-install-recommends rpm + +echo "Install xz-utils" +apt-get install -y --no-install-recommends xz-utils + +echo "Install xorriso" +apt-get install -y --no-install-recommends xorriso + +echo "Install zsync" +apt-get install -y --no-install-recommends zsync + +echo "Install curl" +apt-get install -y --no-install-recommends curl + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in curl file ftp jq netcat ssh rsync shellcheck sudo telnet time unzip wget zip; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Basic CLI:" +DocumentInstalledItemIndent "curl" +DocumentInstalledItemIndent "dnsutils" +DocumentInstalledItemIndent "file" +DocumentInstalledItemIndent "ftp" +DocumentInstalledItemIndent "iproute2" +DocumentInstalledItemIndent "iputils-ping" +DocumentInstalledItemIndent "jq" +DocumentInstalledItemIndent "libcurl3" +DocumentInstalledItemIndent "libicu55" +DocumentInstalledItemIndent "libunwind8" +DocumentInstalledItemIndent "locales" +DocumentInstalledItemIndent "netcat" +DocumentInstalledItemIndent "openssh-client" +DocumentInstalledItemIndent "rsync" +DocumentInstalledItemIndent "shellcheck" +DocumentInstalledItemIndent "sudo" +DocumentInstalledItemIndent "telnet" +DocumentInstalledItemIndent "time" +DocumentInstalledItemIndent "unzip" +DocumentInstalledItemIndent "wget" +DocumentInstalledItemIndent "zip" +DocumentInstalledItemIndent "tzdata" diff --git a/images/linux/scripts/installers/1804/dotnetcore-sdk.sh b/images/linux/scripts/installers/1804/dotnetcore-sdk.sh index f779ff5ca..16f65edf7 100644 --- a/images/linux/scripts/installers/1804/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/1804/dotnetcore-sdk.sh @@ -1,7 +1,6 @@ #!/bin/bash ################################################################################ ## File: dotnetcore-sdk.sh -## Team: CI-Platform ## Desc: Installs .NET Core SDK ################################################################################ diff --git a/images/linux/scripts/installers/1804/go.sh b/images/linux/scripts/installers/1804/go.sh index 2b1dde0be..6109faf2a 100644 --- a/images/linux/scripts/installers/1804/go.sh +++ b/images/linux/scripts/installers/1804/go.sh @@ -1,34 +1,34 @@ -#!/bin/bash -################################################################################ -## File: go.sh -## Desc: Installs go, configures GOROOT, and adds go to the path -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# This function installs Go using the specified arguments: -# $1=MajorVersion (1.11) -# $2=MajorAndMinorVersion (1.11.1) -# $3=IsDefaultVersion (true or false) -function InstallGo () { - curl -sL https://dl.google.com/go/go$2.linux-amd64.tar.gz -o go$2.linux-amd64.tar.gz - mkdir -p /usr/local/go$1 - tar -C /usr/local/go$1 -xzf go$2.linux-amd64.tar.gz --strip-components=1 go - rm go$2.linux-amd64.tar.gz - echo "GOROOT_${1//./_}_X64=/usr/local/go$1" | tee -a /etc/environment - DocumentInstalledItem "Go $1 ($(/usr/local/go$1/bin/go version))" - - # If this version of Go is to be the default version, - # symlink it into the path and point GOROOT to it. - if [ $3 = true ] - then - ln -s /usr/local/go$1/bin/* /usr/bin/ - echo "GOROOT=/usr/local/go$1" | tee -a /etc/environment - fi -} - -# Install Go versions -InstallGo 1.11 1.11.12 false -InstallGo 1.12 1.12.7 true -InstallGo 1.13 1.13 false +#!/bin/bash +################################################################################ +## File: go.sh +## Desc: Installs go, configures GOROOT, and adds go to the path +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# This function installs Go using the specified arguments: +# $1=MajorVersion (1.11) +# $2=MajorAndMinorVersion (1.11.1) +# $3=IsDefaultVersion (true or false) +function InstallGo () { + curl -sL https://dl.google.com/go/go$2.linux-amd64.tar.gz -o go$2.linux-amd64.tar.gz + mkdir -p /usr/local/go$1 + tar -C /usr/local/go$1 -xzf go$2.linux-amd64.tar.gz --strip-components=1 go + rm go$2.linux-amd64.tar.gz + echo "GOROOT_${1//./_}_X64=/usr/local/go$1" | tee -a /etc/environment + DocumentInstalledItem "Go $1 ($(/usr/local/go$1/bin/go version))" + + # If this version of Go is to be the default version, + # symlink it into the path and point GOROOT to it. + if [ $3 = true ] + then + ln -s /usr/local/go$1/bin/* /usr/bin/ + echo "GOROOT=/usr/local/go$1" | tee -a /etc/environment + fi +} + +# Install Go versions +InstallGo 1.11 1.11.12 false +InstallGo 1.12 1.12.7 true +InstallGo 1.13 1.13 false diff --git a/images/linux/scripts/installers/1804/hosted-tool-cache.sh b/images/linux/scripts/installers/1804/hosted-tool-cache.sh index 0fb87013a..c4f159e96 100644 --- a/images/linux/scripts/installers/1804/hosted-tool-cache.sh +++ b/images/linux/scripts/installers/1804/hosted-tool-cache.sh @@ -27,13 +27,13 @@ for setup in $setups; do cd $original_directory; done; -DocumentInstalledItem "Python (available through the [setup-python](https://github.com/actions/setup-python/blob/master/README.md) task)" +DocumentInstalledItem "Python (available through the [Use Python Version](https://go.microsoft.com/fwlink/?linkid=871498) task)" pythons=$(ls $AGENT_TOOLSDIRECTORY/Python) for python in $pythons; do DocumentInstalledItemIndent "Python $python" done; -DocumentInstalledItem "Ruby (available through the [setup-ruby](https://github.com/actions/setup-ruby/blob/master/README.md) task)" +DocumentInstalledItem "Ruby (available through the [Use Ruby Version](https://go.microsoft.com/fwlink/?linkid=2005989) task)" rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby) for ruby in $rubys; do DocumentInstalledItemIndent "Ruby $ruby" diff --git a/images/linux/scripts/installers/1804/kubernetes-tools.sh b/images/linux/scripts/installers/1804/kubernetes-tools.sh index dbc5c9d4a..b0a6f43f6 100644 --- a/images/linux/scripts/installers/1804/kubernetes-tools.sh +++ b/images/linux/scripts/installers/1804/kubernetes-tools.sh @@ -1,42 +1,42 @@ -#!/bin/bash -################################################################################ -## File: kubernetes-tools.sh -## Desc: Installs kubectl, helm -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -## Install kubectl -apt-get install -y apt-transport-https -curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - -touch /etc/apt/sources.list.d/kubernetes.list - -# Based on https://kubernetes.io/docs/tasks/tools/install-kubectl/, package is still called xenial -echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list -apt-get update -apt-get install -y kubectl - -# Install Helm -curl -L https://git.io/get_helm.sh | bash - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v kubectl; then - echo "kubectl was not installed" - exit 1 -fi - -if ! command -v helm; then - echo "helm was not installed" - exit 1 -fi - -echo "Initializing helm" -helm init --client-only - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "kubectl ($(kubectl version --short |& head -n 1))" -DocumentInstalledItem "helm ($(helm version --short |& head -n 1))" +#!/bin/bash +################################################################################ +## File: kubernetes-tools.sh +## Desc: Installs kubectl, helm +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +## Install kubectl +apt-get install -y apt-transport-https +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - +touch /etc/apt/sources.list.d/kubernetes.list + +# Based on https://kubernetes.io/docs/tasks/tools/install-kubectl/, package is still called xenial +echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list +apt-get update +apt-get install -y kubectl + +# Install Helm +curl -L https://git.io/get_helm.sh | bash + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v kubectl; then + echo "kubectl was not installed" + exit 1 +fi + +if ! command -v helm; then + echo "helm was not installed" + exit 1 +fi + +echo "Initializing helm" +helm init --client-only + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "kubectl ($(kubectl version --short |& head -n 1))" +DocumentInstalledItem "helm ($(helm version --short |& head -n 1))" diff --git a/images/linux/scripts/installers/1804/mercurial.sh b/images/linux/scripts/installers/1804/mercurial.sh index a7c048d78..abd9cdb0d 100644 --- a/images/linux/scripts/installers/1804/mercurial.sh +++ b/images/linux/scripts/installers/1804/mercurial.sh @@ -1,21 +1,21 @@ -#!/bin/bash -################################################################################ -## File: mercurial.sh -## Desc: Installs Mercurial -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -apt-get install -y --no-install-recommends mercurial - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v hg; then - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))" +#!/bin/bash +################################################################################ +## File: mercurial.sh +## Desc: Installs Mercurial +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +apt-get install -y --no-install-recommends mercurial + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v hg; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))" diff --git a/images/linux/scripts/installers/1804/php.sh b/images/linux/scripts/installers/1804/php.sh index c6ef6c6ec..7bdcde14f 100644 --- a/images/linux/scripts/installers/1804/php.sh +++ b/images/linux/scripts/installers/1804/php.sh @@ -1,217 +1,181 @@ -#!/bin/bash -################################################################################ -## File: php.sh -## Desc: Installs php -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -LSB_RELEASE=$(lsb_release -rs) - -set -e - -apt-add-repository ppa:ondrej/php -y - -# Install php7.1 -apt-fast install -y --no-install-recommends \ - php7.1 \ - php7.1-bcmath \ - php7.1-bz2 \ - php7.1-cgi \ - php7.1-cli \ - php7.1-common \ - php7.1-curl \ - php7.1-dba \ - php7.1-dev \ - php7.1-enchant \ - php7.1-fpm \ - php7.1-gd \ - php7.1-gmp \ - php7.1-imap \ - php7.1-interbase \ - php7.1-intl \ - php7.1-json \ - php7.1-ldap \ - php7.1-mbstring \ - php7.1-mcrypt \ - php7.1-mysql \ - php7.1-odbc \ - php7.1-opcache \ - php7.1-pgsql \ - php7.1-phpdbg \ - php7.1-pspell \ - php7.1-readline \ - php7.1-recode \ - php7.1-snmp \ - php7.1-soap \ - php7.1-sqlite3 \ - php7.1-sybase \ - php7.1-tidy \ - php7.1-xml \ - php7.1-xmlrpc \ - php7.1-xsl \ - php7.1-zip -apt-get remove --purge -yq php7.1-dev - -# Install php7.2 -apt-fast install -y --no-install-recommends \ - php7.2 \ - php7.2-bcmath \ - php7.2-bz2 \ - php7.2-cgi \ - php7.2-cli \ - php7.2-common \ - php7.2-curl \ - php7.2-dba \ - php7.2-dev \ - php7.2-enchant \ - php7.2-fpm \ - php7.2-gd \ - php7.2-gmp \ - php7.2-imap \ - php7.2-interbase \ - php7.2-intl \ - php7.2-json \ - php7.2-ldap \ - php7.2-mbstring \ - php7.2-mysql \ - php7.2-odbc \ - php7.2-opcache \ - php7.2-pgsql \ - php7.2-phpdbg \ - php7.2-pspell \ - php7.2-readline \ - php7.2-recode \ - php7.2-snmp \ - php7.2-soap \ - php7.2-sqlite3 \ - php7.2-sybase \ - php7.2-tidy \ - php7.2-xml \ - php7.2-xmlrpc \ - php7.2-xsl \ - php7.2-zip - -# Install php7.3 -apt-fast install -y --no-install-recommends \ - php7.3 \ - php7.3-bcmath \ - php7.3-bz2 \ - php7.3-cgi \ - php7.3-cli \ - php7.3-common \ - php7.3-curl \ - php7.3-dba \ - php7.3-dev \ - php7.3-enchant \ - php7.3-fpm \ - php7.3-gd \ - php7.3-gmp \ - php7.3-imap \ - php7.3-interbase \ - php7.3-intl \ - php7.3-json \ - php7.3-ldap \ - php7.3-mbstring \ - php7.3-mysql \ - php7.3-odbc \ - php7.3-opcache \ - php7.3-pgsql \ - php7.3-phpdbg \ - php7.3-pspell \ - php7.3-readline \ - php7.3-recode \ - php7.3-snmp \ - php7.3-soap \ - php7.3-sqlite3 \ - php7.3-sybase \ - php7.3-tidy \ - php7.3-xml \ - php7.3-xmlrpc \ - php7.3-xsl \ - php7.3-zip - -# Install php7.4 -apt-fast install -y --no-install-recommends \ - php7.4 \ - php7.4-bcmath \ - php7.4-bz2 \ - php7.4-cgi \ - php7.4-cli \ - php7.4-common \ - php7.4-curl \ - php7.4-dba \ - php7.4-dev \ - php7.4-enchant \ - php7.4-fpm \ - php7.4-gd \ - php7.4-gmp \ - php7.4-imap \ - php7.4-interbase \ - php7.4-intl \ - php7.4-json \ - php7.4-ldap \ - php7.4-mbstring \ - php7.4-mysql \ - php7.4-odbc \ - php7.4-opcache \ - php7.4-pgsql \ - php7.4-phpdbg \ - php7.4-pspell \ - php7.4-readline \ - php7.4-snmp \ - php7.4-soap \ - php7.4-sqlite3 \ - php7.4-sybase \ - php7.4-tidy \ - php7.4-xml \ - php7.4-xmlrpc \ - php7.4-xsl \ - php7.4-zip - -apt-fast install -y --no-install-recommends \ - php-amqp \ - php-apcu \ - php-igbinary \ - php-memcache \ - php-memcached \ - php-mongodb \ - php-redis \ - php-xdebug \ - php-yaml \ - php-zmq - -apt-get remove --purge -yq php7.2-dev - -apt-fast install -y --no-install-recommends snmp - -# Install composer -php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" -php composer-setup.php -sudo mv composer.phar /usr/bin/composer -php -r "unlink('composer-setup.php');" - -# Install phpunit (for PHP) -wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar -chmod +x phpunit -mv phpunit /usr/local/bin/phpunit - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in php php7.1 php7.2 php7.3 php7.4 composer phpunit; do - if ! command -v $cmd; then - echo "$cmd was not installed" - exit 1 - fi -done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))" -DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))" -DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))" -DocumentInstalledItem "PHP 7.4 ($(php7.4 --version | head -n 1))" -DocumentInstalledItem "Composer ($(composer --version))" -DocumentInstalledItem "PHPUnit ($(phpunit --version))" +#!/bin/bash +################################################################################ +## File: php.sh +## Desc: Installs php +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +set -e + +apt-add-repository ppa:ondrej/php -y + +# Install php7.1 +apt-fast install -y --no-install-recommends \ + php7.1 \ + php7.1-amqp \ + php7.1-bcmath \ + php7.1-bz2 \ + php7.1-cgi \ + php7.1-cli \ + php7.1-common \ + php7.1-curl \ + php7.1-dba \ + php7.1-dev \ + php7.1-enchant \ + php7.1-fpm \ + php7.1-gd \ + php7.1-gmp \ + php7.1-imap \ + php7.1-interbase \ + php7.1-intl \ + php7.1-json \ + php7.1-ldap \ + php7.1-mbstring \ + php7.1-mcrypt \ + php7.1-mysql \ + php7.1-odbc \ + php7.1-opcache \ + php7.1-pgsql \ + php7.1-phpdbg \ + php7.1-pspell \ + php7.1-readline \ + php7.1-recode \ + php7.1-snmp \ + php7.1-soap \ + php7.1-sqlite3 \ + php7.1-sybase \ + php7.1-tidy \ + php7.1-xml \ + php7.1-xmlrpc \ + php7.1-xsl \ + php7.1-zip +apt-get remove --purge -yq php7.1-dev + +# Install php7.2 +apt-fast install -y --no-install-recommends \ + php7.2 \ + php7.2-apcu \ + php7.2-amqp \ + php7.2-bcmath \ + php7.2-bz2 \ + php7.2-cgi \ + php7.2-cli \ + php7.2-common \ + php7.2-curl \ + php7.2-dba \ + php7.2-dev \ + php7.2-enchant \ + php7.2-fpm \ + php7.2-gd \ + php7.2-gmp \ + php7.2-imap \ + php7.2-interbase \ + php7.2-intl \ + php7.2-json \ + php7.2-ldap \ + php7.2-mbstring \ + php7.2-mysql \ + php7.2-odbc \ + php7.2-opcache \ + php7.2-pgsql \ + php7.2-phpdbg \ + php7.2-pspell \ + php7.2-readline \ + php7.2-recode \ + php7.2-snmp \ + php7.2-soap \ + php7.2-sqlite3 \ + php7.2-sybase \ + php7.2-tidy \ + php7.2-xml \ + php7.2-xmlrpc \ + php7.2-xsl \ + php7.2-zip + +# Install php7.3 +apt-fast install -y --no-install-recommends \ + php7.3 \ + php7.3-apcu \ + php7.3-amqp \ + php7.3-bcmath \ + php7.3-bz2 \ + php7.3-cgi \ + php7.3-cli \ + php7.3-common \ + php7.3-curl \ + php7.3-dba \ + php7.3-dev \ + php7.3-enchant \ + php7.3-fpm \ + php7.3-gd \ + php7.3-gmp \ + php7.3-imap \ + php7.3-interbase \ + php7.3-intl \ + php7.3-json \ + php7.3-ldap \ + php7.3-mbstring \ + php7.3-mysql \ + php7.3-odbc \ + php7.3-opcache \ + php7.3-pgsql \ + php7.3-phpdbg \ + php7.3-pspell \ + php7.3-readline \ + php7.3-recode \ + php7.3-snmp \ + php7.3-soap \ + php7.3-sqlite3 \ + php7.3-sybase \ + php7.3-tidy \ + php7.3-xml \ + php7.3-xmlrpc \ + php7.3-xsl \ + php7.3-zip + +apt-fast install -y --no-install-recommends \ + php-igbinary \ + php-memcache \ + php-memcached \ + php-mongodb \ + php-redis \ + php-xdebug \ + php-yaml \ + php-zmq + +apt-get remove --purge -yq php7.2-dev + +apt-fast install -y --no-install-recommends snmp + +# Install composer +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +php composer-setup.php +sudo mv composer.phar /usr/bin/composer +php -r "unlink('composer-setup.php');" + +# Install phpunit (for PHP) +wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar +chmod +x phpunit +mv phpunit /usr/local/bin/phpunit + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in php php7.1 php7.2 php7.3 composer phpunit; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))" +DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))" +DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))" +DocumentInstalledItem "Composer ($(composer --version))" +DocumentInstalledItem "PHPUnit ($(phpunit --version))" diff --git a/images/linux/scripts/installers/1804/powershellcore.sh b/images/linux/scripts/installers/1804/powershellcore.sh index c9d0e3c3d..0a5f21081 100644 --- a/images/linux/scripts/installers/1804/powershellcore.sh +++ b/images/linux/scripts/installers/1804/powershellcore.sh @@ -1,31 +1,31 @@ -#!/bin/bash -################################################################################ -## File: powershellcore.sh -## Desc: Installs powershellcore -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -LSB_RELEASE=$(lsb_release -rs) - -# Install Powershell -apt-get install -y powershell - -# Temp fix based on: https://github.com/PowerShell/PowerShell/issues/9746 -sudo apt remove libicu64 - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v pwsh; then - echo "pwsh was not installed" - exit 1 -fi -if ! pwsh -c 'Write-Host Hello world'; then - echo "pwsh failed to run" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Powershell ($(pwsh --version))" +#!/bin/bash +################################################################################ +## File: powershellcore.sh +## Desc: Installs powershellcore +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +# Install Powershell +apt-get install -y powershell + +# Temp fix based on: https://github.com/PowerShell/PowerShell/issues/9746 +sudo apt remove libicu64 + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v pwsh; then + echo "pwsh was not installed" + exit 1 +fi +if ! pwsh -c 'Write-Host Hello world'; then + echo "pwsh failed to run" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Powershell ($(pwsh --version))" diff --git a/images/linux/scripts/installers/1804/preparemetadata.sh b/images/linux/scripts/installers/1804/preparemetadata.sh index 020a5ef12..61988142c 100644 --- a/images/linux/scripts/installers/1804/preparemetadata.sh +++ b/images/linux/scripts/installers/1804/preparemetadata.sh @@ -1,12 +1,12 @@ -#!/bin/bash -################################################################################ -## File: preparemetadata.sh -## Desc: This script adds a image title information to the metadata -## document -################################################################################ - -source $HELPER_SCRIPTS/document.sh - -AddTitle "Hosted Ubuntu 1804 Image ($(lsb_release -ds))" -WriteItem "The following software is installed on machines in the Hosted Ubuntu 1804 (v$IMAGE_VERSION) pool" -WriteItem "***" +#!/bin/bash +################################################################################ +## File: preparemetadata.sh +## Desc: This script adds a image title information to the metadata +## document +################################################################################ + +source $HELPER_SCRIPTS/document.sh + +AddTitle "Hosted Ubuntu 1804 Image ($(lsb_release -ds))" +WriteItem "The following software is installed on machines in the Hosted Ubuntu 1804 (v$IMAGE_VERSION) pool" +WriteItem "***" diff --git a/images/linux/scripts/installers/7-zip.sh b/images/linux/scripts/installers/7-zip.sh index 42b6b2ef6..1baa00261 100644 --- a/images/linux/scripts/installers/7-zip.sh +++ b/images/linux/scripts/installers/7-zip.sh @@ -1,23 +1,23 @@ -#!/bin/bash -################################################################################ -## File: 7-zip.sh -## Desc: Installs 7-zip -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install 7-Zip -apt-get update -y -apt-get install -y p7zip p7zip-full p7zip-rar - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v 7z; then - echo "7-Zip was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "7-Zip $(7z i | head --lines=2 | cut -d ' ' -f 3 | tr -d '\n')" +#!/bin/bash +################################################################################ +## File: 7-zip.sh +## Desc: Installs 7-zip +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install 7-Zip +apt-get update -y +apt-get install -y p7zip p7zip-full p7zip-rar + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v 7z; then + echo "7-Zip was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "7-Zip $(7z i | head --lines=2 | cut -d ' ' -f 3 | tr -d '\n')" diff --git a/images/linux/scripts/installers/ansible.sh b/images/linux/scripts/installers/ansible.sh index 0411a6421..b4e8a4d7d 100644 --- a/images/linux/scripts/installers/ansible.sh +++ b/images/linux/scripts/installers/ansible.sh @@ -1,25 +1,25 @@ -#!/bin/bash -################################################################################ -## File: ansible.sh -## Desc: Installs Ansible -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Install Ansible PPA and latest Ansible -add-apt-repository ppa:ansible/ansible -apt-get update -apt-get install -y --no-install-recommends ansible - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v ansible; then - echo "Ansible was not installed or found on PATH" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Ansible ($(ansible --version |& head -n 1))" +#!/bin/bash +################################################################################ +## File: ansible.sh +## Desc: Installs Ansible +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Ansible PPA and latest Ansible +add-apt-repository ppa:ansible/ansible +apt-get update +apt-get install -y --no-install-recommends ansible + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v ansible; then + echo "Ansible was not installed or found on PATH" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Ansible ($(ansible --version |& head -n 1))" diff --git a/images/linux/scripts/installers/aws.sh b/images/linux/scripts/installers/aws.sh index d2fcaf5de..fabbfe9f4 100644 --- a/images/linux/scripts/installers/aws.sh +++ b/images/linux/scripts/installers/aws.sh @@ -1,26 +1,26 @@ -#!/bin/bash -################################################################################ -## File: aws.sh -## Desc: Installs the AWS CLI -################################################################################ - -# Source the helpers -source $HELPER_SCRIPTS/document.sh - -# Install the AWS CLI -curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" -unzip awscli-bundle.zip -./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws -rm awscli-bundle.zip -rm -rf awscli-bundle - -# Validate the installation -echo "Validate the installation" -if ! command -v aws; then - echo "aws was not installed" - exit 1 -fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "AWS CLI ($(aws --version 2>&1))" +#!/bin/bash +################################################################################ +## File: aws.sh +## Desc: Installs the AWS CLI +################################################################################ + +# Source the helpers +source $HELPER_SCRIPTS/document.sh + +# Install the AWS CLI +curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" +unzip awscli-bundle.zip +./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws +rm awscli-bundle.zip +rm -rf awscli-bundle + +# Validate the installation +echo "Validate the installation" +if ! command -v aws; then + echo "aws was not installed" + exit 1 +fi + +# Document the installed version +echo "Document the installed version" +DocumentInstalledItem "AWS CLI ($(aws --version 2>&1))" diff --git a/images/linux/scripts/installers/azcopy.sh b/images/linux/scripts/installers/azcopy.sh index 317a4d84c..9e97a3ec1 100644 --- a/images/linux/scripts/installers/azcopy.sh +++ b/images/linux/scripts/installers/azcopy.sh @@ -1,25 +1,25 @@ -#!/bin/bash -################################################################################ -## File: azcopy.sh -## Desc: Installs AzCopy -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install AzCopy -wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64 -tar -xf azcopy.tar.gz -rm azcopy.tar.gz -./install.sh - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v azcopy; then - echo "azcopy was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "AzCopy ($(azcopy --version))" +#!/bin/bash +################################################################################ +## File: azcopy.sh +## Desc: Installs AzCopy +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install AzCopy +wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64 +tar -xf azcopy.tar.gz +rm azcopy.tar.gz +./install.sh + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v azcopy; then + echo "azcopy was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "AzCopy ($(azcopy --version))" diff --git a/images/linux/scripts/installers/azure-cli.sh b/images/linux/scripts/installers/azure-cli.sh index bf9d43aec..665a188a8 100644 --- a/images/linux/scripts/installers/azure-cli.sh +++ b/images/linux/scripts/installers/azure-cli.sh @@ -1,26 +1,26 @@ -#!/bin/bash -################################################################################ -## File: azure-cli.sh -## Desc: Installed Azure CLI (az) -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -LSB_CODENAME=$(lsb_release -cs) - -# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) -echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $LSB_CODENAME main" | tee /etc/apt/sources.list.d/azure-cli.list -apt-key adv --keyserver packages.microsoft.com --recv-keys B02C46DF417A0893 -apt-get update -apt-get install -y --no-install-recommends apt-transport-https azure-cli - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v az; then - echo "azure-cli was not installed" - exit 1 -fi - -# Document what was added to the image -DocumentInstalledItem "Azure CLI ($(az -v | head -n 1))" +#!/bin/bash +################################################################################ +## File: azure-cli.sh +## Desc: Installed Azure CLI (az) +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_CODENAME=$(lsb_release -cs) + +# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) +echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $LSB_CODENAME main" | tee /etc/apt/sources.list.d/azure-cli.list +apt-key adv --keyserver packages.microsoft.com --recv-keys B02C46DF417A0893 +apt-get update +apt-get install -y --no-install-recommends apt-transport-https azure-cli + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v az; then + echo "azure-cli was not installed" + exit 1 +fi + +# Document what was added to the image +DocumentInstalledItem "Azure CLI ($(az -v | head -n 1))" diff --git a/images/linux/scripts/installers/azure-devops-cli.sh b/images/linux/scripts/installers/azure-devops-cli.sh index c8ca46718..2529c53c2 100644 --- a/images/linux/scripts/installers/azure-devops-cli.sh +++ b/images/linux/scripts/installers/azure-devops-cli.sh @@ -1,23 +1,23 @@ -#!/bin/bash -################################################################################ -## File: azure-devops-cli.sh -## Desc: Installed Azure DevOps CLI (az devops) -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# install azure devops Cli extension -az extension add -n azure-devops - -# check to determine if extension was installed or not -if [ $? -eq 0 ] -then - echo "azure DevOps Cli extension was installed" -else - echo "azure DevOps Cli extension was not installed" - exit 1 -fi - -# Document what was added to the image -DocumentInstalledItem "Azure CLI ($(az -v | grep azure-devops))" +#!/bin/bash +################################################################################ +## File: azure-devops-cli.sh +## Desc: Installed Azure DevOps CLI (az devops) +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# install azure devops Cli extension +az extension add -n azure-devops + +# check to determine if extension was installed or not +if [ $? -eq 0 ] +then + echo "azure DevOps Cli extension was installed" +else + echo "azure DevOps Cli extension was not installed" + exit 1 +fi + +# Document what was added to the image +DocumentInstalledItem "Azure CLI ($(az -v | grep azure-devops))" diff --git a/images/linux/scripts/installers/boost.sh b/images/linux/scripts/installers/boost.sh index be9aa802f..3b7d6b043 100644 --- a/images/linux/scripts/installers/boost.sh +++ b/images/linux/scripts/installers/boost.sh @@ -1,31 +1,31 @@ -#!/bin/bash -################################################################################ -## File: boost.sh -## Desc: Installs Boost C++ Libraries -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -BOOST_ZIP_PATH=/opt/hostedtoolcache/Boost -BOOST_LIB=/usr/local/share/boost - -# Install Boost -for BOOST_VERSION in ${BOOST_VERSIONS//,/ } -do - BOOST_SYMLINK_VER=`echo "${BOOST_VERSION//[.]/_}"` - BOOST_ROOT="BOOST_ROOT_$BOOST_SYMLINK_VER" - BOOST_ZIP="boost_`echo $BOOST_VERSION`_gcc.zip" - - unzip $BOOST_ZIP_PATH/$BOOST_ZIP -d $BOOST_LIB - - echo "$BOOST_ROOT=$BOOST_LIB/$BOOST_VERSION" | tee -a /etc/environment - if [[ $BOOST_VERSION == $BOOST_DEFAULT ]]; then - echo "BOOST_ROOT=$BOOST_LIB/$BOOST_VERSION" | tee -a /etc/environment - fi - - DocumentInstalledItem "Boost C++ Libraries $BOOST_VERSION" -done - -# Deleting archives with Boost Libraries -rm -rf $BOOST_ZIP_PATH +#!/bin/bash +################################################################################ +## File: boost.sh +## Desc: Installs Boost C++ Libraries +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +BOOST_ZIP_PATH=/opt/hostedtoolcache/Boost +BOOST_LIB=/usr/local/share/boost + +# Install Boost +for BOOST_VERSION in ${BOOST_VERSIONS//,/ } +do + BOOST_SYMLINK_VER=`echo "${BOOST_VERSION//[.]/_}"` + BOOST_ROOT="BOOST_ROOT_$BOOST_SYMLINK_VER" + BOOST_ZIP="boost_`echo $BOOST_VERSION`_gcc.zip" + + unzip $BOOST_ZIP_PATH/$BOOST_ZIP -d $BOOST_LIB + + echo "$BOOST_ROOT=$BOOST_LIB/$BOOST_VERSION" | tee -a /etc/environment + if [[ $BOOST_VERSION == $BOOST_DEFAULT ]]; then + echo "BOOST_ROOT=$BOOST_LIB/$BOOST_VERSION" | tee -a /etc/environment + fi + + DocumentInstalledItem "Boost C++ Libraries $BOOST_VERSION" +done + +# Deleting archives with Boost Libraries +rm -rf $BOOST_ZIP_PATH diff --git a/images/linux/scripts/installers/build-essential.sh b/images/linux/scripts/installers/build-essential.sh index 964aa0459..70ea94042 100644 --- a/images/linux/scripts/installers/build-essential.sh +++ b/images/linux/scripts/installers/build-essential.sh @@ -1,24 +1,24 @@ -#!/bin/bash -################################################################################ -## File: build-essential.sh -## Desc: Installs build-essential package -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -PACKAGE=build-essential - -# Test to see if the software in question is already installed, if not install it -echo "Checking to see if the installer script has already been run" -if ! IsInstalled $PACKAGE; then - echo "Installing $PACKAGE" - apt-get install -y --no-install-recommends $PACKAGE -else - echo "$PACKAGE is already installed" -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "$PACKAGE" +#!/bin/bash +################################################################################ +## File: build-essential.sh +## Desc: Installs build-essential package +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +PACKAGE=build-essential + +# Test to see if the software in question is already installed, if not install it +echo "Checking to see if the installer script has already been run" +if ! IsInstalled $PACKAGE; then + echo "Installing $PACKAGE" + apt-get install -y --no-install-recommends $PACKAGE +else + echo "$PACKAGE is already installed" +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "$PACKAGE" diff --git a/images/linux/scripts/installers/clang.sh b/images/linux/scripts/installers/clang.sh index 5b85448a7..6d34c9216 100644 --- a/images/linux/scripts/installers/clang.sh +++ b/images/linux/scripts/installers/clang.sh @@ -1,31 +1,31 @@ -#!/bin/bash -################################################################################ -## File: example.sh -## Desc: This is an example script that can be copied to add a new software -## installer to the image -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -apt-add-repository "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-6.0 main" -apt-get update -apt-get install -y clang-6.0 lldb-6.0 lld-6.0 - -update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-6.0 100 -update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 100 - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in clang clang++ clang-6.0 clang++-6.0; do - if ! command -v $cmd; then - echo "$cmd was not installed" - exit 1 - fi -done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Clang 6.0 ($(clang-6.0 --version | head -n 1))" +#!/bin/bash +################################################################################ +## File: example.sh +## Desc: This is an example script that can be copied to add a new software +## installer to the image +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - +apt-add-repository "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-6.0 main" +apt-get update +apt-get install -y clang-6.0 lldb-6.0 lld-6.0 + +update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-6.0 100 +update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 100 + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in clang clang++ clang-6.0 clang++-6.0; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Clang 6.0 ($(clang-6.0 --version | head -n 1))" diff --git a/images/linux/scripts/installers/cmake.sh b/images/linux/scripts/installers/cmake.sh index 7e284c839..32e98af7b 100644 --- a/images/linux/scripts/installers/cmake.sh +++ b/images/linux/scripts/installers/cmake.sh @@ -1,30 +1,30 @@ -#!/bin/bash -################################################################################ -## File: cmake.sh -## Desc: Installs CMake -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Test to see if the software in question is already installed, if not install it -echo "Checking to see if the installer script has already been run" -if command -v cmake; then - echo "Example variable already set to $EXAMPLE_VAR" -else - curl -sL https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.sh -o cmakeinstall.sh \ - && chmod +x cmakeinstall.sh \ - && ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \ - && rm cmakeinstall.sh -fi - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v cmake; then - echo "cmake was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "CMake ($(cmake --version | head -n 1))" +#!/bin/bash +################################################################################ +## File: cmake.sh +## Desc: Installs CMake +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Test to see if the software in question is already installed, if not install it +echo "Checking to see if the installer script has already been run" +if command -v cmake; then + echo "Example variable already set to $EXAMPLE_VAR" +else + curl -sL https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.sh -o cmakeinstall.sh \ + && chmod +x cmakeinstall.sh \ + && ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \ + && rm cmakeinstall.sh +fi + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v cmake; then + echo "cmake was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "CMake ($(cmake --version | head -n 1))" diff --git a/images/linux/scripts/installers/docker-compose.sh b/images/linux/scripts/installers/docker-compose.sh index 0ee5f47ac..cd8f09ebd 100644 --- a/images/linux/scripts/installers/docker-compose.sh +++ b/images/linux/scripts/installers/docker-compose.sh @@ -1,26 +1,26 @@ -#!/bin/bash -################################################################################ -## File: docker-compose.sh -## Desc: Installs Docker Compose -################################################################################ - -source $HELPER_SCRIPTS/apt.sh -source $HELPER_SCRIPTS/document.sh - -version="1.22.0" - -# Install latest docker-compose from releases -curl -L "https://github.com/docker/compose/releases/download/$version/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose -chmod +x /usr/local/bin/docker-compose - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v docker-compose; then - echo "docker-compose was not installed" - exit 1 -fi - -## Add version information to the metadata file -echo "Documenting Docker Compose version" -docker_compose_version=$(docker-compose -v) -DocumentInstalledItem "Docker Compose (${docker_compose_version})" +#!/bin/bash +################################################################################ +## File: docker-compose.sh +## Desc: Installs Docker Compose +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +version="1.22.0" + +# Install latest docker-compose from releases +curl -L "https://github.com/docker/compose/releases/download/$version/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +chmod +x /usr/local/bin/docker-compose + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v docker-compose; then + echo "docker-compose was not installed" + exit 1 +fi + +## Add version information to the metadata file +echo "Documenting Docker Compose version" +docker_compose_version=$(docker-compose -v) +DocumentInstalledItem "Docker Compose (${docker_compose_version})" diff --git a/images/linux/scripts/installers/docker-moby.sh b/images/linux/scripts/installers/docker-moby.sh index ed1817224..625c93cfa 100644 --- a/images/linux/scripts/installers/docker-moby.sh +++ b/images/linux/scripts/installers/docker-moby.sh @@ -1,43 +1,43 @@ -#!/bin/bash -################################################################################ -## File: docker-ce.sh -## Desc: Installs docker onto the image, but does not pre-pull any images -################################################################################ - -source $HELPER_SCRIPTS/apt.sh -source $HELPER_SCRIPTS/document.sh - -docker_package=moby - -## Check to see if docker is already installed -echo "Determing if Docker ($docker_package) is installed" -if ! IsInstalled $docker_package; then - echo "Docker ($docker_package) was not found. Installing..." - apt-get remove -y moby-engine moby-cli - apt-get update - apt-get install -y apt-transport-https ca-certificates curl software-properties-common - curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - - curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/microsoft-prod.list - apt-get update - apt-get install -y moby-engine moby-cli -else - echo "Docker ($docker_package) is already installed" -fi - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v docker; then - echo "docker was not installed" - exit 1 -else - # Docker daemon takes time to come up after installing - sleep 10 - set -e - docker info - set +e -fi - -## Add version information to the metadata file -echo "Documenting Docker version" -docker_version=$(docker -v) -DocumentInstalledItem "Docker ($docker_version)" +#!/bin/bash +################################################################################ +## File: docker-ce.sh +## Desc: Installs docker onto the image, but does not pre-pull any images +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +docker_package=moby + +## Check to see if docker is already installed +echo "Determing if Docker ($docker_package) is installed" +if ! IsInstalled $docker_package; then + echo "Docker ($docker_package) was not found. Installing..." + apt-get remove -y moby-engine moby-cli + apt-get update + apt-get install -y apt-transport-https ca-certificates curl software-properties-common + curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - + curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/microsoft-prod.list + apt-get update + apt-get install -y moby-engine moby-cli +else + echo "Docker ($docker_package) is already installed" +fi + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v docker; then + echo "docker was not installed" + exit 1 +else + # Docker daemon takes time to come up after installing + sleep 10 + set -e + docker info + set +e +fi + +## Add version information to the metadata file +echo "Documenting Docker version" +docker_version=$(docker -v) +DocumentInstalledItem "Docker ($docker_version)" diff --git a/images/linux/scripts/installers/docker.sh b/images/linux/scripts/installers/docker.sh index 2b9db9b43..b7fb84e6a 100644 --- a/images/linux/scripts/installers/docker.sh +++ b/images/linux/scripts/installers/docker.sh @@ -1,34 +1,34 @@ -#!/bin/bash -################################################################################ -## File: docker.sh -## Desc: Installs the correct version of docker onto the image, and pulls -## down the default docker image used for building on ubuntu -################################################################################ - -source $HELPER_SCRIPTS/apt.sh -source $HELPER_SCRIPTS/document.sh - -DOCKER_PACKAGE=moby - -apt-get remove -y moby-engine mobi-cli -apt-get update -apt-get install -y apt-transport-https ca-certificates curl software-properties-common -apt-get update -apt-get install -y moby-engine mobi-cli - -docker pull node:10 -docker pull node:12 -docker pull buildpack-deps:stretch -docker pull node:10-alpine -docker pull node:12-alpine -docker pull debian:8 -docker pull debian:9 -docker pull alpine:3.7 -docker pull alpine:3.8 -docker pull alpine:3.9 -docker pull alpine:3.10 - -## Add version information to the metadata file -echo "Documenting Docker version" -DOCKER_VERSION=`docker -v` -DocumentInstalledItem "Docker ($DOCKER_VERSION)" +#!/bin/bash +################################################################################ +## File: docker.sh +## Desc: Installs the correct version of docker onto the image, and pulls +## down the default docker image used for building on ubuntu +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +DOCKER_PACKAGE=moby + +apt-get remove -y moby-engine mobi-cli +apt-get update +apt-get install -y apt-transport-https ca-certificates curl software-properties-common +apt-get update +apt-get install -y moby-engine mobi-cli + +docker pull node:10 +docker pull node:12 +docker pull buildpack-deps:stretch +docker pull node:10-alpine +docker pull node:12-alpine +docker pull debian:8 +docker pull debian:9 +docker pull alpine:3.7 +docker pull alpine:3.8 +docker pull alpine:3.9 +docker pull alpine:3.10 + +## Add version information to the metadata file +echo "Documenting Docker version" +DOCKER_VERSION=`docker -v` +DocumentInstalledItem "Docker ($DOCKER_VERSION)" diff --git a/images/linux/scripts/installers/dotnetcore.sh b/images/linux/scripts/installers/dotnetcore.sh new file mode 100644 index 000000000..a5eae25cf --- /dev/null +++ b/images/linux/scripts/installers/dotnetcore.sh @@ -0,0 +1,29 @@ +#!/bin/bash +################################################################################ +## File: dotnetcore.sh +## Desc: Installs .NET Core onto the image for running the provisioner +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +DOTNET_PACKAGE=dotnet-dev-1.0.4 + +echo "Determing if .NET Core ($DOTNET_PACKAGE) is installed" +if ! IsInstalled $DOTNET_PACKAGE; then + echo "Could not find .NET Core ($DOTNET_PACKAGE), installing..." + echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893 + apt-get update + apt-get install $DOTNET_PACKAGE -y +else + echo ".NET Core ($DOTNET_PACKAGE) is already installed" +fi + +echo "Testing .NET Core ($DOTNET_PACKAGE)" +echo "Pulling down initial dependencies" +dotnet help + +echo "Documenting .NET Core ($DOTNET_PACKAGE)" +DOTNET_VERSION=`dotnet --version` +DocumentInstalledItem ".NET Core $DOTNET_VERSION" diff --git a/images/linux/scripts/installers/erlang.sh b/images/linux/scripts/installers/erlang.sh index 4ff26d044..f71c6de45 100644 --- a/images/linux/scripts/installers/erlang.sh +++ b/images/linux/scripts/installers/erlang.sh @@ -1,39 +1,39 @@ -#!/bin/bash -################################################################################ -## File: erlang.sh -## Desc: Installs erlang -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -source_list=/etc/apt/sources.list.d/eslerlang.list - -# Install Erlang -echo "deb http://binaries.erlang-solutions.com/debian $(lsb_release -cs) contrib" > $source_list -wget -O - http://binaries.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add - -apt-get update -apt-get install -y --no-install-recommends esl-erlang - -# Install rebar3 -wget -q -O rebar3 https://s3.amazonaws.com/rebar3/rebar3 -chmod +x rebar3 -mv rebar3 /usr/local/bin/rebar3 - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in erl erlc rebar3; do - if ! command -v $cmd; then - echo "$cmd was not installed or not found on PATH" - exit 1 - fi -done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -erlang_version="$(erl -version 2>&1 | tr -d '\n' | tr -d '\r')" -DocumentInstalledItem "Erlang ($erlang_version)" - -# Clean up source list -rm $source_list +#!/bin/bash +################################################################################ +## File: erlang.sh +## Desc: Installs erlang +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +source_list=/etc/apt/sources.list.d/eslerlang.list + +# Install Erlang +echo "deb http://binaries.erlang-solutions.com/debian $(lsb_release -cs) contrib" > $source_list +wget -O - http://binaries.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add - +apt-get update +apt-get install -y --no-install-recommends esl-erlang + +# Install rebar3 +wget -q -O rebar3 https://s3.amazonaws.com/rebar3/rebar3 +chmod +x rebar3 +mv rebar3 /usr/local/bin/rebar3 + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in erl erlc rebar3; do + if ! command -v $cmd; then + echo "$cmd was not installed or not found on PATH" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +erlang_version="$(erl -version 2>&1 | tr -d '\n' | tr -d '\r')" +DocumentInstalledItem "Erlang ($erlang_version)" + +# Clean up source list +rm $source_list diff --git a/images/linux/scripts/installers/example.sh b/images/linux/scripts/installers/example.sh index aeab39f02..a4937447c 100644 --- a/images/linux/scripts/installers/example.sh +++ b/images/linux/scripts/installers/example.sh @@ -1,31 +1,31 @@ -#!/bin/bash -################################################################################ -## File: example.sh -## Desc: This is an example script that can be copied to add a new software -## installer to the image -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Test to see if the software in question is already installed, if not install it -echo "Checking to see if the installer script has already been run" -if [ -z $EXAMPLE_VAR ]; then - $EXAMPLE_VAR=1.0.0 -else - echo "Example variable already set to $EXAMPLE_VAR" -fi - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if [ -z $EXAMPLE_VAR ]; then - echo "EXAMPLE_VAR variable was not set as expected" - exit 1 -else - echo "EXAMPLE_VAR was set properly" -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Example Var ($EXAMPLE_VAR)" +#!/bin/bash +################################################################################ +## File: example.sh +## Desc: This is an example script that can be copied to add a new software +## installer to the image +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Test to see if the software in question is already installed, if not install it +echo "Checking to see if the installer script has already been run" +if [ -z $EXAMPLE_VAR ]; then + $EXAMPLE_VAR=1.0.0 +else + echo "Example variable already set to $EXAMPLE_VAR" +fi + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if [ -z $EXAMPLE_VAR ]; then + echo "EXAMPLE_VAR variable was not set as expected" + exit 1 +else + echo "EXAMPLE_VAR was set properly" +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Example Var ($EXAMPLE_VAR)" diff --git a/images/linux/scripts/installers/firefox.sh b/images/linux/scripts/installers/firefox.sh index 3f093c7c2..e14df0c46 100644 --- a/images/linux/scripts/installers/firefox.sh +++ b/images/linux/scripts/installers/firefox.sh @@ -1,25 +1,25 @@ -#!/bin/bash -################################################################################ -## File: firefox.sh -## Desc: Installs Firefox -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Install Firefox -apt-get install -y firefox - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v firefox; then - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -# Resolves: Running Firefox as root in a regular user's session is not supported. -# ($HOME is /home/packer which is owned by packer.) -HOME=/root -DocumentInstalledItem "Firefox ($(firefox --version))" +#!/bin/bash +################################################################################ +## File: firefox.sh +## Desc: Installs Firefox +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Firefox +apt-get install -y firefox + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v firefox; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +# Resolves: Running Firefox as root in a regular user's session is not supported. +# ($HOME is /home/packer which is owned by packer.) +HOME=/root +DocumentInstalledItem "Firefox ($(firefox --version))" diff --git a/images/linux/scripts/installers/gcc.sh b/images/linux/scripts/installers/gcc.sh index 234353a5d..328d5c760 100644 --- a/images/linux/scripts/installers/gcc.sh +++ b/images/linux/scripts/installers/gcc.sh @@ -1,25 +1,25 @@ -#!/bin/bash -################################################################################ -## File: gcc.sh -## Desc: Installs GNU C++ -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install GNU C++ compiler -add-apt-repository ppa:ubuntu-toolchain-r/test -y -apt-get update -y -apt-get install g++-7 -y - - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v g++-7; then - echo "GNU C++ was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "GNU C++ $(g++-7 --version | head -n 1 | cut -d ' ' -f 4)" +#!/bin/bash +################################################################################ +## File: gcc.sh +## Desc: Installs GNU C++ +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install GNU C++ compiler +add-apt-repository ppa:ubuntu-toolchain-r/test -y +apt-get update -y +apt-get install g++-7 -y + + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v g++-7; then + echo "GNU C++ was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "GNU C++ $(g++-7 --version | head -n 1 | cut -d ' ' -f 4)" diff --git a/images/linux/scripts/installers/git.sh b/images/linux/scripts/installers/git.sh index be1393aa4..026e73cd9 100644 --- a/images/linux/scripts/installers/git.sh +++ b/images/linux/scripts/installers/git.sh @@ -1,37 +1,37 @@ -#!/bin/bash -################################################################################ -## File: git.sh -## Desc: Installs Git -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -## Install git -add-apt-repository ppa:git-core/ppa -y -apt-get update -apt-get install git -y -git --version - -# Install git-lfs -curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash -apt-get install -y --no-install-recommends git-lfs - -# Run tests to determine that the software installed as expected -echo "Testing git installation" -if ! command -v git; then - echo "git was not installed" - exit 1 -fi -echo "Testing git-lfs installation" -if ! command -v git-lfs; then - echo "git-lfs was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, document the installed versions" -# git version 2.20.1 -DocumentInstalledItem "Git ($(git --version 2>&1 | cut -d ' ' -f 3))" -# git-lfs/2.6.1 (GitHub; linux amd64; go 1.11.1) -DocumentInstalledItem "Git Large File Storage (LFS) ($(git-lfs --version 2>&1 | cut -d ' ' -f 1 | cut -d '/' -f 2))" +#!/bin/bash +################################################################################ +## File: git.sh +## Desc: Installs Git +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +## Install git +add-apt-repository ppa:git-core/ppa -y +apt-get update +apt-get install git -y +git --version + +# Install git-lfs +curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash +apt-get install -y --no-install-recommends git-lfs + +# Run tests to determine that the software installed as expected +echo "Testing git installation" +if ! command -v git; then + echo "git was not installed" + exit 1 +fi +echo "Testing git-lfs installation" +if ! command -v git-lfs; then + echo "git-lfs was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, document the installed versions" +# git version 2.20.1 +DocumentInstalledItem "Git ($(git --version 2>&1 | cut -d ' ' -f 3))" +# git-lfs/2.6.1 (GitHub; linux amd64; go 1.11.1) +DocumentInstalledItem "Git Large File Storage (LFS) ($(git-lfs --version 2>&1 | cut -d ' ' -f 1 | cut -d '/' -f 2))" diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 151d18b06..5fa862b74 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -1,27 +1,27 @@ -#!/bin/bash -################################################################################ -## File: google-chrome.sh -## Desc: Installs google-chrome -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -LSB_RELEASE=$(lsb_release -rs) - -wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - -echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list -apt-get update -apt-get install -y google-chrome-stable -echo "CHROME_BIN=/usr/bin/google-chrome" | tee -a /etc/environment - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v google-chrome; then - echo "google-chrome was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Google Chrome ($(google-chrome --version))" +#!/bin/bash +################################################################################ +## File: google-chrome.sh +## Desc: Installs google-chrome +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - +echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list +apt-get update +apt-get install -y google-chrome-stable +echo "CHROME_BIN=/usr/bin/google-chrome" | tee -a /etc/environment + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v google-chrome; then + echo "google-chrome was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Google Chrome ($(google-chrome --version))" diff --git a/images/linux/scripts/installers/google-cloud-sdk.sh b/images/linux/scripts/installers/google-cloud-sdk.sh index f057d6ab9..4293a85a4 100644 --- a/images/linux/scripts/installers/google-cloud-sdk.sh +++ b/images/linux/scripts/installers/google-cloud-sdk.sh @@ -1,25 +1,25 @@ -#!/bin/bash -################################################################################ -## File: google-cloud-sdk.sh -## Desc: Installs the Google Cloud SDK -################################################################################ - -# Source the helpers -source $HELPER_SCRIPTS/document.sh - -# Install the Google Cloud SDK -echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list -curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - -sudo apt-get update -y -sudo apt-get install -y google-cloud-sdk - -# Validate the installation -echo "Validate the installation" -if ! command -v gcloud; then - echo "gcloud was not installed" - exit 1 -fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "Google Cloud SDK ($(gcloud --version | head -n 1 | cut -d ' ' -f 4))" +#!/bin/bash +################################################################################ +## File: google-cloud-sdk.sh +## Desc: Installs the Google Cloud SDK +################################################################################ + +# Source the helpers +source $HELPER_SCRIPTS/document.sh + +# Install the Google Cloud SDK +echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list +curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - +sudo apt-get update -y +sudo apt-get install -y google-cloud-sdk + +# Validate the installation +echo "Validate the installation" +if ! command -v gcloud; then + echo "gcloud was not installed" + exit 1 +fi + +# Document the installed version +echo "Document the installed version" +DocumentInstalledItem "Google Cloud SDK ($(gcloud --version | head -n 1 | cut -d ' ' -f 4))" diff --git a/images/linux/scripts/installers/haskell.sh b/images/linux/scripts/installers/haskell.sh index 63d3d4c34..3d47ad2f2 100644 --- a/images/linux/scripts/installers/haskell.sh +++ b/images/linux/scripts/installers/haskell.sh @@ -1,64 +1,64 @@ -#!/bin/bash -################################################################################ -## File: haskell.sh -## Desc: Installs Haskell -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu. -# https://launchpad.net/~hvr/+archive/ubuntu/ghc -apt-get install -y software-properties-common -add-apt-repository -y ppa:hvr/ghc -apt-get update - -# Install various versions of ghc and cabal -apt-get install -y \ - ghc-8.0.2 \ - ghc-8.2.2 \ - ghc-8.4.4 \ - ghc-8.6.2 \ - ghc-8.6.3 \ - ghc-8.6.4 \ - ghc-8.6.5 \ - ghc-8.8.1 \ - cabal-install-2.0 \ - cabal-install-2.2 \ - cabal-install-2.4 \ - cabal-install-3.0 - -# Install haskell stack, pinned to v2.1.3 -curl -sSL https://raw.githubusercontent.com/commercialhaskell/stack/v2.1.3/etc/scripts/get-stack.sh | sh - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -# Check all ghc versions -for version in 8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1; do - if ! command -v /opt/ghc/$version/bin/ghc; then - echo "ghc $version was not installed" - exit 1 - fi -done -# Check all cabal versions -for version in 2.0 2.2 2.4 3.0; do - if ! command -v /opt/cabal/$version/bin/cabal; then - echo "cabal $version was not installed" - exit 1 - fi -done -# Check stack -if ! command -v stack; then - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -for version in 2.0 2.2 2.4 3.0; do - DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$version/bin/cabal --version))" -done -for version in 8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1; do - DocumentInstalledItem "GHC ($(/opt/ghc/$version/bin/ghc --version))" -done -DocumentInstalledItem "Haskell Stack ($(stack --version))" +#!/bin/bash +################################################################################ +## File: haskell.sh +## Desc: Installs Haskell +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu. +# https://launchpad.net/~hvr/+archive/ubuntu/ghc +apt-get install -y software-properties-common +add-apt-repository -y ppa:hvr/ghc +apt-get update + +# Install various versions of ghc and cabal +apt-get install -y \ + ghc-8.0.2 \ + ghc-8.2.2 \ + ghc-8.4.4 \ + ghc-8.6.2 \ + ghc-8.6.3 \ + ghc-8.6.4 \ + ghc-8.6.5 \ + ghc-8.8.1 \ + cabal-install-2.0 \ + cabal-install-2.2 \ + cabal-install-2.4 \ + cabal-install-3.0 + +# Install haskell stack, pinned to v2.1.3 +curl -sSL https://raw.githubusercontent.com/commercialhaskell/stack/v2.1.3/etc/scripts/get-stack.sh | sh + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +# Check all ghc versions +for version in 8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1; do + if ! command -v /opt/ghc/$version/bin/ghc; then + echo "ghc $version was not installed" + exit 1 + fi +done +# Check all cabal versions +for version in 2.0 2.2 2.4 3.0; do + if ! command -v /opt/cabal/$version/bin/cabal; then + echo "cabal $version was not installed" + exit 1 + fi +done +# Check stack +if ! command -v stack; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +for version in 2.0 2.2 2.4 3.0; do + DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$version/bin/cabal --version))" +done +for version in 8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1; do + DocumentInstalledItem "GHC ($(/opt/ghc/$version/bin/ghc --version))" +done +DocumentInstalledItem "Haskell Stack ($(stack --version))" diff --git a/images/linux/scripts/installers/heroku.sh b/images/linux/scripts/installers/heroku.sh index 22d4665f5..3bcbc590f 100644 --- a/images/linux/scripts/installers/heroku.sh +++ b/images/linux/scripts/installers/heroku.sh @@ -1,22 +1,22 @@ -#!/bin/bash -################################################################################ -## File: heroku.sh -## Desc: Installs Heroku CLI -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Install Heroku CLI -curl https://cli-assets.heroku.com/install-ubuntu.sh | sh - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v heroku; then - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Heroku ($(heroku version))" +#!/bin/bash +################################################################################ +## File: heroku.sh +## Desc: Installs Heroku CLI +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Heroku CLI +curl https://cli-assets.heroku.com/install-ubuntu.sh | sh + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v heroku; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Heroku ($(heroku version))" diff --git a/images/linux/scripts/installers/hhvm.sh b/images/linux/scripts/installers/hhvm.sh index c040af3e0..10d42dae6 100644 --- a/images/linux/scripts/installers/hhvm.sh +++ b/images/linux/scripts/installers/hhvm.sh @@ -1,37 +1,37 @@ -#!/bin/bash -################################################################################ -## File: hhvm.sh -## Desc: Installs hhvm -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -hhvm_package=hhvm - -# Test to see if the software in question is already installed, if not install it -echo "Checking to see if the installer script has already been run" -if ! IsInstalled ${hhvm_package}; then - apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94 - add-apt-repository https://dl.hhvm.com/ubuntu - apt-get update - apt-get -qq install -y hhvm -else - echo "${hhvm_package} already installed" -fi - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! IsInstalled ${hhvm_package}; then - echo "${hhvm_package} was not installed" - exit 1 -fi - -if ! command -v hhvm; then - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "HHVM ($(hhvm --version | head -n 1))" +#!/bin/bash +################################################################################ +## File: hhvm.sh +## Desc: Installs hhvm +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +hhvm_package=hhvm + +# Test to see if the software in question is already installed, if not install it +echo "Checking to see if the installer script has already been run" +if ! IsInstalled ${hhvm_package}; then + apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94 + add-apt-repository https://dl.hhvm.com/ubuntu + apt-get update + apt-get -qq install -y hhvm +else + echo "${hhvm_package} already installed" +fi + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! IsInstalled ${hhvm_package}; then + echo "${hhvm_package} was not installed" + exit 1 +fi + +if ! command -v hhvm; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "HHVM ($(hhvm --version | head -n 1))" diff --git a/images/linux/scripts/installers/image-magick.sh b/images/linux/scripts/installers/image-magick.sh index db186057d..bfeee5a05 100644 --- a/images/linux/scripts/installers/image-magick.sh +++ b/images/linux/scripts/installers/image-magick.sh @@ -1,20 +1,20 @@ -#!/bin/bash -################################################################################ -## File: image-magick.sh -## Desc: Installs ImageMagick -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Install ImageMagick -apt-get install -y --no-install-recommends --fix-missing \ - imagemagick \ - libmagickcore-dev \ - libmagickwand-dev \ - libmagic-dev - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "ImageMagick" +#!/bin/bash +################################################################################ +## File: image-magick.sh +## Desc: Installs ImageMagick +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install ImageMagick +apt-get install -y --no-install-recommends --fix-missing \ + imagemagick \ + libmagickcore-dev \ + libmagickwand-dev \ + libmagic-dev + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "ImageMagick" diff --git a/images/linux/scripts/installers/java-tools.sh b/images/linux/scripts/installers/java-tools.sh index 2e96bde18..89c6750ee 100644 --- a/images/linux/scripts/installers/java-tools.sh +++ b/images/linux/scripts/installers/java-tools.sh @@ -1,7 +1,6 @@ #!/bin/bash ################################################################################ ## File: java-tools.sh -## Team: CI-Platform ## Desc: Installs Java and related tooling (Ant, Gradle, Maven) ################################################################################ @@ -34,11 +33,11 @@ apt-fast install -y --no-install-recommends ant ant-optional echo "ANT_HOME=/usr/share/ant" | tee -a /etc/environment # Install Maven -curl -sL https://www-eu.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip -o maven.zip +curl -sL https://www-eu.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.zip -o maven.zip unzip -d /usr/share maven.zip rm maven.zip -ln -s /usr/share/apache-maven-3.6.3/bin/mvn /usr/bin/mvn -echo "M2_HOME=/usr/share/apache-maven-3.6.3" | tee -a /etc/environment +ln -s /usr/share/apache-maven-3.6.2/bin/mvn /usr/bin/mvn +echo "M2_HOME=/usr/share/apache-maven-3.6.2" | tee -a /etc/environment # Install Gradle # This script downloads the latest HTML list of releases at https://gradle.org/releases/. diff --git a/images/linux/scripts/installers/kind.sh b/images/linux/scripts/installers/kind.sh index 8cbd1eeb3..3202f8b6c 100644 --- a/images/linux/scripts/installers/kind.sh +++ b/images/linux/scripts/installers/kind.sh @@ -1,26 +1,26 @@ -#!/bin/bash -################################################################################ -## File: kind.sh -## Desc: Installs kind -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Install KIND -KIND_VERSION="v0.5.1" - -curl -L -o /usr/local/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64" -chmod +x /usr/local/bin/kind - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v kind; then - echo "Kind was not installed or found on PATH" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Kind ($(kind version))" +#!/bin/bash +################################################################################ +## File: kind.sh +## Desc: Installs kind +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install KIND +KIND_VERSION="v0.5.1" + +curl -L -o /usr/local/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64" +chmod +x /usr/local/bin/kind + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v kind; then + echo "Kind was not installed or found on PATH" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Kind ($(kind version))" diff --git a/images/linux/scripts/installers/leiningen.sh b/images/linux/scripts/installers/leiningen.sh index c343fc069..318f65ebc 100644 --- a/images/linux/scripts/installers/leiningen.sh +++ b/images/linux/scripts/installers/leiningen.sh @@ -1,35 +1,35 @@ -#!/bin/bash -################################################################################ -## File: leiningen.sh -## Desc: Installs Leiningen -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -set -e - -LEIN_BIN=/usr/local/bin/lein -curl -s https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > $LEIN_BIN -chmod 0755 $LEIN_BIN - -# Run lein to trigger self-install -export LEIN_HOME=/usr/local/lib/lein -lein - -LEIN_JAR=$(find $LEIN_HOME -name "leiningen-*-standalone.jar") -echo "LEIN_JAR=$LEIN_JAR" | tee -a /etc/environment -echo "LEIN_HOME=$LEIN_HOME" | tee -a /etc/environment - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v lein; then - echo "lein was not installed" - exit 1 -else - lein new app testapp && rm -rf testapp -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Leiningen ($(lein -v))" +#!/bin/bash +################################################################################ +## File: leiningen.sh +## Desc: Installs Leiningen +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +set -e + +LEIN_BIN=/usr/local/bin/lein +curl -s https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > $LEIN_BIN +chmod 0755 $LEIN_BIN + +# Run lein to trigger self-install +export LEIN_HOME=/usr/local/lib/lein +lein + +LEIN_JAR=$(find $LEIN_HOME -name "leiningen-*-standalone.jar") +echo "LEIN_JAR=$LEIN_JAR" | tee -a /etc/environment +echo "LEIN_HOME=$LEIN_HOME" | tee -a /etc/environment + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v lein; then + echo "lein was not installed" + exit 1 +else + lein new app testapp && rm -rf testapp +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Leiningen ($(lein -v))" diff --git a/images/linux/scripts/installers/miniconda.sh b/images/linux/scripts/installers/miniconda.sh index e012781f0..8ec72635d 100644 --- a/images/linux/scripts/installers/miniconda.sh +++ b/images/linux/scripts/installers/miniconda.sh @@ -1,23 +1,23 @@ -#!/bin/bash -################################################################################ -## File: miniconda.sh -## Desc: Installs miniconda -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install Miniconda -curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \ - && chmod +x miniconda.sh \ - && ./miniconda.sh -b -p /usr/share/miniconda \ - && rm miniconda.sh - -CONDA=/usr/share/miniconda -echo "CONDA=$CONDA" | tee -a /etc/environment - -ln -s $CONDA/bin/conda /usr/bin/conda - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Miniconda ($($CONDA/bin/conda --version))" +#!/bin/bash +################################################################################ +## File: miniconda.sh +## Desc: Installs miniconda +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Miniconda +curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \ + && chmod +x miniconda.sh \ + && ./miniconda.sh -b -p /usr/share/miniconda \ + && rm miniconda.sh + +CONDA=/usr/share/miniconda +echo "CONDA=$CONDA" | tee -a /etc/environment + +ln -s $CONDA/bin/conda /usr/bin/conda + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Miniconda ($($CONDA/bin/conda --version))" diff --git a/images/linux/scripts/installers/mono.sh b/images/linux/scripts/installers/mono.sh index c00ca95b8..10b905837 100644 --- a/images/linux/scripts/installers/mono.sh +++ b/images/linux/scripts/installers/mono.sh @@ -1,29 +1,29 @@ -#!/bin/bash -################################################################################ -## File: cmake.sh -## Desc: Installs Mono -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -LSB_CODENAME=$(lsb_release -cs) - -# Test to see if the software in question is already installed, if not install it -# wget "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -O out && sudo apt-key add out && rm out - -apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -echo "deb https://download.mono-project.com/repo/ubuntu stable-$LSB_CODENAME main" | tee /etc/apt/sources.list.d/mono-official-stable.list -apt-get update -apt-get install -y --no-install-recommends apt-transport-https mono-complete - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v mono; then - echo "mono was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Mono ($(mono --version | head -n 1))" +#!/bin/bash +################################################################################ +## File: cmake.sh +## Desc: Installs Mono +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_CODENAME=$(lsb_release -cs) + +# Test to see if the software in question is already installed, if not install it +# wget "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -O out && sudo apt-key add out && rm out + +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +echo "deb https://download.mono-project.com/repo/ubuntu stable-$LSB_CODENAME main" | tee /etc/apt/sources.list.d/mono-official-stable.list +apt-get update +apt-get install -y --no-install-recommends apt-transport-https mono-complete + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v mono; then + echo "mono was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Mono ($(mono --version | head -n 1))" diff --git a/images/linux/scripts/installers/mysql.sh b/images/linux/scripts/installers/mysql.sh index fecbc9eb6..7750fd3d9 100644 --- a/images/linux/scripts/installers/mysql.sh +++ b/images/linux/scripts/installers/mysql.sh @@ -1,43 +1,43 @@ -#!/bin/bash -################################################################################ -## File: mysql.sh -## Desc: Installs MySQL Client -################################################################################ - -## Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -export ACCEPT_EULA=Y - -# Install MySQL Client -apt-get install mysql-client -y - -# Install MySQL Server -MYSQL_ROOT_PASSWORD=root -echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections -echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections - -apt-get install -y mysql-server - -# Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017) -apt-get install -y mssql-tools unixodbc-dev -apt-get -f install -ln -s /opt/mssql-tools/bin/* /usr/local/bin/ - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v mysql; then - echo "mysql was not installed" - exit 1 -fi - -set -e -mysql -vvv -e 'CREATE DATABASE smoke_test' -uroot -proot -mysql -vvv -e 'DROP DATABASE smoke_test' -uroot -proot -set +e - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "MySQL ($(mysql --version))" -DocumentInstalledItem "MySQL Server (user:root password:root)" -DocumentInstalledItem "MS SQL Server Client Tools" +#!/bin/bash +################################################################################ +## File: mysql.sh +## Desc: Installs MySQL Client +################################################################################ + +## Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +export ACCEPT_EULA=Y + +# Install MySQL Client +apt-get install mysql-client -y + +# Install MySQL Server +MYSQL_ROOT_PASSWORD=root +echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections +echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections + +apt-get install -y mysql-server + +# Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017) +apt-get install -y mssql-tools unixodbc-dev +apt-get -f install +ln -s /opt/mssql-tools/bin/* /usr/local/bin/ + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v mysql; then + echo "mysql was not installed" + exit 1 +fi + +set -e +mysql -vvv -e 'CREATE DATABASE smoke_test' -uroot -proot +mysql -vvv -e 'DROP DATABASE smoke_test' -uroot -proot +set +e + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "MySQL ($(mysql --version))" +DocumentInstalledItem "MySQL Server (user:root password:root)" +DocumentInstalledItem "MS SQL Server Client Tools" diff --git a/images/linux/scripts/installers/nodejs.sh b/images/linux/scripts/installers/nodejs.sh index 8ad5c457f..c4d6296ef 100644 --- a/images/linux/scripts/installers/nodejs.sh +++ b/images/linux/scripts/installers/nodejs.sh @@ -1,8 +1,7 @@ #!/bin/bash ################################################################################ ## File: nodejs.sh -## Team: CI-Platform -## Desc: Installs Node.js LTS and related tooling (Gulp, Bower, Grunt) +## Desc: Installs Node.js LTS and related tooling (Gulp, Grunt) ################################################################################ # Source the helpers for use with the script @@ -11,7 +10,7 @@ source $HELPER_SCRIPTS/document.sh # Install LTS Node.js and related build tools curl -sL https://git.io/n-install | bash -s -- -ny - ~/n/bin/n lts -npm install -g bower grunt gulp n parcel-bundler typescript +npm install -g grunt gulp n parcel-bundler typescript npm install -g --save-dev webpack webpack-cli npm install -g npm rm -rf ~/n @@ -26,7 +25,7 @@ apt-get install -y --no-install-recommends yarn # Run tests to determine that the software installed as expected echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in node bower grunt gulp webpack parcel yarn; do +for cmd in node grunt gulp webpack parcel yarn; do if ! command -v $cmd; then echo "$cmd was not installed" exit 1 @@ -36,7 +35,6 @@ done # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Node.js ($(node --version))" -DocumentInstalledItem "Bower ($(bower --version))" DocumentInstalledItem "Grunt ($(grunt --version))" DocumentInstalledItem "Gulp ($(gulp --version))" DocumentInstalledItem "n ($(n --version))" diff --git a/images/linux/scripts/installers/phantomjs.sh b/images/linux/scripts/installers/phantomjs.sh index 338bed36b..9f333350c 100644 --- a/images/linux/scripts/installers/phantomjs.sh +++ b/images/linux/scripts/installers/phantomjs.sh @@ -1,29 +1,29 @@ -#!/bin/bash -################################################################################ -## File: phantomjs.sh -## Desc: Installs PhantomJS -################################################################################ - -set -e - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install PhantomJS -apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev -PHANTOM_JS=phantomjs-2.1.1-linux-x86_64 -wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 -tar xvjf $PHANTOM_JS.tar.bz2 -mv $PHANTOM_JS /usr/local/share -ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v phantomjs; then - echo "phantomjs was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "PhantomJS ($(phantomjs --version))" +#!/bin/bash +################################################################################ +## File: phantomjs.sh +## Desc: Installs PhantomJS +################################################################################ + +set -e + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install PhantomJS +apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev +PHANTOM_JS=phantomjs-2.1.1-linux-x86_64 +wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 +tar xvjf $PHANTOM_JS.tar.bz2 +mv $PHANTOM_JS /usr/local/share +ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v phantomjs; then + echo "phantomjs was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "PhantomJS ($(phantomjs --version))" diff --git a/images/linux/scripts/installers/pollinate.sh b/images/linux/scripts/installers/pollinate.sh index c1692d435..97d0d23ab 100644 --- a/images/linux/scripts/installers/pollinate.sh +++ b/images/linux/scripts/installers/pollinate.sh @@ -1,22 +1,22 @@ -#!/bin/bash -################################################################################ -## File: pollinate.sh -## Desc: Installs Pollinate -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install Pollinate -apt-get install -y --no-install-recommends pollinate - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v pollinate; then - echo "pollinate was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Pollinate" +#!/bin/bash +################################################################################ +## File: pollinate.sh +## Desc: Installs Pollinate +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Pollinate +apt-get install -y --no-install-recommends pollinate + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v pollinate; then + echo "pollinate was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Pollinate" diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index 4b56cf159..d3b705833 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -1,67 +1,67 @@ -#!/bin/bash -################################################################################ -## File: python.sh -## Desc: Installs Python 2/3 and related tools (pip, pypy) -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install Python, Python 3, pip, pip3 -apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip - -# Install PyPy 2.7 to $AGENT_TOOLSDIRECTORY -wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.1.0-linux64.tar.bz2 -tar -x -C /tmp -f /tmp/pypy2.7-v7.1.0-linux64.tar.bz2 -rm /tmp/pypy2.7-v7.1.0-linux64.tar.bz2 -mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/2.7.13 -mv /tmp/pypy2.7-v7.1.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64 -touch $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64.complete - -# add pypy to PATH by default -ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy /usr/local/bin/pypy -# pypy will be the python in PATH when its tools cache directory is prepended to PATH -# PEP 394-style symlinking; don't bother with minor version -ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2 -ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python - -# Install latest Pip for PyPy2 -$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m ensurepip -$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m pip install --ignore-installed pip - -# Install PyPy 3.5 to $AGENT_TOOLSDIRECTORY -wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy3.5-v7.0.0-linux64.tar.bz2 -tar -x -C /tmp -f /tmp/pypy3.5-v7.0.0-linux64.tar.bz2 -rm /tmp/pypy3.5-v7.0.0-linux64.tar.bz2 -mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/3.5.3 -mv /tmp/pypy3.5-v7.0.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64 -touch $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64.complete - -# add pypy3 to PATH by default -ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 /usr/local/bin/pypy3 -# pypy3 will be the python in PATH when its tools cache directory is prepended to PATH -# PEP 394-style symlinking; don't bother with minor version -ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/python3 -ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/python3 $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/python - -# Install latest Pip for PyPy3 -$AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 -m ensurepip -$AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 -m pip install --ignore-installed pip - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in python pip pypy python3 pip3 pypy3; do - if ! command -v $cmd; then - echo "$cmd was not installed or not found on PATH" - exit 1 - fi -done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Python ($(python --version 2>&1))" -DocumentInstalledItem "pip ($(pip --version))" -DocumentInstalledItem "Python3 ($(python3 --version))" -DocumentInstalledItem "pip3 ($(pip3 --version))" -DocumentInstalledItem "PyPy2 ($(pypy --version 2>&1 | grep PyPy))" -DocumentInstalledItem "PyPy3 ($(pypy3 --version 2>&1 | grep PyPy))" +#!/bin/bash +################################################################################ +## File: python.sh +## Desc: Installs Python 2/3 and related tools (pip, pypy) +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Python, Python 3, pip, pip3 +apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip + +# Install PyPy 2.7 to $AGENT_TOOLSDIRECTORY +wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.1.0-linux64.tar.bz2 +tar -x -C /tmp -f /tmp/pypy2.7-v7.1.0-linux64.tar.bz2 +rm /tmp/pypy2.7-v7.1.0-linux64.tar.bz2 +mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/2.7.13 +mv /tmp/pypy2.7-v7.1.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64 +touch $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64.complete + +# add pypy to PATH by default +ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy /usr/local/bin/pypy +# pypy will be the python in PATH when its tools cache directory is prepended to PATH +# PEP 394-style symlinking; don't bother with minor version +ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2 +ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python + +# Install latest Pip for PyPy2 +$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m ensurepip +$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m pip install --ignore-installed pip + +# Install PyPy 3.5 to $AGENT_TOOLSDIRECTORY +wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy3.6-v7.2.0-linux64.tar.bz2 +tar -x -C /tmp -f /tmp/pypy3.6-v7.2.0-linux64.tar.bz2 +rm /tmp/pypy3.6-v7.2.0-linux64.tar.bz2 +mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/3.6.9 +mv /tmp/pypy3.6-v7.2.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64 +touch $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64.complete + +# add pypy3 to PATH by default +ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/pypy3 /usr/local/bin/pypy3 +# pypy3 will be the python in PATH when its tools cache directory is prepended to PATH +# PEP 394-style symlinking; don't bother with minor version +ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/pypy3 $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/python3 +ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/python3 $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/python + +# Install latest Pip for PyPy3 +$AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/pypy3 -m ensurepip +$AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/pypy3 -m pip install --ignore-installed pip + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in python pip pypy python3 pip3 pypy3; do + if ! command -v $cmd; then + echo "$cmd was not installed or not found on PATH" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Python ($(python --version 2>&1))" +DocumentInstalledItem "pip ($(pip --version))" +DocumentInstalledItem "Python3 ($(python3 --version))" +DocumentInstalledItem "pip3 ($(pip3 --version))" +DocumentInstalledItem "PyPy2 ($(pypy --version 2>&1 | grep PyPy))" +DocumentInstalledItem "PyPy3 ($(pypy3 --version 2>&1 | grep PyPy))" diff --git a/images/linux/scripts/installers/ruby.sh b/images/linux/scripts/installers/ruby.sh index cc2d29709..aa2933ffb 100644 --- a/images/linux/scripts/installers/ruby.sh +++ b/images/linux/scripts/installers/ruby.sh @@ -1,11 +1,11 @@ -#!/bin/bash -################################################################################ -## File: ruby.sh -## Desc: Installs Ruby requirements -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install Ruby requirements -apt-get install -y libz-dev openssl libssl-dev +#!/bin/bash +################################################################################ +## File: ruby.sh +## Desc: Installs Ruby requirements +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Ruby requirements +apt-get install -y libz-dev openssl libssl-dev diff --git a/images/linux/scripts/installers/rust.sh b/images/linux/scripts/installers/rust.sh index 35fe66b25..d690f3804 100644 --- a/images/linux/scripts/installers/rust.sh +++ b/images/linux/scripts/installers/rust.sh @@ -1,54 +1,54 @@ -#!/bin/bash -################################################################################ -## File: rust.sh -## Desc: Installs Rust -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -set -e - -export RUSTUP_HOME=/usr/share/rust/.rustup -export CARGO_HOME=/usr/share/rust/.cargo - -curl https://sh.rustup.rs -sSf | sh -s -- -y - -# Add Cargo and Rust binaries to the machine path -echo "PATH=${CARGO_HOME}/bin:$PATH" | tee -a /etc/environment -source $CARGO_HOME/env - -# Install common tools -rustup component add rustfmt -rustup component add clippy -cargo install bindgen -cargo install cbindgen - -echo "Test installation of the Rust toochain" - -# Permissions -chmod -R 777 $(dirname $RUSTUP_HOME) - -for cmd in rustup rustc rustdoc cargo rustfmt cargo-clippy bindgen cbindgen; do - if ! command -v $cmd --version; then - echo "$cmd was not installed or is not found on the path" - exit 1 - fi -done - -# Rust Symlinks are added to a default profile /etc/skel -pushd /etc/skel -ln -sf $RUSTUP_HOME .rustup -ln -sf $CARGO_HOME .cargo -popd - -# Document what was added to the image -echo "Lastly, document what was added to the metadata file" -DocumentInstalledItem "rustup ($(rustup --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "rust ($(rustc --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "cargo ($(cargo --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "rustfmt ($(rustfmt --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "clippy ($(cargo-clippy --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "rustdoc ($(rustdoc --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "bindgen ($(bindgen --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "cbindgen ($(cbindgen --version 2>&1 | cut -d ' ' -f 2))" +#!/bin/bash +################################################################################ +## File: rust.sh +## Desc: Installs Rust +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +set -e + +export RUSTUP_HOME=/usr/share/rust/.rustup +export CARGO_HOME=/usr/share/rust/.cargo + +curl https://sh.rustup.rs -sSf | sh -s -- -y + +# Add Cargo and Rust binaries to the machine path +echo "PATH=${CARGO_HOME}/bin:$PATH" | tee -a /etc/environment +source $CARGO_HOME/env + +# Install common tools +rustup component add rustfmt +rustup component add clippy +cargo install bindgen +cargo install cbindgen + +echo "Test installation of the Rust toochain" + +# Permissions +chmod -R 777 $(dirname $RUSTUP_HOME) + +for cmd in rustup rustc rustdoc cargo rustfmt cargo-clippy bindgen cbindgen; do + if ! command -v $cmd --version; then + echo "$cmd was not installed or is not found on the path" + exit 1 + fi +done + +# Rust Symlinks are added to a default profile /etc/skel +pushd /etc/skel +ln -sf $RUSTUP_HOME .rustup +ln -sf $CARGO_HOME .cargo +popd + +# Document what was added to the image +echo "Lastly, document what was added to the metadata file" +DocumentInstalledItem "rustup ($(rustup --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "rust ($(rustc --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "cargo ($(cargo --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "rustfmt ($(rustfmt --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "clippy ($(cargo-clippy --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "rustdoc ($(rustdoc --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "bindgen ($(bindgen --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "cbindgen ($(cbindgen --version 2>&1 | cut -d ' ' -f 2))" diff --git a/images/linux/scripts/installers/sbt.sh b/images/linux/scripts/installers/sbt.sh index 148dfe000..adc74daaf 100644 --- a/images/linux/scripts/installers/sbt.sh +++ b/images/linux/scripts/installers/sbt.sh @@ -1,7 +1,6 @@ #!/bin/bash ################################################################################ ## File: scala.sh -## Team: CI-Platform ## Desc: Installs sbt ################################################################################ diff --git a/images/linux/scripts/installers/sphinx.sh b/images/linux/scripts/installers/sphinx.sh index 707a7cae3..844d145a2 100644 --- a/images/linux/scripts/installers/sphinx.sh +++ b/images/linux/scripts/installers/sphinx.sh @@ -1,15 +1,15 @@ -#!/bin/bash -################################################################################ -## File: sphinx.sh -## Desc: Installs Sphinx -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install Sphinx -apt-get install -y sphinxsearch - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Sphinx Open Source Search Server" +#!/bin/bash +################################################################################ +## File: sphinx.sh +## Desc: Installs Sphinx +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Sphinx +apt-get install -y sphinxsearch + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Sphinx Open Source Search Server" diff --git a/images/linux/scripts/installers/subversion.sh b/images/linux/scripts/installers/subversion.sh index 165567169..66540704c 100644 --- a/images/linux/scripts/installers/subversion.sh +++ b/images/linux/scripts/installers/subversion.sh @@ -1,22 +1,22 @@ -#!/bin/bash -################################################################################ -## File: subversion.sh -## Desc: Installs Subversion client -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install Subversion -apt-get install -y --no-install-recommends subversion - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v svn; then - echo "Subversion (svn) was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Subversion ($(svn --version | head -n 1))" +#!/bin/bash +################################################################################ +## File: subversion.sh +## Desc: Installs Subversion client +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Subversion +apt-get install -y --no-install-recommends subversion + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v svn; then + echo "Subversion (svn) was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Subversion ($(svn --version | head -n 1))" diff --git a/images/linux/scripts/installers/terraform.sh b/images/linux/scripts/installers/terraform.sh index 6c7ce09d0..be811473a 100644 --- a/images/linux/scripts/installers/terraform.sh +++ b/images/linux/scripts/installers/terraform.sh @@ -1,26 +1,26 @@ -#!/bin/bash -################################################################################ -## File: terraform.sh -## Desc: Installs terraform -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/apt.sh - -# Install Terraform -TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version) -curl -LO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -d /usr/local/bin -rm -f "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v terraform; then - echo "Terraform was not installed or found on PATH" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Terraform ($(terraform --version))" +#!/bin/bash +################################################################################ +## File: terraform.sh +## Desc: Installs terraform +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Terraform +TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version) +curl -LO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" +unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -d /usr/local/bin +rm -f "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v terraform; then + echo "Terraform was not installed or found on PATH" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Terraform ($(terraform --version))" diff --git a/images/linux/scripts/installers/test-toolcache.sh b/images/linux/scripts/installers/test-toolcache.sh index d8aa44247..af2dd359f 100644 --- a/images/linux/scripts/installers/test-toolcache.sh +++ b/images/linux/scripts/installers/test-toolcache.sh @@ -1,70 +1,70 @@ -#!/bin/bash -################################################################################ -## File: test-toolcache.sh -## Desc: Test Python and Ruby versions in tools cache -################################################################################ - -# Must be procecessed after tool cache setup(hosted-tool-cache.sh). - -# Fail out if any tests fail -set -e - -AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache - -# Python test -if [ -d "$AGENT_TOOLSDIRECTORY/Python" ]; then - cd $AGENT_TOOLSDIRECTORY/Python - python_dirs=($(find . -mindepth 1 -maxdepth 1 -type d | sed "s|^\./||")) - echo "Python versions folders: ${python_dirs[@]}" - echo "------------------------------------------" - if [ -n "$python_dirs" ]; then - for version_dir in "${python_dirs[@]}" - do - echo "Test $AGENT_TOOLSDIRECTORY/Python/$version_dir:" - expected_ver=$(echo $version_dir | egrep -o '[0-9]+\.[0-9]+') - actual_ver=$($AGENT_TOOLSDIRECTORY/Python/$version_dir/x64/python -c 'import sys;print(sys.version)'| head -1 | egrep -o '[0-9]+\.[0-9]+') - - if [ "$expected_ver" = "$actual_ver" ]; then - echo "Passed!" - else - echo "Expected: $expected_ver; Actual: $actual_ver" - exit 1 - fi - done - else - echo "$AGENT_TOOLSDIRECTORY/Python does not include any folders" - exit 1 - fi -else - echo "$AGENT_TOOLSDIRECTORY/Python does not exist" - exit 1 -fi - -# Ruby test -if [ -d "$AGENT_TOOLSDIRECTORY/Ruby" ]; then - cd $AGENT_TOOLSDIRECTORY/Ruby - ruby_dirs=($(find . -mindepth 1 -maxdepth 1 -type d | sed "s|^\./||")) - echo "Ruby versions folders: ${ruby_dirs[@]}" - echo "--------------------------------------" - if [ -n "$ruby_dirs" ]; then - for version_dir in "${ruby_dirs[@]}" - do - echo "Test $AGENT_TOOLSDIRECTORY/Ruby/$version_dir:" - expected_ver=$(echo $version_dir | egrep -o '[0-9]+\.[0-9]+') - actual_ver=$($AGENT_TOOLSDIRECTORY/Ruby/$version_dir/x64/bin/ruby -e "puts RUBY_VERSION" | egrep -o '[0-9]+\.[0-9]+') - - if [ "$expected_ver" = "$actual_ver" ]; then - echo "Passed!" - else - echo "Expected: $expected_ver; Actual: $actual_ver" - exit 1 - fi - done - else - echo "$AGENT_TOOLSDIRECTORY/Ruby does not include any folders" - exit 1 - fi -else - echo "$AGENT_TOOLSDIRECTORY/Ruby does not exist" - exit 1 -fi +#!/bin/bash +################################################################################ +## File: test-toolcache.sh +## Desc: Test Python and Ruby versions in tools cache +################################################################################ + +# Must be procecessed after tool cache setup(hosted-tool-cache.sh). + +# Fail out if any tests fail +set -e + +AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache + +# Python test +if [ -d "$AGENT_TOOLSDIRECTORY/Python" ]; then + cd $AGENT_TOOLSDIRECTORY/Python + python_dirs=($(find . -mindepth 1 -maxdepth 1 -type d | sed "s|^\./||")) + echo "Python versions folders: ${python_dirs[@]}" + echo "------------------------------------------" + if [ -n "$python_dirs" ]; then + for version_dir in "${python_dirs[@]}" + do + echo "Test $AGENT_TOOLSDIRECTORY/Python/$version_dir:" + expected_ver=$(echo $version_dir | egrep -o '[0-9]+\.[0-9]+') + actual_ver=$($AGENT_TOOLSDIRECTORY/Python/$version_dir/x64/python -c 'import sys;print(sys.version)'| head -1 | egrep -o '[0-9]+\.[0-9]+') + + if [ "$expected_ver" = "$actual_ver" ]; then + echo "Passed!" + else + echo "Expected: $expected_ver; Actual: $actual_ver" + exit 1 + fi + done + else + echo "$AGENT_TOOLSDIRECTORY/Python does not include any folders" + exit 1 + fi +else + echo "$AGENT_TOOLSDIRECTORY/Python does not exist" + exit 1 +fi + +# Ruby test +if [ -d "$AGENT_TOOLSDIRECTORY/Ruby" ]; then + cd $AGENT_TOOLSDIRECTORY/Ruby + ruby_dirs=($(find . -mindepth 1 -maxdepth 1 -type d | sed "s|^\./||")) + echo "Ruby versions folders: ${ruby_dirs[@]}" + echo "--------------------------------------" + if [ -n "$ruby_dirs" ]; then + for version_dir in "${ruby_dirs[@]}" + do + echo "Test $AGENT_TOOLSDIRECTORY/Ruby/$version_dir:" + expected_ver=$(echo $version_dir | egrep -o '[0-9]+\.[0-9]+') + actual_ver=$($AGENT_TOOLSDIRECTORY/Ruby/$version_dir/x64/bin/ruby -e "puts RUBY_VERSION" | egrep -o '[0-9]+\.[0-9]+') + + if [ "$expected_ver" = "$actual_ver" ]; then + echo "Passed!" + else + echo "Expected: $expected_ver; Actual: $actual_ver" + exit 1 + fi + done + else + echo "$AGENT_TOOLSDIRECTORY/Ruby does not include any folders" + exit 1 + fi +else + echo "$AGENT_TOOLSDIRECTORY/Ruby does not exist" + exit 1 +fi diff --git a/images/linux/scripts/installers/vcpkg.sh b/images/linux/scripts/installers/vcpkg.sh index ec42ec5a9..9f6e60aa7 100644 --- a/images/linux/scripts/installers/vcpkg.sh +++ b/images/linux/scripts/installers/vcpkg.sh @@ -1,30 +1,30 @@ -#!/bin/bash -################################################################################ -## File: vcpkg.sh -## Desc: Installs vcpkg -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Set env variable for vcpkg -VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg -echo "VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a /etc/environment - -# Install vcpkg -git clone --depth=1 https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT -$VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh -$VCPKG_INSTALLATION_ROOT/vcpkg integrate install -chmod 0777 -R $VCPKG_INSTALLATION_ROOT -ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin - -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v vcpkg; then - echo "vcpkg was not installed" - exit 1 -fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Vcpkg $(vcpkg version | head -n 1 | cut -d ' ' -f 6)" +#!/bin/bash +################################################################################ +## File: vcpkg.sh +## Desc: Installs vcpkg +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Set env variable for vcpkg +VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg +echo "VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a /etc/environment + +# Install vcpkg +git clone --depth=1 https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT +$VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh +$VCPKG_INSTALLATION_ROOT/vcpkg integrate install +chmod 0777 -R $VCPKG_INSTALLATION_ROOT +ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v vcpkg; then + echo "vcpkg was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Vcpkg $(vcpkg version | head -n 1 | cut -d ' ' -f 6)" diff --git a/images/linux/scripts/installers/zeit-now.sh b/images/linux/scripts/installers/zeit-now.sh index eb53f08bb..563ba47e1 100644 --- a/images/linux/scripts/installers/zeit-now.sh +++ b/images/linux/scripts/installers/zeit-now.sh @@ -1,22 +1,22 @@ -#!/bin/bash -################################################################################ -## File: zeit-now.sh -## Desc: Installs the Zeit Now CLI -################################################################################ - -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - -# Install the Zeit Now CLI -npm i -g now - -# Validate the installation -echo "Validate the installation" -if ! command -v now; then - echo "Zeit Now CLI was not installed" - exit 1 -fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "Zeit Now CLI ($(now --version))" +#!/bin/bash +################################################################################ +## File: zeit-now.sh +## Desc: Installs the Zeit Now CLI +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install the Zeit Now CLI +npm i -g now + +# Validate the installation +echo "Validate the installation" +if ! command -v now; then + echo "Zeit Now CLI was not installed" + exit 1 +fi + +# Document the installed version +echo "Document the installed version" +DocumentInstalledItem "Zeit Now CLI ($(now --version))" diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 57eaa1b03..12bb373fc 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -1,83 +1,83 @@ -function Install-MSI -{ - Param - ( - [String]$MsiUrl, - [String]$MsiName - ) - - $exitCode = -1 - - try - { - Write-Host "Downloading $MsiName..." - $FilePath = "${env:Temp}\$MsiName" - - Invoke-WebRequest -Uri $MsiUrl -OutFile $FilePath - - $Arguments = ('/i', $FilePath, '/QN', '/norestart' ) - - Write-Host "Starting Install $MsiName..." - $process = Start-Process -FilePath msiexec.exe -ArgumentList $Arguments -Wait -PassThru - $exitCode = $process.ExitCode - - if ($exitCode -eq 0 -or $exitCode -eq 3010) - { - Write-Host -Object 'Installation successful' - return $exitCode - } - else - { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - exit $exitCode - } - } - catch - { - Write-Host -Object "Failed to install the MSI $MsiName" - Write-Host -Object $_.Exception.Message - exit -1 - } -} - - -function Install-EXE -{ - Param - ( - [String]$Url, - [String]$Name, - [String[]]$ArgumentList - ) - - $exitCode = -1 - - try - { - Write-Host "Downloading $Name..." - $FilePath = "${env:Temp}\$Name" - - Invoke-WebRequest -Uri $Url -OutFile $FilePath - - Write-Host "Starting Install $Name..." - $process = Start-Process -FilePath $FilePath -ArgumentList $ArgumentList -Wait -PassThru - $exitCode = $process.ExitCode - - if ($exitCode -eq 0 -or $exitCode -eq 3010) - { - Write-Host -Object 'Installation successful' - return $exitCode - } - else - { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - return $exitCode - } - } - catch - { - Write-Host -Object "Failed to install the Executable $Name" - Write-Host -Object $_.Exception.Message - return -1 - } -} +function Install-MSI +{ + Param + ( + [String]$MsiUrl, + [String]$MsiName + ) + + $exitCode = -1 + + try + { + Write-Host "Downloading $MsiName..." + $FilePath = "${env:Temp}\$MsiName" + + Invoke-WebRequest -Uri $MsiUrl -OutFile $FilePath + + $Arguments = ('/i', $FilePath, '/QN', '/norestart' ) + + Write-Host "Starting Install $MsiName..." + $process = Start-Process -FilePath msiexec.exe -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + exit $exitCode + } + } + catch + { + Write-Host -Object "Failed to install the MSI $MsiName" + Write-Host -Object $_.Exception.Message + exit -1 + } +} + + +function Install-EXE +{ + Param + ( + [String]$Url, + [String]$Name, + [String[]]$ArgumentList + ) + + $exitCode = -1 + + try + { + Write-Host "Downloading $Name..." + $FilePath = "${env:Temp}\$Name" + + Invoke-WebRequest -Uri $Url -OutFile $FilePath + + Write-Host "Starting Install $Name..." + $process = Start-Process -FilePath $FilePath -ArgumentList $ArgumentList -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + return $exitCode + } + } + catch + { + Write-Host -Object "Failed to install the Executable $Name" + Write-Host -Object $_.Exception.Message + return -1 + } +} diff --git a/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 b/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 index 3d5f17590..da5d53e2c 100644 --- a/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 @@ -1,25 +1,25 @@ -function Add-ContentToMarkdown { - [CmdletBinding()] - param( - $Content = "" - ) - - Add-Content 'C:\InstalledSoftware.md' $Content -} - - -function Add-SoftwareDetailsToMarkdown { - [CmdletBinding()] - param( - $SoftwareName = "", - $DescriptionMarkdown = "" - ) - -$Content = @" - -## $SoftwareName - -$DescriptionMarkdown -"@ - Add-ContentToMarkdown -Content $Content -} +function Add-ContentToMarkdown { + [CmdletBinding()] + param( + $Content = "" + ) + + Add-Content 'C:\InstalledSoftware.md' $Content +} + + +function Add-SoftwareDetailsToMarkdown { + [CmdletBinding()] + param( + $SoftwareName = "", + $DescriptionMarkdown = "" + ) + +$Content = @" + +## $SoftwareName + +$DescriptionMarkdown +"@ + Add-ContentToMarkdown -Content $Content +} diff --git a/images/win/scripts/ImageHelpers/PathHelpers.ps1 b/images/win/scripts/ImageHelpers/PathHelpers.ps1 index 0d50cbe38..339778dcf 100644 --- a/images/win/scripts/ImageHelpers/PathHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/PathHelpers.ps1 @@ -1,68 +1,68 @@ -function Test-MachinePath{ - [CmdletBinding()] - param( - [string]$PathItem - ) - - $currentPath = Get-MachinePath - - $pathItems = $currentPath.Split(';') - - if($pathItems.Contains($PathItem)) - { - return $true - } - else - { - return $false - } -} - -function Set-MachinePath{ - [CmdletBinding()] - param( - [string]$NewPath - ) - Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name Path -Value $NewPath - return $NewPath -} - -function Add-MachinePathItem -{ - [CmdletBinding()] - param( - [string]$PathItem - ) - - $currentPath = Get-MachinePath - $newPath = $PathItem + ';' + $currentPath - return Set-MachinePath -NewPath $newPath -} - -function Get-MachinePath{ - [CmdletBinding()] - param( - - ) - $currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path - return $currentPath -} - -function Get-SystemVariable{ - [CmdletBinding()] - param( - [string]$SystemVariable - ) - $currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name $SystemVariable).$SystemVariable - return $currentPath -} - -function Set-SystemVariable{ - [CmdletBinding()] - param( - [string]$SystemVariable, - [string]$Value - ) - Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name $SystemVariable -Value $Value - return $Value -} \ No newline at end of file +function Test-MachinePath{ + [CmdletBinding()] + param( + [string]$PathItem + ) + + $currentPath = Get-MachinePath + + $pathItems = $currentPath.Split(';') + + if($pathItems.Contains($PathItem)) + { + return $true + } + else + { + return $false + } +} + +function Set-MachinePath{ + [CmdletBinding()] + param( + [string]$NewPath + ) + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name Path -Value $NewPath + return $NewPath +} + +function Add-MachinePathItem +{ + [CmdletBinding()] + param( + [string]$PathItem + ) + + $currentPath = Get-MachinePath + $newPath = $PathItem + ';' + $currentPath + return Set-MachinePath -NewPath $newPath +} + +function Get-MachinePath{ + [CmdletBinding()] + param( + + ) + $currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path + return $currentPath +} + +function Get-SystemVariable{ + [CmdletBinding()] + param( + [string]$SystemVariable + ) + $currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name $SystemVariable).$SystemVariable + return $currentPath +} + +function Set-SystemVariable{ + [CmdletBinding()] + param( + [string]$SystemVariable, + [string]$Value + ) + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name $SystemVariable -Value $Value + return $Value +} diff --git a/images/win/scripts/ImageHelpers/test/PathHelpers.Tests.ps1 b/images/win/scripts/ImageHelpers/test/PathHelpers.Tests.ps1 index 1848fe432..bbde2e226 100644 --- a/images/win/scripts/ImageHelpers/test/PathHelpers.Tests.ps1 +++ b/images/win/scripts/ImageHelpers/test/PathHelpers.Tests.ps1 @@ -1,34 +1,34 @@ -. $PSScriptRoot\..\PathHelpers.ps1 - -Describe 'Test-MachinePath Tests' { - Mock Get-MachinePath {return "C:\foo;C:\bar"} - It 'Path contains item' { - Test-MachinePath -PathItem "C:\foo" | Should Be $true - } - It 'Path does not containe item' { - Test-MachinePath -PathItem "C:\baz" | Should Be $false - } -} - -Describe 'Set-MachinePath Tests' { - Mock Get-MachinePath {return "C:\foo;C:\bar"} - Mock Set-ItemProperty {return} - It 'Set-MachinePath should return new path' { - Set-MachinePath -NewPath "C:\baz" | Should Be "C:\baz" - } -} - -Describe "Add-MachinePathItem Tests"{ - Mock Get-MachinePath {return "C:\foo;C:\bar"} - Mock Set-ItemProperty {return} - It 'Add-MachinePathItem should return complete path' { - Add-MachinePathItem -PathItem 'C:\baz' | Should Be 'C:\baz;C:\foo;C:\bar' - } -} - -Describe 'Set-SystemVariable Tests' { - Mock Set-ItemProperty {return} - It 'Set-SystemVariable should return new path' { - Set-SystemVariable -SystemVariable "NewPathVar" -Value "C:\baz" | Should Be "C:\baz" - } -} \ No newline at end of file +. $PSScriptRoot\..\PathHelpers.ps1 + +Describe 'Test-MachinePath Tests' { + Mock Get-MachinePath {return "C:\foo;C:\bar"} + It 'Path contains item' { + Test-MachinePath -PathItem "C:\foo" | Should Be $true + } + It 'Path does not containe item' { + Test-MachinePath -PathItem "C:\baz" | Should Be $false + } +} + +Describe 'Set-MachinePath Tests' { + Mock Get-MachinePath {return "C:\foo;C:\bar"} + Mock Set-ItemProperty {return} + It 'Set-MachinePath should return new path' { + Set-MachinePath -NewPath "C:\baz" | Should Be "C:\baz" + } +} + +Describe "Add-MachinePathItem Tests"{ + Mock Get-MachinePath {return "C:\foo;C:\bar"} + Mock Set-ItemProperty {return} + It 'Add-MachinePathItem should return complete path' { + Add-MachinePathItem -PathItem 'C:\baz' | Should Be 'C:\baz;C:\foo;C:\bar' + } +} + +Describe 'Set-SystemVariable Tests' { + Mock Set-ItemProperty {return} + It 'Set-SystemVariable should return new path' { + Set-SystemVariable -SystemVariable "NewPathVar" -Value "C:\baz" | Should Be "C:\baz" + } +} diff --git a/images/win/scripts/Installers/Download-ToolCache.ps1 b/images/win/scripts/Installers/Download-ToolCache.ps1 index 5f5c3e9e8..b7a49a285 100644 --- a/images/win/scripts/Installers/Download-ToolCache.ps1 +++ b/images/win/scripts/Installers/Download-ToolCache.ps1 @@ -1,51 +1,51 @@ -################################################################################ -## File: Download-ToolCache.ps1 -## Desc: Download tool cache -################################################################################ - -Function InstallTool -{ - Param - ( - [System.Object]$ExecutablePath - ) - - Write-Host $ExecutablePath.DirectoryName - Set-Location -Path $ExecutablePath.DirectoryName - Get-Location | Write-Host - if (Test-Path 'tool.zip') - { - Expand-Archive 'tool.zip' -DestinationPath '.' - } - cmd.exe /c 'install_to_tools_cache.bat' -} - -$SourceUrl = "https://vstsagenttools.blob.core.windows.net/tools" - -$Dest = "C:/" - -$Path = "hostedtoolcache/windows" - -$env:Path = "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy;" + $env:Path - -Write-Host "Started AzCopy from $SourceUrl to $Dest" - -AzCopy /Source:$SourceUrl /Dest:$Dest /S /V /Pattern:$Path - -$ToolsDirectory = $Dest + $Path - -$current = Get-Location -Set-Location -Path $ToolsDirectory - -Get-ChildItem -Recurse -Depth 4 -Filter install_to_tools_cache.bat | ForEach-Object { - #In order to work correctly Python 3.4 x86 must be installed after x64, this is achieved by current toolcache catalog structure - InstallTool($_) -} - -Set-Location -Path $current - -setx AGENT_TOOLSDIRECTORY $ToolsDirectory /M - -#junction point from the previous Python2 directory to the toolcache Python2 -$python2Dir = (Get-Item -Path ($ToolsDirectory + '/Python/2.7*/x64')).FullName -cmd.exe /c mklink /d "C:\Python27amd64" "$python2Dir" +################################################################################ +## File: Download-ToolCache.ps1 +## Desc: Download tool cache +################################################################################ + +Function InstallTool +{ + Param + ( + [System.Object]$ExecutablePath + ) + + Write-Host $ExecutablePath.DirectoryName + Set-Location -Path $ExecutablePath.DirectoryName + Get-Location | Write-Host + if (Test-Path 'tool.zip') + { + Expand-Archive 'tool.zip' -DestinationPath '.' + } + cmd.exe /c 'install_to_tools_cache.bat' +} + +$SourceUrl = "https://vstsagenttools.blob.core.windows.net/tools" + +$Dest = "C:/" + +$Path = "hostedtoolcache/windows" + +$env:Path = "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy;" + $env:Path + +Write-Host "Started AzCopy from $SourceUrl to $Dest" + +AzCopy /Source:$SourceUrl /Dest:$Dest /S /V /Pattern:$Path + +$ToolsDirectory = $Dest + $Path + +$current = Get-Location +Set-Location -Path $ToolsDirectory + +Get-ChildItem -Recurse -Depth 4 -Filter install_to_tools_cache.bat | ForEach-Object { + #In order to work correctly Python 3.4 x86 must be installed after x64, this is achieved by current toolcache catalog structure + InstallTool($_) +} + +Set-Location -Path $current + +setx AGENT_TOOLSDIRECTORY $ToolsDirectory /M + +#junction point from the previous Python2 directory to the toolcache Python2 +$python2Dir = (Get-Item -Path ($ToolsDirectory + '/Python/2.7*/x64')).FullName +cmd.exe /c mklink /d "C:\Python27amd64" "$python2Dir" diff --git a/images/win/scripts/Installers/Enable-DeveloperMode.ps1 b/images/win/scripts/Installers/Enable-DeveloperMode.ps1 index 796d02d88..cd3e7294e 100644 --- a/images/win/scripts/Installers/Enable-DeveloperMode.ps1 +++ b/images/win/scripts/Installers/Enable-DeveloperMode.ps1 @@ -1,13 +1,13 @@ -################################################################################ -## File: Enable-DeveloperMode.ps1 -## Desc: Enables Developer Mode by toggling registry setting. Developer Mode is required to enable certain tools (e.g. WinAppDriver). -################################################################################ - -# Create AppModelUnlock if it doesn't exist, required for enabling Developer Mode -$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -if (-not(Test-Path -Path $RegistryKeyPath)) { - New-Item -Path $RegistryKeyPath -ItemType Directory -Force -} - -# Add registry value to enable Developer Mode -New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1 +################################################################################ +## File: Enable-DeveloperMode.ps1 +## Desc: Enables Developer Mode by toggling registry setting. Developer Mode is required to enable certain tools (e.g. WinAppDriver). +################################################################################ + +# Create AppModelUnlock if it doesn't exist, required for enabling Developer Mode +$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" +if (-not(Test-Path -Path $RegistryKeyPath)) { + New-Item -Path $RegistryKeyPath -ItemType Directory -Force +} + +# Add registry value to enable Developer Mode +New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1 diff --git a/images/win/scripts/Installers/Finalize-VM.ps1 b/images/win/scripts/Installers/Finalize-VM.ps1 index d8632568f..ffc1b2208 100644 --- a/images/win/scripts/Installers/Finalize-VM.ps1 +++ b/images/win/scripts/Installers/Finalize-VM.ps1 @@ -1,34 +1,33 @@ -################################################################################ -## File: Finalize-VM.ps1 -## Desc: Clean up folders temp folders after installs to save space -################################################################################ - -Write-Host "Cleanup WinSxS" -Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase - -$ErrorActionPreference = 'silentlycontinue' - -Write-Host "Clean up various directories" -@( - "C:\\Recovery", - "$env:windir\\logs", - "$env:windir\\winsxs\\manifestcache", - "$env:windir\\Temp", - "$env:windir\\Installer", - "$env:TEMP" -) | ForEach-Object { - if (Test-Path $_) { - Write-Host "Removing $_" - try { - Takeown /d Y /R /f $_ - Icacls $_ /GRANT:r administrators:F /T /c /q 2>&1 | Out-Null - Remove-Item $_ -Recurse -Force | Out-Null - } - catch { $global:error.RemoveAt(0) } - } -} - -$winInstallDir = "$env:windir\\Installer" -New-Item -Path $winInstallDir -ItemType Directory -Force - -$ErrorActionPreference = 'Continue' +################################################################################ +## File: Finalize-VM.ps1 +## Desc: Clean up folders temp folders after installs to save space +################################################################################ + +Write-Host "Cleanup WinSxS" +Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase + +$ErrorActionPreference = 'silentlycontinue' + +Write-Host "Clean up various directories" +@( + "C:\\Recovery", + "$env:windir\\logs", + "$env:windir\\winsxs\\manifestcache", + "$env:windir\\Temp", + "$env:TEMP" +) | ForEach-Object { + if (Test-Path $_) { + Write-Host "Removing $_" + try { + Takeown /d Y /R /f $_ + Icacls $_ /GRANT:r administrators:F /T /c /q 2>&1 | Out-Null + Remove-Item $_ -Recurse -Force | Out-Null + } + catch { $global:error.RemoveAt(0) } + } +} + +$winInstallDir = "$env:windir\\Installer" +New-Item -Path $winInstallDir -ItemType Directory -Force + +$ErrorActionPreference = 'Continue' diff --git a/images/win/scripts/Installers/Install-7zip.ps1 b/images/win/scripts/Installers/Install-7zip.ps1 index 4a073e0a7..4e86ad3c6 100644 --- a/images/win/scripts/Installers/Install-7zip.ps1 +++ b/images/win/scripts/Installers/Install-7zip.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-7zip.ps1 -## Desc: Install 7zip -################################################################################ - -choco install 7zip.install -y +################################################################################ +## File: Install-7zip.ps1 +## Desc: Install 7zip +################################################################################ + +choco install 7zip.install -y diff --git a/images/win/scripts/Installers/Install-AzureCli.ps1 b/images/win/scripts/Installers/Install-AzureCli.ps1 index 82f44a644..4756bce3b 100644 --- a/images/win/scripts/Installers/Install-AzureCli.ps1 +++ b/images/win/scripts/Installers/Install-AzureCli.ps1 @@ -1,12 +1,12 @@ -################################################################################ -## File: Install-AzureCli.ps1 -## Desc: Install Azure CLI -################################################################################ - -choco install azure-cli -y - -$AzureCliExtensionPath = Join-Path $Env:CommonProgramFiles 'AzureCliExtensionDirectory' -New-Item -ItemType "directory" -Path $AzureCliExtensionPath - -[Environment]::SetEnvironmentVariable("AZURE_EXTENSION_DIR", $AzureCliExtensionPath, [System.EnvironmentVariableTarget]::Machine) -$Env:AZURE_EXTENSION_DIR = $AzureCliExtensionPath +################################################################################ +## File: Install-AzureCli.ps1 +## Desc: Install Azure CLI +################################################################################ + +choco install azure-cli -y + +$AzureCliExtensionPath = Join-Path $Env:CommonProgramFiles 'AzureCliExtensionDirectory' +New-Item -ItemType "directory" -Path $AzureCliExtensionPath + +[Environment]::SetEnvironmentVariable("AZURE_EXTENSION_DIR", $AzureCliExtensionPath, [System.EnvironmentVariableTarget]::Machine) +$Env:AZURE_EXTENSION_DIR = $AzureCliExtensionPath diff --git a/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 b/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 index 9676c0695..c94e6485c 100644 --- a/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 +++ b/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 @@ -1,8 +1,8 @@ -#################################################################################### -## File: Install-AzureCosmosDbEmulator.ps1 -## Desc: Install Azure CosmosDb Emulator -#################################################################################### - -Import-Module -Name ImageHelpers -Force - -Install-MSI -MsiUrl "https://aka.ms/cosmosdb-emulator" -MsiName "AzureCosmosDBEmulator.msi" +#################################################################################### +## File: Install-AzureCosmosDbEmulator.ps1 +## Desc: Install Azure CosmosDb Emulator +#################################################################################### + +Import-Module -Name ImageHelpers -Force + +Install-MSI -MsiUrl "https://aka.ms/cosmosdb-emulator" -MsiName "AzureCosmosDBEmulator.msi" diff --git a/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 b/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 index b2d4c10b2..5054e9a5d 100644 --- a/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 +++ b/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-AzureDevOpsCli.ps1 -## Desc: Install Azure DevOps CLI -################################################################################ - -az extension add -n azure-devops +################################################################################ +## File: Install-AzureDevOpsCli.ps1 +## Desc: Install Azure DevOps CLI +################################################################################ + +az extension add -n azure-devops diff --git a/images/win/scripts/Installers/Install-AzureModules.ps1 b/images/win/scripts/Installers/Install-AzureModules.ps1 index 24f175a76..0721e6e9a 100644 --- a/images/win/scripts/Installers/Install-AzureModules.ps1 +++ b/images/win/scripts/Installers/Install-AzureModules.ps1 @@ -1,197 +1,197 @@ -################################################################################ -## File: Install-AzureModules.ps1 -## Desc: Install Azure PowerShell modules -################################################################################ - -Add-Type -AssemblyName System.IO.Compression.FileSystem - -function Download-Zip -{ - [CmdletBinding()] - Param( - [Parameter( - Mandatory = $true - )] - [string] - $BlobUri - ) - - Write-Host "Downloading the zip from blob: '$BlobUri'" - $fileName = "azureps_" + "$(Get-Random)" + ".zip" - $targetLocation = Join-Path $ENV:Temp -ChildPath $fileName - Write-Host "Download target location: '$targetLocation'" - $webClient = New-Object Net.WebClient - $null = $webClient.DownloadFileAsync($BlobUri, $targetLocation) - while ($webClient.IsBusy) { } - Write-Host "Download complete. Target Location: '$targetLocation'" - return $targetLocation -} - -function Extract-Zip -{ - [CmdletBinding()] - Param( - [Parameter( - Mandatory = $true - )] - [string] - $ZipFilePath, - - [Parameter( - Mandatory = $true - )] - [string] - $TargetLocation - ) - - Write-Host "Expanding the Zip File: '$ZipFilePath'. Target: '$TargetLocation'" - $null = [System.IO.Compression.ZipFile]::ExtractToDirectory($ZipFilePath, $TargetLocation) - Write-Host "Extraction completed successfully." -} - -Set-PSRepository -InstallationPolicy Trusted -Name PSGallery - -# We try to detect the whether Azure PowerShell is installed using .msi file. If it is installed, we find it's version, then it needs to be uninstalled manually (because the uninstallation requires the PowerShell session to be closed) -$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" -$installedApplications = Get-ItemProperty -Path $regKey -$SdkVersion = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("microsoft azure powershell") } | Select-Object -First 1).DisplayVersion - -if($SdkVersion -eq $null) -{ - Write-Host "No .msi Installation Present" -} -else -{ - Write-Host "An Azure PowerShell Installation through installer has been detected. Please close this powershell session and manually uninstall the Azure PowerShell from the Add or Remove Programs in the Control Panel. Then, rerun this script from an Admin PowerShell" - throw "An Azure PowerShell Installation through installer has been detected. Please close this powershell session and manually uninstall the Azure PowerShell from the Add or Remove Programs in the Control Panel. Then, rerun this script from an Admin PowerShell" -} - -# We will try to uninstall any installation of Azure PowerShell - -$modules = Get-Module -Name Azure -ListAvailable -Write-Host "The Azure Modules initially present are:" -$modules | Select-Object Name,Version,Path | Format-Table - -foreach($module in $modules) -{ - # add logging for telling what module we are working on now - if(Test-Path -LiteralPath $module.Path) - { - try - { - Uninstall-Module -Name Azure -RequiredVersion $module.Version.tostring() -Force - } - catch - { - Write-Host "The Uninstallation of Azure Module version: $($module.Version.tostring()) failed with the error: $($_.Exception.Message) . Please Check if there isn't any other PowerShell session open." - throw $_.Exception.Message - } - } -} - -$modules = Get-Module -Name AzureRM -ListAvailable -Write-Host "The AzureRM Modules initially present are:" -$modules | Select-Object Name,Version,Path | Format-Table - -foreach($module in $modules) -{ - # add logging for telling what module we are working on now - if(Test-Path -LiteralPath $module.Path) - { - try - { - Uninstall-Module -Name AzureRM -RequiredVersion $module.Version.tostring() -Force - } - catch - { - Write-Host "The Uninstallation of AzureRM Module version: $($module.Version.tostring()) failed with the error: $($_.Exception.Message) . Please Check if there isn't any other PowerShell session open." - throw $_.Exception.Message - } - } -} - -#after this, the only installations available through a Get-Module cmdlet should be nothing - -$modules = Get-Module -Name Azure -ListAvailable - -foreach($module in $modules) -{ - Write-Host "Module found: $($module.Name) Module Version: $($module.Version)" - if($module.Version.ToString() -ne " ") - { - Write-Host "Another installation of Azure module is detected with version $($module.Version.ToString()) at path: $($module.Path)" - throw "Azure module uninstallation unsuccessful" - } -} - -$modules = Get-Module -Name AzureRM -ListAvailable - -foreach($module in $modules) -{ - write-host "Module found: $($module.Name) Module Version: $($module.Version)" - if($module.Version.ToString() -ne " ") - { - Write-Host "Another installation of AzureRM module is detected with version $($module.Version.ToString()) at path: $($module.Path)" - throw "AzureRM module uninstallation unsuccessful" - } -} - -#### NOW The correct Modules need to be saved in C:\Modules - -if($(Test-Path -LiteralPath "C:\Modules") -eq $true) -{ - Write-Host "C:\Modules directory is already present. Beginning to clear it up completely" - Remove-Item -Path "C:\Modules" -Recurse -Force -} - -mkdir "C:\Modules" - -$directoryListing = Get-ChildItem -Path "C:\Modules" - -if($directoryListing.Length -gt 0) -{ - Write-Host "C:\Modules was not deleted properly. It still has the following contents:" - $directoryListing -} -else { - Write-Host "The Directory is clean. There are no contents present in it" -} - -# Download and unzip the stored AzurePSModules from the vstsagentools public blob -$extractLocation = "C:\Modules" -$azurePsUri = @( - "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/AzurePSModules.M157.20190808.27979.zip", - "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/AzureRmPSModules.M157.20190808.27379.zip", - "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/AzPSModules.M163.20191211.17769.zip" -) - -$azureRMModulePath = "C:\Modules\azurerm_2.1.0" -$azureModulePath = "C:\Modules\azure_2.1.0" -$finalPath = "" -$environmentPSModulePath = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine") -$existingPaths = $environmentPSModulePath -split ';' -replace '\\$','' - -if ($existingPaths -notcontains $azureRMModulePath) { - $finalPath = $azureRMModulePath -} - -if ($existingPaths -notcontains $azureModulePath) { - if($finalPath -ne "") { - $finalPath = $finalPath + ";" + $azureModulePath - } - else { - $finalPath = $azureModulePath - } -} - -if($finalPath -ne "") { - [Environment]::SetEnvironmentVariable("PSModulePath", $finalPath + ";" + $env:PSModulePath, "Machine") -} - -$env:PSModulePath = $env:PSModulePath.TrimStart(';') - -foreach ($uri in $azurePsUri) -{ - $targetFile = Download-Zip -BlobUri $uri - Extract-Zip -ZipFilePath $targetFile -TargetLocation $extractLocation -} +################################################################################ +## File: Install-AzureModules.ps1 +## Desc: Install Azure PowerShell modules +################################################################################ + +Add-Type -AssemblyName System.IO.Compression.FileSystem + +function Download-Zip +{ + [CmdletBinding()] + Param( + [Parameter( + Mandatory = $true + )] + [string] + $BlobUri + ) + + Write-Host "Downloading the zip from blob: '$BlobUri'" + $fileName = "azureps_" + "$(Get-Random)" + ".zip" + $targetLocation = Join-Path $ENV:Temp -ChildPath $fileName + Write-Host "Download target location: '$targetLocation'" + $webClient = New-Object Net.WebClient + $null = $webClient.DownloadFileAsync($BlobUri, $targetLocation) + while ($webClient.IsBusy) { } + Write-Host "Download complete. Target Location: '$targetLocation'" + return $targetLocation +} + +function Extract-Zip +{ + [CmdletBinding()] + Param( + [Parameter( + Mandatory = $true + )] + [string] + $ZipFilePath, + + [Parameter( + Mandatory = $true + )] + [string] + $TargetLocation + ) + + Write-Host "Expanding the Zip File: '$ZipFilePath'. Target: '$TargetLocation'" + $null = [System.IO.Compression.ZipFile]::ExtractToDirectory($ZipFilePath, $TargetLocation) + Write-Host "Extraction completed successfully." +} + +Set-PSRepository -InstallationPolicy Trusted -Name PSGallery + +# We try to detect the whether Azure PowerShell is installed using .msi file. If it is installed, we find it's version, then it needs to be uninstalled manually (because the uninstallation requires the PowerShell session to be closed) +$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" +$installedApplications = Get-ItemProperty -Path $regKey +$SdkVersion = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("microsoft azure powershell") } | Select-Object -First 1).DisplayVersion + +if($SdkVersion -eq $null) +{ + Write-Host "No .msi Installation Present" +} +else +{ + Write-Host "An Azure PowerShell Installation through installer has been detected. Please close this powershell session and manually uninstall the Azure PowerShell from the Add or Remove Programs in the Control Panel. Then, rerun this script from an Admin PowerShell" + throw "An Azure PowerShell Installation through installer has been detected. Please close this powershell session and manually uninstall the Azure PowerShell from the Add or Remove Programs in the Control Panel. Then, rerun this script from an Admin PowerShell" +} + +# We will try to uninstall any installation of Azure PowerShell + +$modules = Get-Module -Name Azure -ListAvailable +Write-Host "The Azure Modules initially present are:" +$modules | Select-Object Name,Version,Path | Format-Table + +foreach($module in $modules) +{ + # add logging for telling what module we are working on now + if(Test-Path -LiteralPath $module.Path) + { + try + { + Uninstall-Module -Name Azure -RequiredVersion $module.Version.tostring() -Force + } + catch + { + Write-Host "The Uninstallation of Azure Module version: $($module.Version.tostring()) failed with the error: $($_.Exception.Message) . Please Check if there isn't any other PowerShell session open." + throw $_.Exception.Message + } + } +} + +$modules = Get-Module -Name AzureRM -ListAvailable +Write-Host "The AzureRM Modules initially present are:" +$modules | Select-Object Name,Version,Path | Format-Table + +foreach($module in $modules) +{ + # add logging for telling what module we are working on now + if(Test-Path -LiteralPath $module.Path) + { + try + { + Uninstall-Module -Name AzureRM -RequiredVersion $module.Version.tostring() -Force + } + catch + { + Write-Host "The Uninstallation of AzureRM Module version: $($module.Version.tostring()) failed with the error: $($_.Exception.Message) . Please Check if there isn't any other PowerShell session open." + throw $_.Exception.Message + } + } +} + +#after this, the only installations available through a Get-Module cmdlet should be nothing + +$modules = Get-Module -Name Azure -ListAvailable + +foreach($module in $modules) +{ + Write-Host "Module found: $($module.Name) Module Version: $($module.Version)" + if($module.Version.ToString() -ne " ") + { + Write-Host "Another installation of Azure module is detected with version $($module.Version.ToString()) at path: $($module.Path)" + throw "Azure module uninstallation unsuccessful" + } +} + +$modules = Get-Module -Name AzureRM -ListAvailable + +foreach($module in $modules) +{ + write-host "Module found: $($module.Name) Module Version: $($module.Version)" + if($module.Version.ToString() -ne " ") + { + Write-Host "Another installation of AzureRM module is detected with version $($module.Version.ToString()) at path: $($module.Path)" + throw "AzureRM module uninstallation unsuccessful" + } +} + +#### NOW The correct Modules need to be saved in C:\Modules + +if($(Test-Path -LiteralPath "C:\Modules") -eq $true) +{ + Write-Host "C:\Modules directory is already present. Beginning to clear it up completely" + Remove-Item -Path "C:\Modules" -Recurse -Force +} + +mkdir "C:\Modules" + +$directoryListing = Get-ChildItem -Path "C:\Modules" + +if($directoryListing.Length -gt 0) +{ + Write-Host "C:\Modules was not deleted properly. It still has the following contents:" + $directoryListing +} +else { + Write-Host "The Directory is clean. There are no contents present in it" +} + +# Download and unzip the stored AzurePSModules from the vstsagentools public blob +$extractLocation = "C:\Modules" +$azurePsUri = @( + "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/AzurePSModules.M157.20190808.27979.zip", + "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/AzureRmPSModules.M157.20190808.27379.zip", + "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/AzPSModules.M163.20191211.17769.zip" +) + +$azureRMModulePath = "C:\Modules\azurerm_2.1.0" +$azureModulePath = "C:\Modules\azure_2.1.0" +$finalPath = "" +$environmentPSModulePath = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine") +$existingPaths = $environmentPSModulePath -split ';' -replace '\\$','' + +if ($existingPaths -notcontains $azureRMModulePath) { + $finalPath = $azureRMModulePath +} + +if ($existingPaths -notcontains $azureModulePath) { + if($finalPath -ne "") { + $finalPath = $finalPath + ";" + $azureModulePath + } + else { + $finalPath = $azureModulePath + } +} + +if($finalPath -ne "") { + [Environment]::SetEnvironmentVariable("PSModulePath", $finalPath + ";" + $env:PSModulePath, "Machine") +} + +$env:PSModulePath = $env:PSModulePath.TrimStart(';') + +foreach ($uri in $azurePsUri) +{ + $targetFile = Download-Zip -BlobUri $uri + Extract-Zip -ZipFilePath $targetFile -TargetLocation $extractLocation +} diff --git a/images/win/scripts/Installers/Install-Boost.ps1 b/images/win/scripts/Installers/Install-Boost.ps1 index 58be0ab68..a076a47af 100644 --- a/images/win/scripts/Installers/Install-Boost.ps1 +++ b/images/win/scripts/Installers/Install-Boost.ps1 @@ -1,45 +1,45 @@ -################################################################################ -## File: Install-Boost.ps1 -## Desc: Install boost using tool cache -################################################################################ - -$ToolCache = 'C:\hostedtoolcache\windows\boost' -$BoostDirectory = Join-Path -Path $env:ProgramFiles -ChildPath "Boost" -$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(',') -$BoostDefault = $env:BOOST_DEFAULT - -foreach($BoostVersion in $BoostVersionsToInstall) -{ - $ZipName = Join-Path -Path $ToolCache -ChildPath "boost_${BoostVersion}_msvc-14.1.zip" - - if (-Not (Test-Path $ZipName)) - { - Write-Host "$ZipName not found" - exit 1 - } - - Write-Host "Expanding $ZipName" - - $BoostInstallationDir = Join-Path -Path $BoostDirectory -ChildPath $BoostVersion - # Expand-Archive slower for 70% than 7z - & "$env:ProgramFiles\7-Zip\7z.exe" x $ZipName -o"$BoostDirectory" -y - - $EnvBoostPath = "BOOST_ROOT_{0}" -f ($BoostVersion.Replace('.', '_')) - setx $EnvBoostPath $BoostInstallationDir /M | Out-Null - - if ($BoostVersion -eq $BoostDefault) - { - Write-Host "Adding Boost $BoostVersion to the path..." - # Add the Boost binaries to the path - Add-MachinePathItem $BoostInstallationDir | Out-Null - # Set the BOOSTROOT environment variable - setx BOOST_ROOT $BoostInstallationDir /M | Out-Null - } -} - -# Removing boost cache folder -Write-Host "Removing boost cache folder" -if (Test-Path $ToolCache) -{ - Remove-Item -Path $ToolCache -Force -Recurse -} +################################################################################ +## File: Install-Boost.ps1 +## Desc: Install boost using tool cache +################################################################################ + +$ToolCache = 'C:\hostedtoolcache\windows\boost' +$BoostDirectory = Join-Path -Path $env:ProgramFiles -ChildPath "Boost" +$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(',') +$BoostDefault = $env:BOOST_DEFAULT + +foreach($BoostVersion in $BoostVersionsToInstall) +{ + $ZipName = Join-Path -Path $ToolCache -ChildPath "boost_${BoostVersion}_msvc-14.1.zip" + + if (-Not (Test-Path $ZipName)) + { + Write-Host "$ZipName not found" + exit 1 + } + + Write-Host "Expanding $ZipName" + + $BoostInstallationDir = Join-Path -Path $BoostDirectory -ChildPath $BoostVersion + # Expand-Archive slower for 70% than 7z + & "$env:ProgramFiles\7-Zip\7z.exe" x $ZipName -o"$BoostDirectory" -y + + $EnvBoostPath = "BOOST_ROOT_{0}" -f ($BoostVersion.Replace('.', '_')) + setx $EnvBoostPath $BoostInstallationDir /M | Out-Null + + if ($BoostVersion -eq $BoostDefault) + { + Write-Host "Adding Boost $BoostVersion to the path..." + # Add the Boost binaries to the path + Add-MachinePathItem $BoostInstallationDir | Out-Null + # Set the BOOSTROOT environment variable + setx BOOST_ROOT $BoostInstallationDir /M | Out-Null + } +} + +# Removing boost cache folder +Write-Host "Removing boost cache folder" +if (Test-Path $ToolCache) +{ + Remove-Item -Path $ToolCache -Force -Recurse +} diff --git a/images/win/scripts/Installers/Install-Chrome.ps1 b/images/win/scripts/Installers/Install-Chrome.ps1 index 32f3bcf16..15a2e1e28 100644 --- a/images/win/scripts/Installers/Install-Chrome.ps1 +++ b/images/win/scripts/Installers/Install-Chrome.ps1 @@ -1,26 +1,26 @@ -################################################################################ -## File: Install-Chrome.ps1 -## Desc: Install Google Chrome -################################################################################ - -Import-Module -Name ImageHelpers -Force - -$temp_install_dir = 'C:\Windows\Installer' -New-Item -Path $temp_install_dir -ItemType Directory -Force - -Install-MSI -MsiUrl "https://seleniumwebdrivers.blob.core.windows.net/knownchromeversion/googlechromestandaloneenterprise64.msi" -MsiName "googlechromestandaloneenterprise64.msi" - -New-NetFirewallRule -DisplayName "BlockGoogleUpdate" -Direction Outbound -Action Block -Program "C:\Program Files (x86)\Google\Update\GoogleUpdate.exe" - -Stop-Service -Name gupdate -Force -Set-Service -Name gupdate -StartupType "Disabled" -Stop-Service -Name gupdatem -Force -Set-Service -Name gupdatem -StartupType "Disabled" - -New-Item -Path "HKLM:\SOFTWARE\Policies\Google\Update" -Force -New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "AutoUpdateCheckPeriodMinutes" -Value 00000000 -Force -New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "UpdateDefault" -Value 00000000 -Force -New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "DisableAutoUpdateChecksCheckboxValue" -Value 00000001 -Force -New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "Update{8A69D345-D564-463C-AFF1-A69D9E530F96}" -Value 00000000 -Force -New-Item -Path "HKLM:\SOFTWARE\Policies\Google\Chrome" -Force -New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Chrome" -Name "DefaultBrowserSettingEnabled" -Value 00000000 -Force +################################################################################ +## File: Install-Chrome.ps1 +## Desc: Install Google Chrome +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$temp_install_dir = 'C:\Windows\Installer' +New-Item -Path $temp_install_dir -ItemType Directory -Force + +Install-MSI -MsiUrl "https://seleniumwebdrivers.blob.core.windows.net/knownchromeversion/googlechromestandaloneenterprise64.msi" -MsiName "googlechromestandaloneenterprise64.msi" + +New-NetFirewallRule -DisplayName "BlockGoogleUpdate" -Direction Outbound -Action Block -Program "C:\Program Files (x86)\Google\Update\GoogleUpdate.exe" + +Stop-Service -Name gupdate -Force +Set-Service -Name gupdate -StartupType "Disabled" +Stop-Service -Name gupdatem -Force +Set-Service -Name gupdatem -StartupType "Disabled" + +New-Item -Path "HKLM:\SOFTWARE\Policies\Google\Update" -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "AutoUpdateCheckPeriodMinutes" -Value 00000000 -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "UpdateDefault" -Value 00000000 -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "DisableAutoUpdateChecksCheckboxValue" -Value 00000001 -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "Update{8A69D345-D564-463C-AFF1-A69D9E530F96}" -Value 00000000 -Force +New-Item -Path "HKLM:\SOFTWARE\Policies\Google\Chrome" -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Chrome" -Name "DefaultBrowserSettingEnabled" -Value 00000000 -Force diff --git a/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 index b8e5bc4c2..cc1f0b5c2 100644 --- a/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 +++ b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 @@ -1,24 +1,24 @@ -################################################################################ -## File: Install-CloudFoundryCli.ps1 -## Desc: Install Cloud Foundry CLI -################################################################################ - -Import-Module -Name ImageHelpers - -# Download the latest cf cli exe -Invoke-WebRequest -UseBasicParsing -Uri "https://packages.cloudfoundry.org/stable?release=windows64-exe&source=github" -OutFile cf-cli.zip - -# Create directory for cf cli -$cf_cli_path = "C:\cf-cli" -New-Item -Path $cf_cli_path -ItemType Directory -Force - -# Extract the zip archive -Write-Host "Extracting cf cli..." -Expand-Archive -Path cf-cli.zip -DestinationPath $cf_cli_path -Force - -# Add cf to path -Add-MachinePathItem $cf_cli_path - -# Delete the cfl-cli zip archive -Write-Host "Deleting downloaded archive of cf cli" -Remove-Item cf-cli.zip +################################################################################ +## File: Install-CloudFoundryCli.ps1 +## Desc: Install Cloud Foundry CLI +################################################################################ + +Import-Module -Name ImageHelpers + +# Download the latest cf cli exe +Invoke-WebRequest -UseBasicParsing -Uri "https://packages.cloudfoundry.org/stable?release=windows64-exe&source=github" -OutFile cf-cli.zip + +# Create directory for cf cli +$cf_cli_path = "C:\cf-cli" +New-Item -Path $cf_cli_path -ItemType Directory -Force + +# Extract the zip archive +Write-Host "Extracting cf cli..." +Expand-Archive -Path cf-cli.zip -DestinationPath $cf_cli_path -Force + +# Add cf to path +Add-MachinePathItem $cf_cli_path + +# Delete the cfl-cli zip archive +Write-Host "Deleting downloaded archive of cf cli" +Remove-Item cf-cli.zip diff --git a/images/win/scripts/Installers/Install-Cmake.ps1 b/images/win/scripts/Installers/Install-Cmake.ps1 index c0d2f4b41..b0ba514ee 100644 --- a/images/win/scripts/Installers/Install-Cmake.ps1 +++ b/images/win/scripts/Installers/Install-Cmake.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-Cmake.ps1 -## Desc: Install Cmake -################################################################################ - -choco install cmake.install -y --installargs 'ADD_CMAKE_TO_PATH=""System""' +################################################################################ +## File: Install-Cmake.ps1 +## Desc: Install Cmake +################################################################################ + +choco install cmake.install -y --installargs 'ADD_CMAKE_TO_PATH=""System""' diff --git a/images/win/scripts/Installers/Install-ContainersFeature.ps1 b/images/win/scripts/Installers/Install-ContainersFeature.ps1 index 0713f6060..f7a2e92e6 100644 --- a/images/win/scripts/Installers/Install-ContainersFeature.ps1 +++ b/images/win/scripts/Installers/Install-ContainersFeature.ps1 @@ -1,16 +1,16 @@ -################################################################################ -## File: Install-ContainersFeature.ps1 -## Desc: Install Windows container features. -## Must be an independent step becuase it requires a machine restart -## before we can continue. -################################################################################ - -Write-Host "Install Containers feature" -Install-WindowsFeature -Name Containers - -if ((GWMI Win32_Processor).VirtualizationFirmwareEnabled[0] -and (GWMI Win32_Processor).SecondLevelAddressTranslationExtensions[0]) { - Write-Host "Install Hyper-V feature" - Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -} else { - Write-Host "Skipping installation of Hyper-V feature" -} +################################################################################ +## File: Install-ContainersFeature.ps1 +## Desc: Install Windows container features. +## Must be an independent step becuase it requires a machine restart +## before we can continue. +################################################################################ + +Write-Host "Install Containers feature" +Install-WindowsFeature -Name Containers + +if ((GWMI Win32_Processor).VirtualizationFirmwareEnabled[0] -and (GWMI Win32_Processor).SecondLevelAddressTranslationExtensions[0]) { + Write-Host "Install Hyper-V feature" + Install-WindowsFeature -Name Hyper-V -IncludeManagementTools +} else { + Write-Host "Skipping installation of Hyper-V feature" +} diff --git a/images/win/scripts/Installers/Install-DACFx.ps1 b/images/win/scripts/Installers/Install-DACFx.ps1 index d494f12c4..7060aa25d 100644 --- a/images/win/scripts/Installers/Install-DACFx.ps1 +++ b/images/win/scripts/Installers/Install-DACFx.ps1 @@ -1,10 +1,10 @@ -#################################################################################### -## File: Install-DACFx.ps1 -## Desc: Install SQL Server® Data-Tier Application Framework (DACFx) for Windows -#################################################################################### - -Import-Module -Name ImageHelpers -Force - -$exitcode = Install-MSI -MsiUrl "https://download.microsoft.com/download/f/1/9/f19eaee6-0728-4a0b-9755-9808acc8af0b/EN/x64/DacFramework.msi" -MsiName "DacFramework.msi" - -exit $exitcode +#################################################################################### +## File: Install-DACFx.ps1 +## Desc: Install SQL Server® Data-Tier Application Framework (DACFx) for Windows +#################################################################################### + +Import-Module -Name ImageHelpers -Force + +$exitcode = Install-MSI -MsiUrl "https://download.microsoft.com/download/f/1/9/f19eaee6-0728-4a0b-9755-9808acc8af0b/EN/x64/DacFramework.msi" -MsiName "DacFramework.msi" + +exit $exitcode diff --git a/images/win/scripts/Installers/Install-Docker.ps1 b/images/win/scripts/Installers/Install-Docker.ps1 index 59df7c4a0..cd1f96969 100644 --- a/images/win/scripts/Installers/Install-Docker.ps1 +++ b/images/win/scripts/Installers/Install-Docker.ps1 @@ -1,16 +1,16 @@ -################################################################################ -## File: Install-Docker.ps1 -## Desc: Install Docker. -## Must be an independent step becuase it requires a restart before we -## can continue. -################################################################################ - -Set-PSRepository -InstallationPolicy Trusted -Name PSGallery -Write-Host "Install-Module DockerProvider" -Install-Module DockerMsftProvider -Force - -Write-Host "Install-Package Docker" -Install-Package -Name docker -ProviderName DockerMsftProvider -Force -Start-Service docker - -choco install docker-compose -y +################################################################################ +## File: Install-Docker.ps1 +## Desc: Install Docker. +## Must be an independent step becuase it requires a restart before we +## can continue. +################################################################################ + +Set-PSRepository -InstallationPolicy Trusted -Name PSGallery +Write-Host "Install-Module DockerProvider" +Install-Module DockerMsftProvider -Force + +Write-Host "Install-Package Docker" +Install-Package -Name docker -ProviderName DockerMsftProvider -Force +Start-Service docker + +choco install docker-compose -y diff --git a/images/win/scripts/Installers/Install-DotnetSDK.ps1 b/images/win/scripts/Installers/Install-DotnetSDK.ps1 index 45169adf3..7bd2573da 100644 --- a/images/win/scripts/Installers/Install-DotnetSDK.ps1 +++ b/images/win/scripts/Installers/Install-DotnetSDK.ps1 @@ -1,113 +1,113 @@ -################################################################################ -## File: Install-DotnetSDK.ps1 -## Desc: Install all released versions of the dotnet sdk and populate package -## cache. Should run after VS and Node -################################################################################ - -# ensure temp -New-Item -Path C:\Temp -Force -ItemType Directory - -[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" - -$templates = @( - 'console', - 'mstest', - 'web', - 'mvc', - 'webapi' -) - -function InstallSDKVersion ( - $sdkVersion -) -{ - if (!(Test-Path -Path "C:\Program Files\dotnet\sdk\$sdkVersion")) - { - Write-Host "Installing dotnet $sdkVersion" - .\dotnet-install.ps1 -Architecture x64 -Version $sdkVersion -InstallDir $(Join-Path -Path $env:ProgramFiles -ChildPath 'dotnet') - } - else - { - Write-Host "Sdk version $sdkVersion already installed" - } - - # Fix for issue 1276. This will be fixed in 3.1. - Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/sdk/82bc30c99f1325dfaa7ad450be96857a4fca2845/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.ImportPublishProfile.targets" -outfile "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportPublishProfile.targets" - - # warm up dotnet for first time experience - $templates | ForEach-Object { - $template = $_ - $projectPath = Join-Path -Path C:\temp -ChildPath $template - New-Item -Path $projectPath -Force -ItemType Directory - Push-Location -Path $projectPath - & $env:ProgramFiles\dotnet\dotnet.exe new globaljson --sdk-version "$sdkVersion" - & $env:ProgramFiles\dotnet\dotnet.exe new $template - Pop-Location - Remove-Item $projectPath -Force -Recurse - } -} - -function InstallAllValidSdks() -{ - Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json' -UseBasicParsing -OutFile 'releases-index.json' - $dotnetChannels = Get-Content -Path 'releases-index.json' | ConvertFrom-Json - - # Consider all channels except preview/eol channels. - # Sort the channels in ascending order - $dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { !$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') } | Sort-Object { [Version] $_."channel-version" } - - # Download installation script. - Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile 'dotnet-install.ps1' - - ForEach ($dotnetChannel in $dotnetChannels) - { - $channelVersion = $dotnetChannel.'channel-version'; - Invoke-WebRequest -Uri $dotnetChannel.'releases.json' -UseBasicParsing -OutFile "releases-$channelVersion.json" - $currentReleases = Get-Content -Path "releases-$channelVersion.json" | ConvertFrom-Json - # filtering out the preview/rc releases - $currentReleases = $currentReleases.'releases' | Where-Object { !$_.'release-version'.Contains('-') } | Sort-Object { [Version] $_.'release-version' } - ForEach ($release in $currentReleases) - { - if ($release.'sdks'.Count -gt 0) - { - Write-Host 'Found sdks property in release: ' + $release.'release-version' + 'with sdks count: ' + $release.'sdks'.Count - - - # Remove duplicate entries & preview/rc version from download list - # Sort the sdks on version - $sdks = @($release.'sdk'); - $sdks += $release.'sdks' | Where-Object { !$_.'version'.Contains('-') -and !$_.'version'.Equals($release.'sdk'.'version') } - $sdks = $sdks | Sort-Object { [Version] $_.'version' } - - ForEach ($sdk in $sdks) - { - InstallSDKVersion -sdkVersion $sdk.'version' - } - } - elseif (!$release.'sdk'.'version'.Contains('-')) - { - $sdkVersion = $release.'sdk'.'version' - InstallSDKVersion -sdkVersion $sdkVersion - } - } - } -} - -function RunPostInstallationSteps() -{ - Add-MachinePathItem "C:\Program Files\dotnet" - # Run script at startup for all users - $cmdDotNetPath = @" -@echo off -SETX PATH "%USERPROFILE%\.dotnet\tools;%PATH%" -"@ - - $cmdPath = "C:\Program Files\dotnet\userpath.bat" - $cmdDotNetPath | Out-File -Encoding ascii -FilePath $cmdPath - - # Update Run key to run a script at logon - Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "DOTNETUSERPATH" -Value $cmdPath -} - -InstallAllValidSdks -RunPostInstallationSteps +################################################################################ +## File: Install-DotnetSDK.ps1 +## Desc: Install all released versions of the dotnet sdk and populate package +## cache. Should run after VS and Node +################################################################################ + +# ensure temp +New-Item -Path C:\Temp -Force -ItemType Directory + +[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" + +$templates = @( + 'console', + 'mstest', + 'web', + 'mvc', + 'webapi' +) + +function InstallSDKVersion ( + $sdkVersion +) +{ + if (!(Test-Path -Path "C:\Program Files\dotnet\sdk\$sdkVersion")) + { + Write-Host "Installing dotnet $sdkVersion" + .\dotnet-install.ps1 -Architecture x64 -Version $sdkVersion -InstallDir $(Join-Path -Path $env:ProgramFiles -ChildPath 'dotnet') + } + else + { + Write-Host "Sdk version $sdkVersion already installed" + } + + # Fix for issue 1276. This will be fixed in 3.1. + Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/sdk/82bc30c99f1325dfaa7ad450be96857a4fca2845/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.ImportPublishProfile.targets" -outfile "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportPublishProfile.targets" + + # warm up dotnet for first time experience + $templates | ForEach-Object { + $template = $_ + $projectPath = Join-Path -Path C:\temp -ChildPath $template + New-Item -Path $projectPath -Force -ItemType Directory + Push-Location -Path $projectPath + & $env:ProgramFiles\dotnet\dotnet.exe new globaljson --sdk-version "$sdkVersion" + & $env:ProgramFiles\dotnet\dotnet.exe new $template + Pop-Location + Remove-Item $projectPath -Force -Recurse + } +} + +function InstallAllValidSdks() +{ + Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json' -UseBasicParsing -OutFile 'releases-index.json' + $dotnetChannels = Get-Content -Path 'releases-index.json' | ConvertFrom-Json + + # Consider all channels except preview/eol channels. + # Sort the channels in ascending order + $dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { !$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') } | Sort-Object { [Version] $_."channel-version" } + + # Download installation script. + Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile 'dotnet-install.ps1' + + ForEach ($dotnetChannel in $dotnetChannels) + { + $channelVersion = $dotnetChannel.'channel-version'; + Invoke-WebRequest -Uri $dotnetChannel.'releases.json' -UseBasicParsing -OutFile "releases-$channelVersion.json" + $currentReleases = Get-Content -Path "releases-$channelVersion.json" | ConvertFrom-Json + # filtering out the preview/rc releases + $currentReleases = $currentReleases.'releases' | Where-Object { !$_.'release-version'.Contains('-') } | Sort-Object { [Version] $_.'release-version' } + ForEach ($release in $currentReleases) + { + if ($release.'sdks'.Count -gt 0) + { + Write-Host 'Found sdks property in release: ' + $release.'release-version' + 'with sdks count: ' + $release.'sdks'.Count + + + # Remove duplicate entries & preview/rc version from download list + # Sort the sdks on version + $sdks = @($release.'sdk'); + $sdks += $release.'sdks' | Where-Object { !$_.'version'.Contains('-') -and !$_.'version'.Equals($release.'sdk'.'version') } + $sdks = $sdks | Sort-Object { [Version] $_.'version' } + + ForEach ($sdk in $sdks) + { + InstallSDKVersion -sdkVersion $sdk.'version' + } + } + elseif (!$release.'sdk'.'version'.Contains('-')) + { + $sdkVersion = $release.'sdk'.'version' + InstallSDKVersion -sdkVersion $sdkVersion + } + } + } +} + +function RunPostInstallationSteps() +{ + Add-MachinePathItem "C:\Program Files\dotnet" + # Run script at startup for all users + $cmdDotNetPath = @" +@echo off +SETX PATH "%USERPROFILE%\.dotnet\tools;%PATH%" +"@ + + $cmdPath = "C:\Program Files\dotnet\userpath.bat" + $cmdDotNetPath | Out-File -Encoding ascii -FilePath $cmdPath + + # Update Run key to run a script at logon + Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "DOTNETUSERPATH" -Value $cmdPath +} + +InstallAllValidSdks +RunPostInstallationSteps diff --git a/images/win/scripts/Installers/Install-Firefox.ps1 b/images/win/scripts/Installers/Install-Firefox.ps1 index 4493beaf0..560c7148e 100644 --- a/images/win/scripts/Installers/Install-Firefox.ps1 +++ b/images/win/scripts/Installers/Install-Firefox.ps1 @@ -1,20 +1,20 @@ -################################################################################ -## File: Install-Firefox.ps1 -## Desc: Install Mozilla Firefox -################################################################################ - -Import-Module -Name ImageHelpers -Force - -$temp_install_dir = 'C:\Windows\Installer' -New-Item -Path $temp_install_dir -ItemType Directory -Force - -Install-EXE -Url "https://seleniumwebdrivers.blob.core.windows.net/knownfirefoxversion/FirefoxSetup.exe" -Name "FirefoxSetup.exe" -ArgumentList "-ms" - -$path = '{0}\Program Files\Mozilla Firefox\' -f $env:SystemDrive; -New-Item -path $path -Name 'mozilla.cfg' -Value '// -pref("browser.shell.checkDefaultBrowser", false); -pref("app.update.enabled", false);' -ItemType file -force - -$path = '{0}\Program Files\Mozilla Firefox\defaults\pref\' -f $env:SystemDrive; -New-Item -path $path -Name 'local-settings.js' -Value 'pref("general.config.obscure_value", 0); -pref("general.config.filename", "mozilla.cfg");' -ItemType file -force +################################################################################ +## File: Install-Firefox.ps1 +## Desc: Install Mozilla Firefox +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$temp_install_dir = 'C:\Windows\Installer' +New-Item -Path $temp_install_dir -ItemType Directory -Force + +Install-EXE -Url "https://seleniumwebdrivers.blob.core.windows.net/knownfirefoxversion/FirefoxSetup.exe" -Name "FirefoxSetup.exe" -ArgumentList "-ms" + +$path = '{0}\Program Files\Mozilla Firefox\' -f $env:SystemDrive; +New-Item -path $path -Name 'mozilla.cfg' -Value '// +pref("browser.shell.checkDefaultBrowser", false); +pref("app.update.enabled", false);' -ItemType file -force + +$path = '{0}\Program Files\Mozilla Firefox\defaults\pref\' -f $env:SystemDrive; +New-Item -path $path -Name 'local-settings.js' -Value 'pref("general.config.obscure_value", 0); +pref("general.config.filename", "mozilla.cfg");' -ItemType file -force diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index 39cc5c6d2..f8d2a2e7c 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -1,18 +1,18 @@ -################################################################################ -## File: Install-Git.ps1 -## Desc: Install Git for Windows -################################################################################ - -Import-Module -Name ImageHelpers - -# Install the latest version of Git which is bundled with Git LFS. -# See https://chocolatey.org/packages/git -choco install git -y --package-parameters="/GitAndUnixToolsOnPath /WindowsTerminal /NoShellIntegration" - -# Disable GCM machine-wide -[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine) - -Add-MachinePathItem "C:\Program Files\Git\mingw64\bin" -Add-MachinePathItem "C:\Program Files\Git\usr\bin" -Add-MachinePathItem "C:\Program Files\Git\bin" -exit 0 +################################################################################ +## File: Install-Git.ps1 +## Desc: Install Git for Windows +################################################################################ + +Import-Module -Name ImageHelpers + +# Install the latest version of Git which is bundled with Git LFS. +# See https://chocolatey.org/packages/git +choco install git -y --package-parameters="/GitAndUnixToolsOnPath /WindowsTerminal /NoShellIntegration" + +# Disable GCM machine-wide +[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine) + +Add-MachinePathItem "C:\Program Files\Git\mingw64\bin" +Add-MachinePathItem "C:\Program Files\Git\usr\bin" +Add-MachinePathItem "C:\Program Files\Git\bin" +exit 0 diff --git a/images/win/scripts/Installers/Install-GitVersion.ps1 b/images/win/scripts/Installers/Install-GitVersion.ps1 index a02e1b8cb..b97358e0c 100644 --- a/images/win/scripts/Installers/Install-GitVersion.ps1 +++ b/images/win/scripts/Installers/Install-GitVersion.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-GitVersion.ps1 -## Desc: Install GitVersion -################################################################################ - -choco install gitversion.portable -y +################################################################################ +## File: Install-GitVersion.ps1 +## Desc: Install GitVersion +################################################################################ + +choco install gitversion.portable -y diff --git a/images/win/scripts/Installers/Install-Go.ps1 b/images/win/scripts/Installers/Install-Go.ps1 index 63250e34c..c33baeca4 100644 --- a/images/win/scripts/Installers/Install-Go.ps1 +++ b/images/win/scripts/Installers/Install-Go.ps1 @@ -1,71 +1,71 @@ -################################################################################ -## File: Install-Go.ps1 -## Desc: Install Go -################################################################################ - -Import-Module -Name ImageHelpers -Force - -function Install-GoVersion -{ - Param - ( - [String]$goVersion, - [Switch]$addToDefaultPath - ) - - # Download the Go zip archive. - Write-Host "Downloading Go $goVersion..." - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -UseBasicParsing -Uri "https://dl.google.com/go/go$goVersion.windows-amd64.zip" -OutFile go$goVersion.windows-amd64.zip - - # Extract the zip archive. It contains a single directory named "go". - Write-Host "Extracting Go $goVersion..." - Expand-Archive -Path go$goVersion.windows-amd64.zip -DestinationPath "C:\" -Force - - # Delete unnecessary files to conserve space - Write-Host "Cleaning directories of Go $goVersion..." - if (Test-Path "C:\go\doc") - { - Remove-Item -Recurse -Force "C:\go\doc" - } - if (Test-Path "C:\go\blog") - { - Remove-Item -Recurse -Force "C:\go\blog" - } - - # Rename the extracted "go" directory to include the Go version number (to support side-by-side versions of Go). - $newDirName = "Go$goVersion" - Rename-Item -path "C:\go" -newName $newDirName - - # Delete the Go zip archive. - Write-Host "Deleting downloaded archive of Go $goVersion..." - Remove-Item go$goVersion.windows-a`md64.zip - - # Make this the default version of Go? - if ($addToDefaultPath) - { - Write-Host "Adding Go $goVersion to the path..." - # Add the Go binaries to the path. - Add-MachinePathItem "C:\$newDirName\bin" | Out-Null - # Set the GOROOT environment variable. - setx GOROOT "C:\$newDirName" /M | Out-Null - } - - # Done - Write-Host "Done installing Go $goVersion." - return "C:\$newDirName" -} - -# Install Go -$goVersionsToInstall = $env:GO_VERSIONS.split(",") - -foreach($go in $goVersionsToInstall) { - Write-Host "Installing Go ${go}" - if($go -eq $env:GO_DEFAULT) { - $installDirectory = Install-GoVersion -goVersion $go -addToDefaultPath - } else { - $installDirectory = Install-GoVersion -goVersion $go - } - $envName = "GOROOT_{0}_{1}_X64" -f $go.split(".") - setx $envName "$installDirectory" /M -} +################################################################################ +## File: Install-Go.ps1 +## Desc: Install Go +################################################################################ + +Import-Module -Name ImageHelpers -Force + +function Install-GoVersion +{ + Param + ( + [String]$goVersion, + [Switch]$addToDefaultPath + ) + + # Download the Go zip archive. + Write-Host "Downloading Go $goVersion..." + $ProgressPreference = 'SilentlyContinue' + Invoke-WebRequest -UseBasicParsing -Uri "https://dl.google.com/go/go$goVersion.windows-amd64.zip" -OutFile go$goVersion.windows-amd64.zip + + # Extract the zip archive. It contains a single directory named "go". + Write-Host "Extracting Go $goVersion..." + Expand-Archive -Path go$goVersion.windows-amd64.zip -DestinationPath "C:\" -Force + + # Delete unnecessary files to conserve space + Write-Host "Cleaning directories of Go $goVersion..." + if (Test-Path "C:\go\doc") + { + Remove-Item -Recurse -Force "C:\go\doc" + } + if (Test-Path "C:\go\blog") + { + Remove-Item -Recurse -Force "C:\go\blog" + } + + # Rename the extracted "go" directory to include the Go version number (to support side-by-side versions of Go). + $newDirName = "Go$goVersion" + Rename-Item -path "C:\go" -newName $newDirName + + # Delete the Go zip archive. + Write-Host "Deleting downloaded archive of Go $goVersion..." + Remove-Item go$goVersion.windows-a`md64.zip + + # Make this the default version of Go? + if ($addToDefaultPath) + { + Write-Host "Adding Go $goVersion to the path..." + # Add the Go binaries to the path. + Add-MachinePathItem "C:\$newDirName\bin" | Out-Null + # Set the GOROOT environment variable. + setx GOROOT "C:\$newDirName" /M | Out-Null + } + + # Done + Write-Host "Done installing Go $goVersion." + return "C:\$newDirName" +} + +# Install Go +$goVersionsToInstall = $env:GO_VERSIONS.split(",") + +foreach($go in $goVersionsToInstall) { + Write-Host "Installing Go ${go}" + if($go -eq $env:GO_DEFAULT) { + $installDirectory = Install-GoVersion -goVersion $go -addToDefaultPath + } else { + $installDirectory = Install-GoVersion -goVersion $go + } + $envName = "GOROOT_{0}_{1}_X64" -f $go.split(".") + setx $envName "$installDirectory" /M +} diff --git a/images/win/scripts/Installers/Install-InnoSetup.ps1 b/images/win/scripts/Installers/Install-InnoSetup.ps1 index 35f0156f4..8020120d1 100644 --- a/images/win/scripts/Installers/Install-InnoSetup.ps1 +++ b/images/win/scripts/Installers/Install-InnoSetup.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-InnoSetup.ps1 -## Desc: Install Inno Setup -################################################################################ - -choco install innosetup -y +################################################################################ +## File: Install-InnoSetup.ps1 +## Desc: Install Inno Setup +################################################################################ + +choco install innosetup -y diff --git a/images/win/scripts/Installers/Install-JavaTools.ps1 b/images/win/scripts/Installers/Install-JavaTools.ps1 index d86f42c7b..7b8cdd135 100644 --- a/images/win/scripts/Installers/Install-JavaTools.ps1 +++ b/images/win/scripts/Installers/Install-JavaTools.ps1 @@ -1,98 +1,98 @@ -################################################################################ -## File: Install-JavaTools.ps1 -## Desc: Install various JDKs and java tools -################################################################################ - -# Download the Azul Systems Zulu JDKs -# See https://www.azul.com/downloads/azure-only/zulu/ -$azulJDK7Uri = 'https://repos.azul.com/azure-only/zulu/packages/zulu-7/7u232/zulu-7-azure-jdk_7.31.0.5-7.0.232-win_x64.zip' -$azulJDK8Uri = 'https://repos.azul.com/azure-only/zulu/packages/zulu-8/8u222/zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64.zip' -$azulJDK11Uri = 'https://repos.azul.com/azure-only/zulu/packages/zulu-11/11.0.4/zulu-11-azure-jdk_11.33.15-11.0.4-win_x64.zip' - -cd $env:TEMP - -Invoke-WebRequest -UseBasicParsing -Uri $azulJDK7Uri -OutFile azulJDK7.zip -Invoke-WebRequest -UseBasicParsing -Uri $azulJDK8Uri -OutFile azulJDK8.zip -Invoke-WebRequest -UseBasicParsing -Uri $azulJDK11Uri -OutFile azulJDK11.zip - -# Expand the zips -Expand-Archive -Path azulJDK7.zip -DestinationPath "C:\Program Files\Java\" -Force -Expand-Archive -Path azulJDK8.zip -DestinationPath "C:\Program Files\Java\" -Force -Expand-Archive -Path azulJDK11.zip -DestinationPath "C:\Program Files\Java\" -Force - -# Deleting zip folders -Remove-Item -Recurse -Force azulJDK7.zip -Remove-Item -Recurse -Force azulJDK8.zip -Remove-Item -Recurse -Force azulJDK11.zip - -Import-Module -Name ImageHelpers -Force - -$currentPath = Get-MachinePath - -$pathSegments = $currentPath.Split(';') -$newPathSegments = @() - -foreach ($pathSegment in $pathSegments) -{ - if($pathSegment -notlike '*java*') - { - $newPathSegments += $pathSegment - } -} - -$java7Installs = Get-ChildItem -Path 'C:\Program Files\Java' -Filter '*azure-jdk*7*' | Sort-Object -Property Name -Descending | Select-Object -First 1 -$latestJava7Install = $java7Installs.FullName; - -$java8Installs = Get-ChildItem -Path 'C:\Program Files\Java' -Filter '*azure-jdk*8*' | Sort-Object -Property Name -Descending | Select-Object -First 1 -$latestJava8Install = $java8Installs.FullName; - -$java11Installs = Get-ChildItem -Path 'C:\Program Files\Java' -Filter '*azure-jdk*11*' | Sort-Object -Property Name -Descending | Select-Object -First 1 -$latestJava11Install = $java11Installs.FullName; - -$newPath = [string]::Join(';', $newPathSegments) -$newPath = $latestJava8Install + '\bin;' + $newPath - -Set-MachinePath -NewPath $newPath - -setx JAVA_HOME $latestJava8Install /M -setx JAVA_HOME_7_X64 $latestJava7Install /M -setx JAVA_HOME_8_X64 $latestJava8Install /M -setx JAVA_HOME_11_X64 $latestJava11Install /M - -# Install Java tools -# Force chocolatey to ignore dependencies on Ant and Maven or else they will download the Oracle JDK -choco install ant -y -i -choco install maven -y -i --version=3.6.2 -choco install gradle -y - -# Move maven variables to Machine. They may not be in the environment for this script so we need to read them from the registry. -$userSid = (Get-WmiObject win32_useraccount -Filter "name = '$env:USERNAME' AND domain = '$env:USERDOMAIN'").SID -$userEnvironmentKey = 'Registry::HKEY_USERS\' + $userSid + '\Environment' - -$m2_home = (Get-ItemProperty -Path $userEnvironmentKey -Name M2_HOME).M2_HOME -$m2 = $m2_home + '\bin' -$maven_opts = '-Xms256m' - -$m2_repo = 'C:\ProgramData\m2' -New-Item -Path $m2_repo -ItemType Directory -Force - -setx M2 $m2 /M -setx M2_HOME $m2_home /M -setx M2_REPO $m2_repo /M -setx MAVEN_OPTS $maven_opts /M - -# Download cobertura jars -$uri = 'https://ayera.dl.sourceforge.net/project/cobertura/cobertura/2.1.1/cobertura-2.1.1-bin.zip' -$coberturaPath = "C:\cobertura-2.1.1" - -cd $env:TEMP - -Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile cobertura.zip - -# Expand the zip -Expand-Archive -Path cobertura.zip -DestinationPath "C:\" -Force - -# Deleting zip folder -Remove-Item -Recurse -Force cobertura.zip - -setx COBERTURA_HOME $coberturaPath /M +################################################################################ +## File: Install-JavaTools.ps1 +## Desc: Install various JDKs and java tools +################################################################################ + +# Download the Azul Systems Zulu JDKs +# See https://www.azul.com/downloads/azure-only/zulu/ +$azulJDK7Uri = 'https://repos.azul.com/azure-only/zulu/packages/zulu-7/7u232/zulu-7-azure-jdk_7.31.0.5-7.0.232-win_x64.zip' +$azulJDK8Uri = 'https://repos.azul.com/azure-only/zulu/packages/zulu-8/8u222/zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64.zip' +$azulJDK11Uri = 'https://repos.azul.com/azure-only/zulu/packages/zulu-11/11.0.4/zulu-11-azure-jdk_11.33.15-11.0.4-win_x64.zip' + +cd $env:TEMP + +Invoke-WebRequest -UseBasicParsing -Uri $azulJDK7Uri -OutFile azulJDK7.zip +Invoke-WebRequest -UseBasicParsing -Uri $azulJDK8Uri -OutFile azulJDK8.zip +Invoke-WebRequest -UseBasicParsing -Uri $azulJDK11Uri -OutFile azulJDK11.zip + +# Expand the zips +Expand-Archive -Path azulJDK7.zip -DestinationPath "C:\Program Files\Java\" -Force +Expand-Archive -Path azulJDK8.zip -DestinationPath "C:\Program Files\Java\" -Force +Expand-Archive -Path azulJDK11.zip -DestinationPath "C:\Program Files\Java\" -Force + +# Deleting zip folders +Remove-Item -Recurse -Force azulJDK7.zip +Remove-Item -Recurse -Force azulJDK8.zip +Remove-Item -Recurse -Force azulJDK11.zip + +Import-Module -Name ImageHelpers -Force + +$currentPath = Get-MachinePath + +$pathSegments = $currentPath.Split(';') +$newPathSegments = @() + +foreach ($pathSegment in $pathSegments) +{ + if($pathSegment -notlike '*java*') + { + $newPathSegments += $pathSegment + } +} + +$java7Installs = Get-ChildItem -Path 'C:\Program Files\Java' -Filter '*azure-jdk*7*' | Sort-Object -Property Name -Descending | Select-Object -First 1 +$latestJava7Install = $java7Installs.FullName; + +$java8Installs = Get-ChildItem -Path 'C:\Program Files\Java' -Filter '*azure-jdk*8*' | Sort-Object -Property Name -Descending | Select-Object -First 1 +$latestJava8Install = $java8Installs.FullName; + +$java11Installs = Get-ChildItem -Path 'C:\Program Files\Java' -Filter '*azure-jdk*11*' | Sort-Object -Property Name -Descending | Select-Object -First 1 +$latestJava11Install = $java11Installs.FullName; + +$newPath = [string]::Join(';', $newPathSegments) +$newPath = $latestJava8Install + '\bin;' + $newPath + +Set-MachinePath -NewPath $newPath + +setx JAVA_HOME $latestJava8Install /M +setx JAVA_HOME_7_X64 $latestJava7Install /M +setx JAVA_HOME_8_X64 $latestJava8Install /M +setx JAVA_HOME_11_X64 $latestJava11Install /M + +# Install Java tools +# Force chocolatey to ignore dependencies on Ant and Maven or else they will download the Oracle JDK +choco install ant -y -i +choco install maven -y -i --version=3.6.2 +choco install gradle -y + +# Move maven variables to Machine. They may not be in the environment for this script so we need to read them from the registry. +$userSid = (Get-WmiObject win32_useraccount -Filter "name = '$env:USERNAME' AND domain = '$env:USERDOMAIN'").SID +$userEnvironmentKey = 'Registry::HKEY_USERS\' + $userSid + '\Environment' + +$m2_home = (Get-ItemProperty -Path $userEnvironmentKey -Name M2_HOME).M2_HOME +$m2 = $m2_home + '\bin' +$maven_opts = '-Xms256m' + +$m2_repo = 'C:\ProgramData\m2' +New-Item -Path $m2_repo -ItemType Directory -Force + +setx M2 $m2 /M +setx M2_HOME $m2_home /M +setx M2_REPO $m2_repo /M +setx MAVEN_OPTS $maven_opts /M + +# Download cobertura jars +$uri = 'https://ayera.dl.sourceforge.net/project/cobertura/cobertura/2.1.1/cobertura-2.1.1-bin.zip' +$coberturaPath = "C:\cobertura-2.1.1" + +cd $env:TEMP + +Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile cobertura.zip + +# Expand the zip +Expand-Archive -Path cobertura.zip -DestinationPath "C:\" -Force + +# Deleting zip folder +Remove-Item -Recurse -Force cobertura.zip + +setx COBERTURA_HOME $coberturaPath /M diff --git a/images/win/scripts/Installers/Install-Jq.ps1 b/images/win/scripts/Installers/Install-Jq.ps1 index 5a0af2e3d..1ccb42da8 100644 --- a/images/win/scripts/Installers/Install-Jq.ps1 +++ b/images/win/scripts/Installers/Install-Jq.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-Jq.ps1 -## Desc: Install jq -################################################################################ - -choco install jq -y +################################################################################ +## File: Install-Jq.ps1 +## Desc: Install jq +################################################################################ + +choco install jq -y diff --git a/images/win/scripts/Installers/Install-Kind.ps1 b/images/win/scripts/Installers/Install-Kind.ps1 index 794a6d9a8..1c0339099 100644 --- a/images/win/scripts/Installers/Install-Kind.ps1 +++ b/images/win/scripts/Installers/Install-Kind.ps1 @@ -1,40 +1,40 @@ -################################################################################ -## File: Install-Kind.ps1 -## Desc: Install Kind -################################################################################ - -$stableKindTag = "v0.5.1" -$tagToUse = $stableKindTag; -$destFilePath = "C:\ProgramData\kind" -$outFilePath = "C:\ProgramData\kind\kind.exe" - -try -{ - $getkindUri = "https://github.com/kubernetes-sigs/kind/releases/download/$tagToUse/kind-windows-amd64" - Write-Host "Downloading kind.exe..." - New-Item -Path $destFilePath -ItemType Directory -Force - - Invoke-WebRequest -Uri $getkindUri -OutFile $outFilePath - - Write-Host "Starting Install kind.exe..." - $process = Start-Process -FilePath $outFilePath -Wait -PassThru - $exitCode = $process.ExitCode - - if ($exitCode -eq 0 -or $exitCode -eq 3010) - { - Write-Host -Object 'Installation successful' - Add-MachinePathItem $destFilePath - exit $exitCode - } - else - { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - exit $exitCode - } -} -catch -{ - Write-Host -Object "Failed to install the Executable kind.exe" - Write-Host -Object $_.Exception.Message - exit -1 -} +################################################################################ +## File: Install-Kind.ps1 +## Desc: Install Kind +################################################################################ + +$stableKindTag = "v0.5.1" +$tagToUse = $stableKindTag; +$destFilePath = "C:\ProgramData\kind" +$outFilePath = "C:\ProgramData\kind\kind.exe" + +try +{ + $getkindUri = "https://github.com/kubernetes-sigs/kind/releases/download/$tagToUse/kind-windows-amd64" + Write-Host "Downloading kind.exe..." + New-Item -Path $destFilePath -ItemType Directory -Force + + Invoke-WebRequest -Uri $getkindUri -OutFile $outFilePath + + Write-Host "Starting Install kind.exe..." + $process = Start-Process -FilePath $outFilePath -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + Add-MachinePathItem $destFilePath + exit $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + exit $exitCode + } +} +catch +{ + Write-Host -Object "Failed to install the Executable kind.exe" + Write-Host -Object $_.Exception.Message + exit -1 +} diff --git a/images/win/scripts/Installers/Install-KubernetesCli.ps1 b/images/win/scripts/Installers/Install-KubernetesCli.ps1 index d96c7d798..8c7350c0f 100644 --- a/images/win/scripts/Installers/Install-KubernetesCli.ps1 +++ b/images/win/scripts/Installers/Install-KubernetesCli.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-KubernetesCli.ps1 -## Desc: Install KubernetesCli -################################################################################ - -choco install kubernetes-cli -y +################################################################################ +## File: Install-KubernetesCli.ps1 +## Desc: Install KubernetesCli +################################################################################ + +choco install kubernetes-cli -y diff --git a/images/win/scripts/Installers/Install-Mercurial.ps1 b/images/win/scripts/Installers/Install-Mercurial.ps1 index 9f21d97a6..65a5cdefa 100644 --- a/images/win/scripts/Installers/Install-Mercurial.ps1 +++ b/images/win/scripts/Installers/Install-Mercurial.ps1 @@ -1,10 +1,10 @@ -################################################################################ -## File: Install-Mercurial.ps1 -## Desc: Install Mercurial -################################################################################ - -choco install hg -y --version 5.0.0 - -$hgPath = "${env:ProgramFiles}\Mercurial\" -Add-MachinePathItem $hgPath -$env:Path = Get-MachinePath +################################################################################ +## File: Install-Mercurial.ps1 +## Desc: Install Mercurial +################################################################################ + +choco install hg -y --version 5.0.0 + +$hgPath = "${env:ProgramFiles}\Mercurial\" +Add-MachinePathItem $hgPath +$env:Path = Get-MachinePath diff --git a/images/win/scripts/Installers/Install-MinGW.ps1 b/images/win/scripts/Installers/Install-MinGW.ps1 index 5e73d0592..fe97ddde7 100644 --- a/images/win/scripts/Installers/Install-MinGW.ps1 +++ b/images/win/scripts/Installers/Install-MinGW.ps1 @@ -1,13 +1,13 @@ -################################################################################ -## File: Install-MinGW.ps1 -## Desc: Install GNU tools for Windows to C:\tools\mingw64 -################################################################################ - -Import-Module -Name ImageHelpers -Force - -choco install -y mingw - -# Make a copy of mingw32-make.exe to make.exe, which is a more discoverable name -# and so the same command line can be used on Windows as on macOS and Linux -$path = where.exe mingw32-make.exe | Get-Item -Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe') +################################################################################ +## File: Install-MinGW.ps1 +## Desc: Install GNU tools for Windows to C:\tools\mingw64 +################################################################################ + +Import-Module -Name ImageHelpers -Force + +choco install -y mingw + +# Make a copy of mingw32-make.exe to make.exe, which is a more discoverable name +# and so the same command line can be used on Windows as on macOS and Linux +$path = where.exe mingw32-make.exe | Get-Item +Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe') diff --git a/images/win/scripts/Installers/Install-Miniconda.ps1 b/images/win/scripts/Installers/Install-Miniconda.ps1 index 14c5df76c..55e9f4831 100644 --- a/images/win/scripts/Installers/Install-Miniconda.ps1 +++ b/images/win/scripts/Installers/Install-Miniconda.ps1 @@ -1,16 +1,16 @@ -################################################################################ -## File: Install-Miniconda.ps1 -## Desc: Install the latest version of Miniconda and set $env:CONDA -################################################################################ - -Import-Module -Name ImageHelpers -Force - -# Lock to Miniconda 4.6 until we do the work to run `conda init` for the vsts user -# Then we can go back to installing the latest Miniconda -# $url = "https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe" -$url = "https://repo.continuum.io/miniconda/Miniconda3-4.6.14-Windows-x86_64.exe" -$name = $Url.Split('/')[-1] -$destination = "C:\Miniconda" - -Install-EXE -Url $url -Name $name -ArgumentList "/S /AddToPath=0 /RegisterPython=0 /D=$destination" -Set-SystemVariable -SystemVariable "CONDA" -Value $destination +################################################################################ +## File: Install-Miniconda.ps1 +## Desc: Install the latest version of Miniconda and set $env:CONDA +################################################################################ + +Import-Module -Name ImageHelpers -Force + +# Lock to Miniconda 4.6 until we do the work to run `conda init` for the vsts user +# Then we can go back to installing the latest Miniconda +# $url = "https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe" +$url = "https://repo.continuum.io/miniconda/Miniconda3-4.6.14-Windows-x86_64.exe" +$name = $Url.Split('/')[-1] +$destination = "C:\Miniconda" + +Install-EXE -Url $url -Name $name -ArgumentList "/S /AddToPath=0 /RegisterPython=0 /D=$destination" +Set-SystemVariable -SystemVariable "CONDA" -Value $destination diff --git a/images/win/scripts/Installers/Install-MysqlCli.ps1 b/images/win/scripts/Installers/Install-MysqlCli.ps1 index e3507581b..76930d6e3 100644 --- a/images/win/scripts/Installers/Install-MysqlCli.ps1 +++ b/images/win/scripts/Installers/Install-MysqlCli.ps1 @@ -1,39 +1,39 @@ -################################################################################ -## File: Install-MysqlCli.ps1 -## Desc: Install Mysql CLI -################################################################################ - - -## Downloading mysql jar -$uri = 'https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-winx64.zip' -$mysqlPath = 'C:\mysql-5.7.21-winx64\bin' - -# Installing visual c++ redistibutable package. -$InstallerURI = 'https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x64.exe' -$InstallerName = 'vcredist_x64.exe' -$ArgumentList = ('/install', '/quiet', '/norestart' ) - -$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList -if ($exitCode -eq 0 -or $exitCode -eq 3010) -{ - # MySQL disabled TLS 1.0 support on or about Jul-14-2018. Need to make sure TLS 1.2 is enabled. - [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" - - # Get the latest mysql command line tools . - Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile mysql.zip - - # Expand the zip - Expand-Archive -Path mysql.zip -DestinationPath "C:\" -Force - - # Deleting zip folder - Remove-Item -Recurse -Force mysql.zip - - # Adding mysql in system environment path - Add-MachinePathItem $mysqlPath - - return 0; -} -else -{ - return $exitCode; -} +################################################################################ +## File: Install-MysqlCli.ps1 +## Desc: Install Mysql CLI +################################################################################ + + +## Downloading mysql jar +$uri = 'https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-winx64.zip' +$mysqlPath = 'C:\mysql-5.7.21-winx64\bin' + +# Installing visual c++ redistibutable package. +$InstallerURI = 'https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x64.exe' +$InstallerName = 'vcredist_x64.exe' +$ArgumentList = ('/install', '/quiet', '/norestart' ) + +$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList +if ($exitCode -eq 0 -or $exitCode -eq 3010) +{ + # MySQL disabled TLS 1.0 support on or about Jul-14-2018. Need to make sure TLS 1.2 is enabled. + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" + + # Get the latest mysql command line tools . + Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile mysql.zip + + # Expand the zip + Expand-Archive -Path mysql.zip -DestinationPath "C:\" -Force + + # Deleting zip folder + Remove-Item -Recurse -Force mysql.zip + + # Adding mysql in system environment path + Add-MachinePathItem $mysqlPath + + return 0; +} +else +{ + return $exitCode; +} diff --git a/images/win/scripts/Installers/Install-NET472.ps1 b/images/win/scripts/Installers/Install-NET472.ps1 new file mode 100644 index 000000000..3cdb1fa11 --- /dev/null +++ b/images/win/scripts/Installers/Install-NET472.ps1 @@ -0,0 +1,13 @@ +################################################################################ +## File: Install-NET472.ps1 +## Desc: Install .NET 4.7.2 +################################################################################ + +Import-Module -Name ImageHelpers -Force + +# .NET 4.7.2 Dev pack +$InstallerURI = "https://download.microsoft.com/download/3/B/F/3BFB9C35-405D-45DF-BDAF-0EB57D047888/NDP472-DevPack-ENU.exe" +$InstallerName = "NDP472-DevPack-ENU.exe" +$ArgumentList = ('Setup', '/passive', '/norestart' ) + +Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList diff --git a/images/win/scripts/Installers/Install-NET48.ps1 b/images/win/scripts/Installers/Install-NET48.ps1 index 7b6b1e09e..0539a7c28 100644 --- a/images/win/scripts/Installers/Install-NET48.ps1 +++ b/images/win/scripts/Installers/Install-NET48.ps1 @@ -1,13 +1,13 @@ -################################################################################ -## File: Install-NET48.ps1 -## Desc: Install .NET 4.8 -################################################################################ - -Import-Module -Name ImageHelpers -Force - -# .NET 4.8 Dev pack -$InstallerURI = "https://download.visualstudio.microsoft.com/download/pr/014120d7-d689-4305-befd-3cb711108212/0307177e14752e359fde5423ab583e43/ndp48-devpack-enu.exe" -$InstallerName = "NDP48-DevPack-ENU.exe" -$ArgumentList = ('Setup', '/passive', '/norestart' ) - -Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList +################################################################################ +## File: Install-NET48.ps1 +## Desc: Install .NET 4.8 +################################################################################ + +Import-Module -Name ImageHelpers -Force + +# .NET 4.8 Dev pack +$InstallerURI = "https://download.visualstudio.microsoft.com/download/pr/7afca223-55d2-470a-8edc-6a1739ae3252/c8c829444416e811be84c5765ede6148/NDP48-DevPack-ENU.exe" +$InstallerName = "NDP48-DevPack-ENU.exe" +$ArgumentList = ('Setup', '/passive', '/norestart' ) + +Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList diff --git a/images/win/scripts/Installers/Install-NSIS.ps1 b/images/win/scripts/Installers/Install-NSIS.ps1 index 6da7cb738..c8c5e370e 100644 --- a/images/win/scripts/Installers/Install-NSIS.ps1 +++ b/images/win/scripts/Installers/Install-NSIS.ps1 @@ -1,10 +1,10 @@ -################################################################################ -## File: Install-NSIS.ps1 -## Desc: Install NSIS -################################################################################ - -choco install nsis -y - -$NsisPath = "${env:ProgramFiles(x86)}\NSIS\" -Add-MachinePathItem $NsisPath -$env:Path = Get-MachinePath +################################################################################ +## File: Install-NSIS.ps1 +## Desc: Install NSIS +################################################################################ + +choco install nsis -y + +$NsisPath = "${env:ProgramFiles(x86)}\NSIS\" +Add-MachinePathItem $NsisPath +$env:Path = Get-MachinePath diff --git a/images/win/scripts/Installers/Install-NodeLts.ps1 b/images/win/scripts/Installers/Install-NodeLts.ps1 index 9318b73b1..2490cdfe5 100644 --- a/images/win/scripts/Installers/Install-NodeLts.ps1 +++ b/images/win/scripts/Installers/Install-NodeLts.ps1 @@ -1,34 +1,33 @@ -################################################################################ -## File: Install-NodeLts.ps1 -## Desc: Install nodejs-lts and other common node tools. -## Must run after python is configured -################################################################################ - -Import-Module -Name ImageHelpers -Force - -$PrefixPath = 'C:\npm\prefix' -$CachePath = 'C:\npm\cache' - -New-Item -Path $PrefixPath -Force -ItemType Directory -New-Item -Path $CachePath -Force -ItemType Directory - -choco install nodejs-lts -y --force - -Add-MachinePathItem $PrefixPath -$env:Path = Get-MachinePath - -setx NPM_CONFIG_PREFIX $PrefixPath /M -$env:NPM_CONFIG_PREFIX = $PrefixPath - -setx NPM_CONFIG_CACHE $CachePath /M -$env:NPM_CONFIG_CACHE = $CachePath - -npm config set registry http://registry.npmjs.org/ - -npm install -g bower -npm install -g cordova -npm install -g grunt-cli -npm install -g gulp-cli -npm install -g parcel-bundler -npm install -g --save-dev webpack webpack-cli -npm install -g yarn +################################################################################ +## File: Install-NodeLts.ps1 +## Desc: Install nodejs-lts and other common node tools. +## Must run after python is configured +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$PrefixPath = 'C:\npm\prefix' +$CachePath = 'C:\npm\cache' + +New-Item -Path $PrefixPath -Force -ItemType Directory +New-Item -Path $CachePath -Force -ItemType Directory + +choco install nodejs-lts -y --force + +Add-MachinePathItem $PrefixPath +$env:Path = Get-MachinePath + +setx NPM_CONFIG_PREFIX $PrefixPath /M +$env:NPM_CONFIG_PREFIX = $PrefixPath + +setx NPM_CONFIG_CACHE $CachePath /M +$env:NPM_CONFIG_CACHE = $CachePath + +npm config set registry http://registry.npmjs.org/ + +npm install -g cordova +npm install -g grunt-cli +npm install -g gulp-cli +npm install -g parcel-bundler +npm install -g --save-dev webpack webpack-cli +npm install -g yarn diff --git a/images/win/scripts/Installers/Install-OpenSSL.ps1 b/images/win/scripts/Installers/Install-OpenSSL.ps1 index 43cb28f9b..5ff783398 100644 --- a/images/win/scripts/Installers/Install-OpenSSL.ps1 +++ b/images/win/scripts/Installers/Install-OpenSSL.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-OpenSSL.ps1 -## Desc: Install OpenSSL -################################################################################ - -choco install openssl.light -y +################################################################################ +## File: Install-OpenSSL.ps1 +## Desc: Install OpenSSL +################################################################################ + +choco install openssl.light -y diff --git a/images/win/scripts/Installers/Install-PHP.ps1 b/images/win/scripts/Installers/Install-PHP.ps1 index 6221b022e..02d38931d 100644 --- a/images/win/scripts/Installers/Install-PHP.ps1 +++ b/images/win/scripts/Installers/Install-PHP.ps1 @@ -1,20 +1,20 @@ -################################################################################ -## File: Install-PHP.ps1 -## Desc: Install PHP -################################################################################ -$ErrorActionPreference = "Stop" - -Import-Module -Name ImageHelpers - -# Install latest PHP in chocolatey -$installDir = "c:\tools\php" -choco install php -y --force --params "/InstallDir:$installDir" - -# update path to extensions and enable curl and mbstring extensions -((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"') | Set-Content -Path $installDir\php.ini - -# Set the PHPROOT environment variable. -setx PHPROOT $installDir /M - -# Done -exit 0 +################################################################################ +## File: Install-PHP.ps1 +## Desc: Install PHP +################################################################################ +$ErrorActionPreference = "Stop" + +Import-Module -Name ImageHelpers + +# Install latest PHP in chocolatey +$installDir = "c:\tools\php" +choco install php -y --force --params "/InstallDir:$installDir" + +# update path to extensions and enable curl and mbstring extensions +((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"') | Set-Content -Path $installDir\php.ini + +# Set the PHPROOT environment variable. +setx PHPROOT $installDir /M + +# Done +exit 0 diff --git a/images/win/scripts/Installers/Install-Perl.ps1 b/images/win/scripts/Installers/Install-Perl.ps1 index 86f2d2902..59b1e11a0 100644 --- a/images/win/scripts/Installers/Install-Perl.ps1 +++ b/images/win/scripts/Installers/Install-Perl.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-Perl.ps1 -## Desc: Install Perl -################################################################################ - -choco install strawberryperl -y +################################################################################ +## File: Install-Perl.ps1 +## Desc: Install Perl +################################################################################ + +choco install strawberryperl -y diff --git a/images/win/scripts/Installers/Install-PowershellCore.ps1 b/images/win/scripts/Installers/Install-PowershellCore.ps1 index 1fc757081..77e446583 100644 --- a/images/win/scripts/Installers/Install-PowershellCore.ps1 +++ b/images/win/scripts/Installers/Install-PowershellCore.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-PowershellCore.ps1 -## Desc: Install PowerShell Core -################################################################################ - -Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet" +################################################################################ +## File: Install-PowershellCore.ps1 +## Desc: Install PowerShell Core +################################################################################ + +Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet" diff --git a/images/win/scripts/Installers/Install-Ruby.ps1 b/images/win/scripts/Installers/Install-Ruby.ps1 index 184d92afa..72ad04309 100644 --- a/images/win/scripts/Installers/Install-Ruby.ps1 +++ b/images/win/scripts/Installers/Install-Ruby.ps1 @@ -1,20 +1,20 @@ -################################################################################ -## File: Install-Ruby.ps1 -## Desc: Install Ruby for Windows -################################################################################ - -Import-Module -Name ImageHelpers - -# Ruby versions are already available in the tool cache. - -# Tool cache Ruby Path -$toolcacheRubyPath = 'C:\hostedtoolcache\windows\Ruby\2.5.*' - -# Get Latest Ruby 2.5.x -$latestRubyBinPath2_5 = Get-ChildItem -Path $toolcacheRubyPath | Sort-Object {[System.Version]$_.Name} | Select-Object -Last 1 | ForEach-Object { - Join-Path $_.FullName 'x64\bin' -} - -Add-MachinePathItem $latestRubyBinPath2_5 -$env:Path = Get-MachinePath -exit 0 +################################################################################ +## File: Install-Ruby.ps1 +## Desc: Install Ruby for Windows +################################################################################ + +Import-Module -Name ImageHelpers + +# Ruby versions are already available in the tool cache. + +# Tool cache Ruby Path +$toolcacheRubyPath = 'C:\hostedtoolcache\windows\Ruby\2.5.*' + +# Get Latest Ruby 2.5.x +$latestRubyBinPath2_5 = Get-ChildItem -Path $toolcacheRubyPath | Sort-Object {[System.Version]$_.Name} | Select-Object -Last 1 | ForEach-Object { + Join-Path $_.FullName 'x64\bin' +} + +Add-MachinePathItem $latestRubyBinPath2_5 +$env:Path = Get-MachinePath +exit 0 diff --git a/images/win/scripts/Installers/Install-Rust.ps1 b/images/win/scripts/Installers/Install-Rust.ps1 index fd58801df..e19cd4c14 100644 --- a/images/win/scripts/Installers/Install-Rust.ps1 +++ b/images/win/scripts/Installers/Install-Rust.ps1 @@ -1,53 +1,53 @@ -################################################################################ -## File: Install-Rust.ps1 -## Desc: Install Rust for Windows -################################################################################ - -Import-Module -Name ImageHelpers - -# Rust Env -$env:RUSTUP_HOME="C:\Rust\.rustup" -$env:CARGO_HOME="C:\Rust\.cargo" - -# Download the latest rustup-init.exe for Windows x64 -# See https://rustup.rs/# -Invoke-WebRequest -UseBasicParsing -Uri "https://win.rustup.rs/x86_64" -OutFile rustup-init.exe - -# Install Rust by running rustup-init.exe (disabling the confirmation prompt with -y) -.\rustup-init.exe -y - -# Delete rustup-init.exe when it's no longer needed -Remove-Item -Path .\rustup-init.exe - -# Add Rust binaries to the path -Add-MachinePathItem "$env:CARGO_HOME\bin" -$env:Path = Get-MachinePath - -# Install common tools -rustup component add rustfmt -rustup component add clippy -cargo install bindgen -cargo install cbindgen - -# Run script at startup for all users -$cmdRustSymScript = @" -@echo off - -if exist $env:CARGO_HOME ( - if not exist %USERPROFILE%\.cargo ( - mklink /J %USERPROFILE%\.cargo $env:CARGO_HOME - ) -) - -if exist $env:RUSTUP_HOME ( - if not exist %USERPROFILE%\.rustup ( - mklink /J %USERPROFILE%\.rustup $env:RUSTUP_HOME - ) -) -"@ - -$cmdPath = "C:\Rust\rustsym.bat" -$cmdRustSymScript | Out-File -Encoding ascii -FilePath $cmdPath - -# Update Run key to run a script at logon -Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "RUSTSYM" -Value $cmdPath +################################################################################ +## File: Install-Rust.ps1 +## Desc: Install Rust for Windows +################################################################################ + +Import-Module -Name ImageHelpers + +# Rust Env +$env:RUSTUP_HOME="C:\Rust\.rustup" +$env:CARGO_HOME="C:\Rust\.cargo" + +# Download the latest rustup-init.exe for Windows x64 +# See https://rustup.rs/# +Invoke-WebRequest -UseBasicParsing -Uri "https://win.rustup.rs/x86_64" -OutFile rustup-init.exe + +# Install Rust by running rustup-init.exe (disabling the confirmation prompt with -y) +.\rustup-init.exe -y + +# Delete rustup-init.exe when it's no longer needed +Remove-Item -Path .\rustup-init.exe + +# Add Rust binaries to the path +Add-MachinePathItem "$env:CARGO_HOME\bin" +$env:Path = Get-MachinePath + +# Install common tools +rustup component add rustfmt +rustup component add clippy +cargo install bindgen +cargo install cbindgen + +# Run script at startup for all users +$cmdRustSymScript = @" +@echo off + +if exist $env:CARGO_HOME ( + if not exist %USERPROFILE%\.cargo ( + mklink /J %USERPROFILE%\.cargo $env:CARGO_HOME + ) +) + +if exist $env:RUSTUP_HOME ( + if not exist %USERPROFILE%\.rustup ( + mklink /J %USERPROFILE%\.rustup $env:RUSTUP_HOME + ) +) +"@ + +$cmdPath = "C:\Rust\rustsym.bat" +$cmdRustSymScript | Out-File -Encoding ascii -FilePath $cmdPath + +# Update Run key to run a script at logon +Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "RUSTSYM" -Value $cmdPath diff --git a/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 b/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 index 470ee5ee3..bf330f690 100644 --- a/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 +++ b/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 @@ -1,61 +1,61 @@ -################################################################################ -## File: Install-SQLPowerShellTools.ps1 -## Desc: Install SQL PowerShell tool -################################################################################ - -Import-Module -Name ImageHelpers -Force - -Function InstallMSI -{ - Param - ( - [String]$MsiUrl, - [String]$MsiName - ) - - $exitCode = -1 - - try - { - Write-Host "Downloading $MsiName..." - $FilePath = "${env:Temp}\$MsiName" - - Invoke-WebRequest -Uri $MsiUrl -OutFile $FilePath - - $Arguments = ('/i', $FilePath, '/QN', '/norestart' ) - - Write-Host "Starting Install $MsiName..." - $process = Start-Process -FilePath msiexec.exe -ArgumentList $Arguments -Wait -PassThru - $exitCode = $process.ExitCode - - if ($exitCode -eq 0 -or $exitCode -eq 3010) - { - Write-Host -Object 'Installation successful' - return $exitCode - } - else - { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - exit $exitCode - } - } - catch - { - Write-Host -Object "Failed to install the MSI $MsiName" - Write-Host -Object $_.Exception.Message - exit -1 - } -} - -# install required MSIs -$SQLSysClrTypesExitCode = InstallMSI -MsiUrl "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64/SQLSysClrTypes.msi" -MsiName "SQLSysClrTypes.msi" - -$SharedManagementObjectsExitCode = InstallMSI -MsiUrl "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64/SharedManagementObjects.msi" -MsiName "SharedManagementObjects.msi" - -$PowerShellToolsExitCode = InstallMSI -MsiUrl "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64/PowerShellTools.msi" -MsiName "PowerShellTools.msi" - -# install sqlserver PS module -Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -Install-Module -Name SqlServer -AllowClobber - -exit $PowerShellToolsExitCode +################################################################################ +## File: Install-SQLPowerShellTools.ps1 +## Desc: Install SQL PowerShell tool +################################################################################ + +Import-Module -Name ImageHelpers -Force + +Function InstallMSI +{ + Param + ( + [String]$MsiUrl, + [String]$MsiName + ) + + $exitCode = -1 + + try + { + Write-Host "Downloading $MsiName..." + $FilePath = "${env:Temp}\$MsiName" + + Invoke-WebRequest -Uri $MsiUrl -OutFile $FilePath + + $Arguments = ('/i', $FilePath, '/QN', '/norestart' ) + + Write-Host "Starting Install $MsiName..." + $process = Start-Process -FilePath msiexec.exe -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + exit $exitCode + } + } + catch + { + Write-Host -Object "Failed to install the MSI $MsiName" + Write-Host -Object $_.Exception.Message + exit -1 + } +} + +# install required MSIs +$SQLSysClrTypesExitCode = InstallMSI -MsiUrl "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64/SQLSysClrTypes.msi" -MsiName "SQLSysClrTypes.msi" + +$SharedManagementObjectsExitCode = InstallMSI -MsiUrl "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64/SharedManagementObjects.msi" -MsiName "SharedManagementObjects.msi" + +$PowerShellToolsExitCode = InstallMSI -MsiUrl "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64/PowerShellTools.msi" -MsiName "PowerShellTools.msi" + +# install sqlserver PS module +Set-PSRepository -Name PSGallery -InstallationPolicy Trusted +Install-Module -Name SqlServer -AllowClobber + +exit $PowerShellToolsExitCode diff --git a/images/win/scripts/Installers/Install-Sbt.ps1 b/images/win/scripts/Installers/Install-Sbt.ps1 index f87cf90a1..b96ed5ac8 100644 --- a/images/win/scripts/Installers/Install-Sbt.ps1 +++ b/images/win/scripts/Installers/Install-Sbt.ps1 @@ -1,6 +1,5 @@ ################################################################################ ## File: Install-Sbt.ps1 -## Team: CI-X ## Desc: Install sbt for Windows ################################################################################ $ErrorActionPreference = "Stop" diff --git a/images/win/scripts/Installers/Install-SeleniumWebDrivers.ps1 b/images/win/scripts/Installers/Install-SeleniumWebDrivers.ps1 index 77f71764e..3c08977a5 100644 --- a/images/win/scripts/Installers/Install-SeleniumWebDrivers.ps1 +++ b/images/win/scripts/Installers/Install-SeleniumWebDrivers.ps1 @@ -1,17 +1,17 @@ -################################################################################ -## File: Install-SeleniumWebDrivers.ps1 -## Desc: Install Selenium Web Drivers -################################################################################ - -Invoke-WebRequest -UseBasicParsing -Uri "https://seleniumwebdrivers.blob.core.windows.net/seleniumwebdrivers/SeleniumWebDrivers.zip" -OutFile SeleniumWebDrivers.zip - -Expand-Archive -Path SeleniumWebDrivers.zip -DestinationPath "C:\" -Force - -Remove-Item SeleniumWebDrivers.zip - -setx IEWebDriver "C:\SeleniumWebDrivers\IEDriver" /M -setx GeckoWebDriver "C:\SeleniumWebDrivers\GeckoDriver" /M -setx ChromeWebDriver "C:\SeleniumWebDrivers\ChromeDriver" /M - -exit 0 - +################################################################################ +## File: Install-SeleniumWebDrivers.ps1 +## Desc: Install Selenium Web Drivers +################################################################################ + +Invoke-WebRequest -UseBasicParsing -Uri "https://seleniumwebdrivers.blob.core.windows.net/seleniumwebdrivers/SeleniumWebDrivers.zip" -OutFile SeleniumWebDrivers.zip + +Expand-Archive -Path SeleniumWebDrivers.zip -DestinationPath "C:\" -Force + +Remove-Item SeleniumWebDrivers.zip + +setx IEWebDriver "C:\SeleniumWebDrivers\IEDriver" /M +setx GeckoWebDriver "C:\SeleniumWebDrivers\GeckoDriver" /M +setx ChromeWebDriver "C:\SeleniumWebDrivers\ChromeDriver" /M + +exit 0 + diff --git a/images/win/scripts/Installers/Install-ServiceFabricSDK.ps1 b/images/win/scripts/Installers/Install-ServiceFabricSDK.ps1 index d13b4395d..25a0429db 100644 --- a/images/win/scripts/Installers/Install-ServiceFabricSDK.ps1 +++ b/images/win/scripts/Installers/Install-ServiceFabricSDK.ps1 @@ -1,13 +1,13 @@ -################################################################################ -## File: Install-ServiceFabricSDK.ps1 -## Desc: Install webpicmd and then the service fabric sdk -## must be install after Visual Studio -################################################################################ - -#Creating 'Installer' cache folder if it doesn't exist -$temp_install_dir = 'C:\Windows\Installer' -New-Item -Path $temp_install_dir -ItemType Directory -Force - -Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force - -WebpiCmd.exe /Install /Products:MicrosoftAzure-ServiceFabric-CoreSDK /AcceptEula +################################################################################ +## File: Install-ServiceFabricSDK.ps1 +## Desc: Install webpicmd and then the service fabric sdk +## must be install after Visual Studio +################################################################################ + +#Creating 'Installer' cache folder if it doesn't exist +$temp_install_dir = 'C:\Windows\Installer' +New-Item -Path $temp_install_dir -ItemType Directory -Force + +Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + +WebpiCmd.exe /Install /Products:MicrosoftAzure-ServiceFabric-CoreSDK /AcceptEula /XML:https://webpifeed.blob.core.windows.net/webpifeed/5.1/WebProductList.xml diff --git a/images/win/scripts/Installers/Install-Svn.ps1 b/images/win/scripts/Installers/Install-Svn.ps1 index 107213e4c..45dd52319 100644 --- a/images/win/scripts/Installers/Install-Svn.ps1 +++ b/images/win/scripts/Installers/Install-Svn.ps1 @@ -1,6 +1,6 @@ -################################################################################ -## File: Install-Svn.ps1 -## Desc: Install Subversion -################################################################################ - -choco install svn -y +################################################################################ +## File: Install-Svn.ps1 +## Desc: Install Subversion +################################################################################ + +choco install svn -y diff --git a/images/win/scripts/Installers/Install-TypeScript.ps1 b/images/win/scripts/Installers/Install-TypeScript.ps1 index 3bf4480a2..8b243ba5a 100644 --- a/images/win/scripts/Installers/Install-TypeScript.ps1 +++ b/images/win/scripts/Installers/Install-TypeScript.ps1 @@ -1,7 +1,6 @@ -################################################################################ -## File: Install-TypeScript.ps1 -## Team: CI Build -## Desc: Install Latest TypeScript -################################################################################ - -npm install -g typescript +################################################################################ +## File: Install-TypeScript.ps1 +## Desc: Install Latest TypeScript +################################################################################ + +npm install -g typescript diff --git a/images/win/scripts/Installers/Install-Vcpkg.ps1 b/images/win/scripts/Installers/Install-Vcpkg.ps1 index 373f066ac..d3a43424b 100644 --- a/images/win/scripts/Installers/Install-Vcpkg.ps1 +++ b/images/win/scripts/Installers/Install-Vcpkg.ps1 @@ -1,21 +1,21 @@ -################################################################################ -## File: Install-Vcpkg.ps1 -## Desc: Install vcpkg -################################################################################ - -Import-Module -Name ImageHelpers -Force - -$Uri = 'https://github.com/Microsoft/vcpkg.git' -$InstallDir = 'C:\vcpkg' -$VcpkgExecPath = 'vcpkg.exe' - -git clone --depth=1 $Uri $InstallDir -q - -# Build and integrate vcpkg -Invoke-Expression "$InstallDir\bootstrap-vcpkg.bat" -Invoke-Expression "$InstallDir\$VcpkgExecPath integrate install" - -# Add vcpkg to system environment -Add-MachinePathItem $InstallDir -$env:Path = Get-MachinePath -setx VCPKG_INSTALLATION_ROOT $InstallDir /M +################################################################################ +## File: Install-Vcpkg.ps1 +## Desc: Install vcpkg +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$Uri = 'https://github.com/Microsoft/vcpkg.git' +$InstallDir = 'C:\vcpkg' +$VcpkgExecPath = 'vcpkg.exe' + +git clone --depth=1 $Uri $InstallDir -q + +# Build and integrate vcpkg +Invoke-Expression "$InstallDir\bootstrap-vcpkg.bat" +Invoke-Expression "$InstallDir\$VcpkgExecPath integrate install" + +# Add vcpkg to system environment +Add-MachinePathItem $InstallDir +$env:Path = Get-MachinePath +setx VCPKG_INSTALLATION_ROOT $InstallDir /M diff --git a/images/win/scripts/Installers/Install-WinAppDriver.ps1 b/images/win/scripts/Installers/Install-WinAppDriver.ps1 index 983585075..106b33328 100644 --- a/images/win/scripts/Installers/Install-WinAppDriver.ps1 +++ b/images/win/scripts/Installers/Install-WinAppDriver.ps1 @@ -1,8 +1,8 @@ -#################################################################################### -## File: Install-WinAppDriver.ps1 -## Desc: Install Windows Application Driver (WinAppDriver) -#################################################################################### - -Import-Module -Name ImageHelpers -Force -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -Install-MSI -MsiUrl "https://github.com/Microsoft/WinAppDriver/releases/download/v1.1/WindowsApplicationDriver.msi" -MsiName "WindowsApplicationDriver.msi" +#################################################################################### +## File: Install-WinAppDriver.ps1 +## Desc: Install Windows Application Driver (WinAppDriver) +#################################################################################### + +Import-Module -Name ImageHelpers -Force +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +Install-MSI -MsiUrl "https://github.com/Microsoft/WinAppDriver/releases/download/v1.1/WindowsApplicationDriver.msi" -MsiName "WindowsApplicationDriver.msi" diff --git a/images/win/scripts/Installers/Install-WindowsUpdates.ps1 b/images/win/scripts/Installers/Install-WindowsUpdates.ps1 index 29d8a5f48..040ee8e02 100644 --- a/images/win/scripts/Installers/Install-WindowsUpdates.ps1 +++ b/images/win/scripts/Installers/Install-WindowsUpdates.ps1 @@ -1,10 +1,10 @@ -################################################################################ -## File: Install-WindowsUpdates.ps1 -## Desc: Install Windows Updates. -## Should be run at end just before Antivirus. -################################################################################ - -Write-Host "Run windows updates" -Install-Module -Name PSWindowsUpdate -Force -AllowClobber -Get-WUInstall -WindowsUpdate -AcceptAll -UpdateType Software -IgnoreReboot -Get-WUInstall -MicrosoftUpdate -AcceptAll -IgnoreUserInput -IgnoreReboot +################################################################################ +## File: Install-WindowsUpdates.ps1 +## Desc: Install Windows Updates. +## Should be run at end just before Antivirus. +################################################################################ + +Write-Host "Run windows updates" +Install-Module -Name PSWindowsUpdate -Force -AllowClobber +Get-WUInstall -WindowsUpdate -AcceptAll -UpdateType Software -IgnoreReboot +Get-WUInstall -MicrosoftUpdate -AcceptAll -IgnoreUserInput -IgnoreReboot diff --git a/images/win/scripts/Installers/Update-AndroidSDK.ps1 b/images/win/scripts/Installers/Update-AndroidSDK.ps1 index b617cb372..559f69c14 100644 --- a/images/win/scripts/Installers/Update-AndroidSDK.ps1 +++ b/images/win/scripts/Installers/Update-AndroidSDK.ps1 @@ -1,156 +1,156 @@ -################################################################################ -## File: Update-AndroidSDK.ps1 -## Desc: Install and update Android SDK and tools -################################################################################ - -# Download the latest command line tools so that we can accept all of the licenses. -# See https://developer.android.com/studio/#command-tools -Invoke-WebRequest -UseBasicParsing -Uri "https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip" -OutFile android-sdk-tools.zip - -# Don't replace the one that VS installs as it seems to break things. -Expand-Archive -Path android-sdk-tools.zip -DestinationPath android-sdk -Force - -$sdk = Get-Item -Path .\android-sdk - -# Install the standard Android SDK licenses. In the past, there wasn't a better way to do this, -# so we are base64-encoding a zip of the licenses directory from another installation. -# To create this base64 string, create a zip file that contains nothing but a 'licenses' folder, -# which folder contains the accepted license files found in 'C:\Program Files (x86)\Android\android-sdk\licenses'. -# Then, run this in PowerShell: -# $LicensesZipFileName = 'C:\Program Files (x86)\Android\android-sdk\Licenses.zip' -# $base64Content = [Convert]::ToBase64String([IO.File]::ReadAllBytes($LicensesZipFileName)) -# echo $base64Content -# -# Future: see if the base64 technique can be avoided by running this PowerShell script to accept all licenses. -# This fails when run on a live agent, likely because non-interactive mode is set. -# It may work fine during image generation (this script). -# for($i=0; $i -lt 100; $i++) { $response += "y`n"}; $response | .\sdkmanager.bat --licenses -$base64Content = "UEsDBBQAAAAAAKJeN06amkPzKgAAACoAAAAhAAAAbGljZW5zZXMvYW5kcm9pZC1nb29nbGV0di1saWNlbnNlDQpmYzk0NmU4ZjIzMWYzZTMxNTliZjBiN2M2NTVjOTI0Y2IyZTM4MzMwUEsDBBQAAAAIAKBrN05E+YSqQwAAAFQAAAAcAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstbGljZW5zZQXByREAIQgEwP9WmYsjhxgOKJN/CNs9vmdOQ2zdRw2dxQnWjqQ/3oIgXQM9vqUiwkiX8ljWea4ZlCF3xTo1pz6w+wdQSwMEFAAAAAAAxV43TpECY7AqAAAAKgAAACQAAABsaWNlbnNlcy9hbmRyb2lkLXNkay1wcmV2aWV3LWxpY2Vuc2UNCjUwNDY2N2Y0YzBkZTdhZjFhMDZkZTlmNGIxNzI3Yjg0MzUxZjI5MTBQSwMEFAAAAAAAzF43TpOr0CgqAAAAKgAAABsAAABsaWNlbnNlcy9nb29nbGUtZ2RrLWxpY2Vuc2UNCjMzYjZhMmI2NDYwN2YxMWI3NTlmMzIwZWY5ZGZmNGFlNWM0N2Q5N2FQSwMEFAAAAAAAz143TqxN4xEqAAAAKgAAACQAAABsaWNlbnNlcy9pbnRlbC1hbmRyb2lkLWV4dHJhLWxpY2Vuc2UNCmQ5NzVmNzUxNjk4YTc3YjY2MmYxMjU0ZGRiZWVkMzkwMWU5NzZmNWFQSwMEFAAAAAAA0l43Tu2ee/8qAAAAKgAAACYAAABsaWNlbnNlcy9taXBzLWFuZHJvaWQtc3lzaW1hZ2UtbGljZW5zZQ0KNjNkNzAzZjU2OTJmZDg5MWQ1YWNhY2ZiZDhlMDlmNDBmYzk3NjEwNVBLAQIUABQAAAAAAKJeN06amkPzKgAAACoAAAAhAAAAAAAAAAEAIAAAAAAAAABsaWNlbnNlcy9hbmRyb2lkLWdvb2dsZXR2LWxpY2Vuc2VQSwECFAAUAAAACACgazdORPmEqkMAAABUAAAAHAAAAAAAAAABACAAAABpAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstbGljZW5zZVBLAQIUABQAAAAAAMVeN06RAmOwKgAAACoAAAAkAAAAAAAAAAEAIAAAAOYAAABsaWNlbnNlcy9hbmRyb2lkLXNkay1wcmV2aWV3LWxpY2Vuc2VQSwECFAAUAAAAAADMXjdOk6vQKCoAAAAqAAAAGwAAAAAAAAABACAAAABSAQAAbGljZW5zZXMvZ29vZ2xlLWdkay1saWNlbnNlUEsBAhQAFAAAAAAAz143TqxN4xEqAAAAKgAAACQAAAAAAAAAAQAgAAAAtQEAAGxpY2Vuc2VzL2ludGVsLWFuZHJvaWQtZXh0cmEtbGljZW5zZVBLAQIUABQAAAAAANJeN07tnnv/KgAAACoAAAAmAAAAAAAAAAEAIAAAACECAABsaWNlbnNlcy9taXBzLWFuZHJvaWQtc3lzaW1hZ2UtbGljZW5zZVBLBQYAAAAABgAGANoBAACPAgAAAAA=" -$content = [System.Convert]::FromBase64String($base64Content) -Set-Content -Path .\android-sdk-licenses.zip -Value $content -Encoding Byte -Expand-Archive -Path .\android-sdk-licenses.zip -DestinationPath 'C:\Program Files (x86)\Android\android-sdk' -Force - - -# run the updates. -# keep newer versions in descending order - -$sdk_root = "C:\Program Files (x86)\Android\android-sdk" - -# The NDK is installed by Visual Studio at this location: -$ndk_root = "C:\Microsoft\AndroidNDK64\" - -if(Test-Path $ndk_root){ - - $androidNDKs = Get-ChildItem -Path $ndk_root | Sort-Object -Property Name -Descending | Select-Object -First 1 - $latestAndroidNDK = $androidNDKs.FullName; - - setx ANDROID_HOME $sdk_root /M - setx ANDROID_NDK_HOME $latestAndroidNDK /M - setx ANDROID_NDK_PATH $latestAndroidNDK /M -} -else { - Write-Host "NDK is not installed at path $ndk_root" - exit 1 -} - - -Push-Location -Path $sdk.FullName - -& '.\tools\bin\sdkmanager.bat' --sdk_root=$sdk_root ` - "platform-tools" ` - "platforms;android-29" ` - "platforms;android-28" ` - "platforms;android-27" ` - "platforms;android-26" ` - "platforms;android-25" ` - "platforms;android-24" ` - "platforms;android-23" ` - "platforms;android-22" ` - "platforms;android-21" ` - "platforms;android-19" ` - "build-tools;29.0.2" ` - "build-tools;29.0.0" ` - "build-tools;28.0.3" ` - "build-tools;28.0.2" ` - "build-tools;28.0.1" ` - "build-tools;28.0.0" ` - "build-tools;27.0.3" ` - "build-tools;27.0.2" ` - "build-tools;27.0.1" ` - "build-tools;27.0.0" ` - "build-tools;26.0.3" ` - "build-tools;26.0.2" ` - "build-tools;26.0.1" ` - "build-tools;26.0.0" ` - "build-tools;25.0.3" ` - "build-tools;25.0.2" ` - "build-tools;25.0.1" ` - "build-tools;25.0.0" ` - "build-tools;24.0.3" ` - "build-tools;24.0.2" ` - "build-tools;24.0.1" ` - "build-tools;24.0.0" ` - "build-tools;23.0.3" ` - "build-tools;23.0.2" ` - "build-tools;23.0.1" ` - "build-tools;22.0.1" ` - "build-tools;21.1.2" ` - "build-tools;20.0.0" ` - "build-tools;19.1.0" ` - "extras;android;m2repository" ` - "extras;google;m2repository" ` - "extras;google;google_play_services" ` - "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2" ` - "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1" ` - "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" ` - "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" ` - "add-ons;addon-google_apis-google-24" ` - "add-ons;addon-google_apis-google-23" ` - "add-ons;addon-google_apis-google-22" ` - "add-ons;addon-google_apis-google-21" ` - "cmake;3.6.4111459" ` - "patcher;v4" - -Pop-Location - - -# Adding description of the software to Markdown -$Header = @" - -## Android SDK Build Tools - -"@ - -Add-ContentToMarkdown -Content $Header - -$BuildTools =(Get-ChildItem "C:\Program Files (x86)\Android\android-sdk\build-tools\") ` - | Where { $_.Name -match "[0-9].*" } ` - | Sort-Object -Descending ` - | % { "#### $($_.Name)`n`n_Location:_ $($_.FullName)`n" } - -Add-ContentToMarkdown -Content $BuildTools - - -# Adding description of the software to Markdown -$Header = @" - -## Android SDK Platforms - -"@ - -Add-ContentToMarkdown -Content $Header - -$SdkList =(Get-ChildItem "C:\Program Files (x86)\Android\android-sdk\platforms\") | Sort-Object -Descending | %{ $_.FullName } - -foreach($sdk in $SdkList) -{ - $sdkProps = ConvertFrom-StringData (Get-Content "$sdk\source.properties" -Raw) - - $content = @" -#### $($sdkProps.'Platform.Version') (API $($sdkProps.'AndroidVersion.ApiLevel')) - -_Location:_ $sdk - -"@ - Add-ContentToMarkdown -Content $content -} +################################################################################ +## File: Update-AndroidSDK.ps1 +## Desc: Install and update Android SDK and tools +################################################################################ + +# Download the latest command line tools so that we can accept all of the licenses. +# See https://developer.android.com/studio/#command-tools +Invoke-WebRequest -UseBasicParsing -Uri "https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip" -OutFile android-sdk-tools.zip + +# Don't replace the one that VS installs as it seems to break things. +Expand-Archive -Path android-sdk-tools.zip -DestinationPath android-sdk -Force + +$sdk = Get-Item -Path .\android-sdk + +# Install the standard Android SDK licenses. In the past, there wasn't a better way to do this, +# so we are base64-encoding a zip of the licenses directory from another installation. +# To create this base64 string, create a zip file that contains nothing but a 'licenses' folder, +# which folder contains the accepted license files found in 'C:\Program Files (x86)\Android\android-sdk\licenses'. +# Then, run this in PowerShell: +# $LicensesZipFileName = 'C:\Program Files (x86)\Android\android-sdk\Licenses.zip' +# $base64Content = [Convert]::ToBase64String([IO.File]::ReadAllBytes($LicensesZipFileName)) +# echo $base64Content +# +# Future: see if the base64 technique can be avoided by running this PowerShell script to accept all licenses. +# This fails when run on a live agent, likely because non-interactive mode is set. +# It may work fine during image generation (this script). +# for($i=0; $i -lt 100; $i++) { $response += "y`n"}; $response | .\sdkmanager.bat --licenses +$base64Content = "UEsDBBQAAAAAAKJeN06amkPzKgAAACoAAAAhAAAAbGljZW5zZXMvYW5kcm9pZC1nb29nbGV0di1saWNlbnNlDQpmYzk0NmU4ZjIzMWYzZTMxNTliZjBiN2M2NTVjOTI0Y2IyZTM4MzMwUEsDBBQAAAAIAKBrN05E+YSqQwAAAFQAAAAcAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstbGljZW5zZQXByREAIQgEwP9WmYsjhxgOKJN/CNs9vmdOQ2zdRw2dxQnWjqQ/3oIgXQM9vqUiwkiX8ljWea4ZlCF3xTo1pz6w+wdQSwMEFAAAAAAAxV43TpECY7AqAAAAKgAAACQAAABsaWNlbnNlcy9hbmRyb2lkLXNkay1wcmV2aWV3LWxpY2Vuc2UNCjUwNDY2N2Y0YzBkZTdhZjFhMDZkZTlmNGIxNzI3Yjg0MzUxZjI5MTBQSwMEFAAAAAAAzF43TpOr0CgqAAAAKgAAABsAAABsaWNlbnNlcy9nb29nbGUtZ2RrLWxpY2Vuc2UNCjMzYjZhMmI2NDYwN2YxMWI3NTlmMzIwZWY5ZGZmNGFlNWM0N2Q5N2FQSwMEFAAAAAAAz143TqxN4xEqAAAAKgAAACQAAABsaWNlbnNlcy9pbnRlbC1hbmRyb2lkLWV4dHJhLWxpY2Vuc2UNCmQ5NzVmNzUxNjk4YTc3YjY2MmYxMjU0ZGRiZWVkMzkwMWU5NzZmNWFQSwMEFAAAAAAA0l43Tu2ee/8qAAAAKgAAACYAAABsaWNlbnNlcy9taXBzLWFuZHJvaWQtc3lzaW1hZ2UtbGljZW5zZQ0KNjNkNzAzZjU2OTJmZDg5MWQ1YWNhY2ZiZDhlMDlmNDBmYzk3NjEwNVBLAQIUABQAAAAAAKJeN06amkPzKgAAACoAAAAhAAAAAAAAAAEAIAAAAAAAAABsaWNlbnNlcy9hbmRyb2lkLWdvb2dsZXR2LWxpY2Vuc2VQSwECFAAUAAAACACgazdORPmEqkMAAABUAAAAHAAAAAAAAAABACAAAABpAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstbGljZW5zZVBLAQIUABQAAAAAAMVeN06RAmOwKgAAACoAAAAkAAAAAAAAAAEAIAAAAOYAAABsaWNlbnNlcy9hbmRyb2lkLXNkay1wcmV2aWV3LWxpY2Vuc2VQSwECFAAUAAAAAADMXjdOk6vQKCoAAAAqAAAAGwAAAAAAAAABACAAAABSAQAAbGljZW5zZXMvZ29vZ2xlLWdkay1saWNlbnNlUEsBAhQAFAAAAAAAz143TqxN4xEqAAAAKgAAACQAAAAAAAAAAQAgAAAAtQEAAGxpY2Vuc2VzL2ludGVsLWFuZHJvaWQtZXh0cmEtbGljZW5zZVBLAQIUABQAAAAAANJeN07tnnv/KgAAACoAAAAmAAAAAAAAAAEAIAAAACECAABsaWNlbnNlcy9taXBzLWFuZHJvaWQtc3lzaW1hZ2UtbGljZW5zZVBLBQYAAAAABgAGANoBAACPAgAAAAA=" +$content = [System.Convert]::FromBase64String($base64Content) +Set-Content -Path .\android-sdk-licenses.zip -Value $content -Encoding Byte +Expand-Archive -Path .\android-sdk-licenses.zip -DestinationPath 'C:\Program Files (x86)\Android\android-sdk' -Force + + +# run the updates. +# keep newer versions in descending order + +$sdk_root = "C:\Program Files (x86)\Android\android-sdk" + +# The NDK is installed by Visual Studio at this location: +$ndk_root = "C:\Microsoft\AndroidNDK64\" + +if(Test-Path $ndk_root){ + + $androidNDKs = Get-ChildItem -Path $ndk_root | Sort-Object -Property Name -Descending | Select-Object -First 1 + $latestAndroidNDK = $androidNDKs.FullName; + + setx ANDROID_HOME $sdk_root /M + setx ANDROID_NDK_HOME $latestAndroidNDK /M + setx ANDROID_NDK_PATH $latestAndroidNDK /M +} +else { + Write-Host "NDK is not installed at path $ndk_root" + exit 1 +} + + +Push-Location -Path $sdk.FullName + +& '.\tools\bin\sdkmanager.bat' --sdk_root=$sdk_root ` + "platform-tools" ` + "platforms;android-29" ` + "platforms;android-28" ` + "platforms;android-27" ` + "platforms;android-26" ` + "platforms;android-25" ` + "platforms;android-24" ` + "platforms;android-23" ` + "platforms;android-22" ` + "platforms;android-21" ` + "platforms;android-19" ` + "build-tools;29.0.2" ` + "build-tools;29.0.0" ` + "build-tools;28.0.3" ` + "build-tools;28.0.2" ` + "build-tools;28.0.1" ` + "build-tools;28.0.0" ` + "build-tools;27.0.3" ` + "build-tools;27.0.2" ` + "build-tools;27.0.1" ` + "build-tools;27.0.0" ` + "build-tools;26.0.3" ` + "build-tools;26.0.2" ` + "build-tools;26.0.1" ` + "build-tools;26.0.0" ` + "build-tools;25.0.3" ` + "build-tools;25.0.2" ` + "build-tools;25.0.1" ` + "build-tools;25.0.0" ` + "build-tools;24.0.3" ` + "build-tools;24.0.2" ` + "build-tools;24.0.1" ` + "build-tools;24.0.0" ` + "build-tools;23.0.3" ` + "build-tools;23.0.2" ` + "build-tools;23.0.1" ` + "build-tools;22.0.1" ` + "build-tools;21.1.2" ` + "build-tools;20.0.0" ` + "build-tools;19.1.0" ` + "extras;android;m2repository" ` + "extras;google;m2repository" ` + "extras;google;google_play_services" ` + "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2" ` + "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1" ` + "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" ` + "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" ` + "add-ons;addon-google_apis-google-24" ` + "add-ons;addon-google_apis-google-23" ` + "add-ons;addon-google_apis-google-22" ` + "add-ons;addon-google_apis-google-21" ` + "cmake;3.6.4111459" ` + "patcher;v4" + +Pop-Location + + +# Adding description of the software to Markdown +$Header = @" + +## Android SDK Build Tools + +"@ + +Add-ContentToMarkdown -Content $Header + +$BuildTools =(Get-ChildItem "C:\Program Files (x86)\Android\android-sdk\build-tools\") ` + | Where { $_.Name -match "[0-9].*" } ` + | Sort-Object -Descending ` + | % { "#### $($_.Name)`n`n_Location:_ $($_.FullName)`n" } + +Add-ContentToMarkdown -Content $BuildTools + + +# Adding description of the software to Markdown +$Header = @" + +## Android SDK Platforms + +"@ + +Add-ContentToMarkdown -Content $Header + +$SdkList =(Get-ChildItem "C:\Program Files (x86)\Android\android-sdk\platforms\") | Sort-Object -Descending | %{ $_.FullName } + +foreach($sdk in $SdkList) +{ + $sdkProps = ConvertFrom-StringData (Get-Content "$sdk\source.properties" -Raw) + + $content = @" +#### $($sdkProps.'Platform.Version') (API $($sdkProps.'AndroidVersion.ApiLevel')) + +_Location:_ $sdk + +"@ + Add-ContentToMarkdown -Content $content +} diff --git a/images/win/scripts/Installers/Update-DotnetTLS.ps1 b/images/win/scripts/Installers/Update-DotnetTLS.ps1 index 82f464739..f07e3ca02 100644 --- a/images/win/scripts/Installers/Update-DotnetTLS.ps1 +++ b/images/win/scripts/Installers/Update-DotnetTLS.ps1 @@ -1,18 +1,18 @@ -################################################################################ -## File: Update-DotnetTLS.ps1 -## Desc: Update DotNetFramework security protocol to TLS 1.2 -################################################################################ - -$registryPath = "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -$name = "SchUseStrongCrypto" -$value = "1" -if(Test-Path $registryPath){ - Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD -} - -$registryPath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" -if(Test-Path $registryPath){ - Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD -} - - +################################################################################ +## File: Update-DotnetTLS.ps1 +## Desc: Update DotNetFramework security protocol to TLS 1.2 +################################################################################ + +$registryPath = "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" +$name = "SchUseStrongCrypto" +$value = "1" +if(Test-Path $registryPath){ + Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD +} + +$registryPath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" +if(Test-Path $registryPath){ + Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD +} + + diff --git a/images/win/scripts/Installers/Validate-7zip.ps1 b/images/win/scripts/Installers/Validate-7zip.ps1 index fb6bed229..c47c95a7e 100644 --- a/images/win/scripts/Installers/Validate-7zip.ps1 +++ b/images/win/scripts/Installers/Validate-7zip.ps1 @@ -1,25 +1,25 @@ -################################################################################ -## File: Validate-7zip.ps1 -## Desc: Validate 7zip -################################################################################ - -if (Get-Command -Name '7z') -{ - Write-Host "7zip on path" -} -else -{ - Write-Host '7zip is not on path' - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "7zip" -$(7z --help).Split([System.Environment]::NewLine)[1] -match "\d+\.\d+" -$7zipVersion = $matches[0] - -$Description = @" -_Version:_ $7zipVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-7zip.ps1 +## Desc: Validate 7zip +################################################################################ + +if (Get-Command -Name '7z') +{ + Write-Host "7zip on path" +} +else +{ + Write-Host '7zip is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "7zip" +$(7z --help).Split([System.Environment]::NewLine)[1] -match "\d+\.\d+" +$7zipVersion = $matches[0] + +$Description = @" +_Version:_ $7zipVersion
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-AzureCli.ps1 b/images/win/scripts/Installers/Validate-AzureCli.ps1 index 16d70e308..231d112d0 100644 --- a/images/win/scripts/Installers/Validate-AzureCli.ps1 +++ b/images/win/scripts/Installers/Validate-AzureCli.ps1 @@ -1,28 +1,28 @@ -################################################################################ -## File: Validate-AzureCli.ps1 -## Desc: Validate Azure CLI -################################################################################ - -if(Get-Command -Name 'az') -{ - Write-Host "Azure Cli $(az --version) on path" -} -else -{ - Write-Error "Azure Cli not on path" - exit 1 -} - -$azureCliVersion = az -v | findstr azure-cli -$azureCliVersion = $azureCliVersion.trim().Substring("azure-cli".Length).trim() - -# Adding description of the software to Markdown -$SoftwareName = "Azure CLI" - -$Description = @" -_Version:_ $azureCliVersion -_Environment:_ -* PATH: contains location of az.cmd -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-AzureCli.ps1 +## Desc: Validate Azure CLI +################################################################################ + +if(Get-Command -Name 'az') +{ + Write-Host "Azure Cli $(az --version) on path" +} +else +{ + Write-Error "Azure Cli not on path" + exit 1 +} + +$azureCliVersion = az -v | findstr azure-cli +$azureCliVersion = $azureCliVersion.trim().Substring("azure-cli".Length).trim() + +# Adding description of the software to Markdown +$SoftwareName = "Azure CLI" + +$Description = @" +_Version:_ $azureCliVersion +_Environment:_ +* PATH: contains location of az.cmd +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 b/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 index 663609bd4..4020f40ef 100644 --- a/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 +++ b/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 @@ -1,47 +1,47 @@ -################################################################################ -## File: Validate-AzureCosmosDbEmulator.ps1 -## Desc: Validate Azure CosmosDb Emulator installation. -################################################################################ - -$SoftwareName = 'Azure CosmosDb Emulator' -$regKey = gci HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | gp | ? { $_.DisplayName -eq 'Azure Cosmos DB Emulator' } - -if ($regKey -eq $null) -{ - Write-Host "The $regKey registry key is not set" - exit 1 -} -else -{ - Write-Host "The $regKey registry key is set" -} - -$installDir = $regKey.InstallLocation -if ($installDir -eq $null) -{ - Write-Host "The $SoftwareName installation directory registry value is not set" - exit 1 -} -else -{ - Write-Host "The $SoftwareName installation directory registry value is set to: $installDir" -} - -$exeFilePath = Join-Path $installDir 'CosmosDB.Emulator.exe' -if (!(Test-Path $exeFilePath)) -{ - Write-Host "$SoftwareName is not installed" - exit 1 -} -else -{ - $fileVersion = (Get-Item $exeFilePath).VersionInfo.FileVersion - Write-Host "$SoftwareName is successfully installed: $fileVersion" - - $Description = @" -_Version:_ $fileVersion
-_Location:_ $installDir -"@ - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description -} +################################################################################ +## File: Validate-AzureCosmosDbEmulator.ps1 +## Desc: Validate Azure CosmosDb Emulator installation. +################################################################################ + +$SoftwareName = 'Azure CosmosDb Emulator' +$regKey = gci HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | gp | ? { $_.DisplayName -eq 'Azure Cosmos DB Emulator' } + +if ($regKey -eq $null) +{ + Write-Host "The $regKey registry key is not set" + exit 1 +} +else +{ + Write-Host "The $regKey registry key is set" +} + +$installDir = $regKey.InstallLocation +if ($installDir -eq $null) +{ + Write-Host "The $SoftwareName installation directory registry value is not set" + exit 1 +} +else +{ + Write-Host "The $SoftwareName installation directory registry value is set to: $installDir" +} + +$exeFilePath = Join-Path $installDir 'CosmosDB.Emulator.exe' +if (!(Test-Path $exeFilePath)) +{ + Write-Host "$SoftwareName is not installed" + exit 1 +} +else +{ + $fileVersion = (Get-Item $exeFilePath).VersionInfo.FileVersion + Write-Host "$SoftwareName is successfully installed: $fileVersion" + + $Description = @" +_Version:_ $fileVersion
+_Location:_ $installDir +"@ + + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +} diff --git a/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 b/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 index b494bd183..4ec5e3305 100644 --- a/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 +++ b/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 @@ -1,24 +1,24 @@ -################################################################################ -## File: Validate-AzureDevOpsCli.ps1 -## Desc: Validate Azure DevOps CLI -################################################################################ - -az devops -h - -if($LastExitCode -ne 0) -{ - Write-Error "Azure DevOps Cli extension not present" - exit 1 -} -else -{ - Write-Host "Azure DevOps Cli extension is present" -} - -$azDevopsVer = az -v | findstr azure-devops - -$Description = @" -_Version:_ $azDevopsVer -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName 'Azure DevOps Cli extension' -DescriptionMarkdown $Description +################################################################################ +## File: Validate-AzureDevOpsCli.ps1 +## Desc: Validate Azure DevOps CLI +################################################################################ + +az devops -h + +if($LastExitCode -ne 0) +{ + Write-Error "Azure DevOps Cli extension not present" + exit 1 +} +else +{ + Write-Host "Azure DevOps Cli extension is present" +} + +$azDevopsVer = az -v | findstr azure-devops + +$Description = @" +_Version:_ $azDevopsVer +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName 'Azure DevOps Cli extension' -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-AzureModules.ps1 b/images/win/scripts/Installers/Validate-AzureModules.ps1 index a1456fac1..abe152780 100644 --- a/images/win/scripts/Installers/Validate-AzureModules.ps1 +++ b/images/win/scripts/Installers/Validate-AzureModules.ps1 @@ -1,71 +1,71 @@ -################################################################################ -## File: Validate-AzureModules.ps1 -## Desc: Validate Azure PowerShell modules -################################################################################ - -Import-Module -Name ImageHelpers -Force - -$DefaultModule = Get-Module -Name AzureRM -ListAvailable | Select-Object -First 1 - -$env:PSModulePath = $env:PSModulePath + ";C:\Modules" - -$azureModules = Get-Module -Name Azure -ListAvailable | Select-Object Name,Version,Path | Format-Table | Out-String - -Write-Host "The Azure Modules finally present are:" -$azureModules - -if( ($azureModules -match "2.1.0") -and ($azureModules -match "3.8.0") -and ($azureModules -match "4.2.1") -and ($azureModules -match "5.1.1")) -{ - Write-Host "Required Azure modules are present" -} -else { - Write-Host "One or more required Azure modules are not present" - throw "One or more required Azure modules are not present." -} - - -$azureRMModules = Get-Module -Name AzureRM -ListAvailable | Select-Object Name,Version,Path | Format-Table | Out-String - -Write-Host "The AzureRM Modules finally present are:" -$azureRMModules - -if( ($azureRMModules -match "2.1.0") -and ($azureRMModules -match "3.8.0") -and ($azureRMModules -match "4.2.1") -and ($azureRMModules -match "5.1.1")) -{ - Write-Host "Required AzureRM modules are present" - -} -else { - Write-Host "One or more required AzureRM modules are not present" - throw "One or more required AzureRM modules are not present." -} - - -$azureModules = Get-Module -Name AzureRM -ListAvailable - - -# Adding description of the software to Markdown -$SoftwareName = "Azure/AzureRM Powershell modules" - -$Description = @" -#### $($DefaultModule.Version) - -This version is installed and is available via `Get-Module -ListAvailable` -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -foreach( $module in $azureModules) -{ - if($module.Version -ne $DefaultModule.Version) - { - - $CurrentModule = @" -#### $($module.Version) - -This version is saved but not installed -_Location:_ $($module.Path) - -"@ - Add-ContentToMarkdown -Content $CurrentModule - } -} +################################################################################ +## File: Validate-AzureModules.ps1 +## Desc: Validate Azure PowerShell modules +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$DefaultModule = Get-Module -Name AzureRM -ListAvailable | Select-Object -First 1 + +$env:PSModulePath = $env:PSModulePath + ";C:\Modules" + +$azureModules = Get-Module -Name Azure -ListAvailable | Select-Object Name,Version,Path | Format-Table | Out-String + +Write-Host "The Azure Modules finally present are:" +$azureModules + +if( ($azureModules -match "2.1.0") -and ($azureModules -match "3.8.0") -and ($azureModules -match "4.2.1") -and ($azureModules -match "5.1.1")) +{ + Write-Host "Required Azure modules are present" +} +else { + Write-Host "One or more required Azure modules are not present" + throw "One or more required Azure modules are not present." +} + + +$azureRMModules = Get-Module -Name AzureRM -ListAvailable | Select-Object Name,Version,Path | Format-Table | Out-String + +Write-Host "The AzureRM Modules finally present are:" +$azureRMModules + +if( ($azureRMModules -match "2.1.0") -and ($azureRMModules -match "3.8.0") -and ($azureRMModules -match "4.2.1") -and ($azureRMModules -match "5.1.1")) +{ + Write-Host "Required AzureRM modules are present" + +} +else { + Write-Host "One or more required AzureRM modules are not present" + throw "One or more required AzureRM modules are not present." +} + + +$azureModules = Get-Module -Name AzureRM -ListAvailable + + +# Adding description of the software to Markdown +$SoftwareName = "Azure/AzureRM Powershell modules" + +$Description = @" +#### $($DefaultModule.Version) + +This version is installed and is available via `Get-Module -ListAvailable` +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +foreach( $module in $azureModules) +{ + if($module.Version -ne $DefaultModule.Version) + { + + $CurrentModule = @" +#### $($module.Version) + +This version is saved but not installed +_Location:_ $($module.Path) + +"@ + Add-ContentToMarkdown -Content $CurrentModule + } +} diff --git a/images/win/scripts/Installers/Validate-Boost.ps1 b/images/win/scripts/Installers/Validate-Boost.ps1 index 7da2aab80..43629e7af 100644 --- a/images/win/scripts/Installers/Validate-Boost.ps1 +++ b/images/win/scripts/Installers/Validate-Boost.ps1 @@ -1,75 +1,75 @@ -################################################################################ -## File: Validate-Boost.ps1 -## Desc: Validate Boost -################################################################################ - -function Validate-BoostVersion -{ - Param - ( - [String]$BoostRootPath, - [String]$BoostRelease - ) - - $ReleasePath = Join-Path -Path $BoostRootPath -ChildPath $BoostRelease - - if ((Test-Path "$ReleasePath\b2.exe") -and (Test-Path "$ReleasePath\bjam.exe")) - { - Write-Host "Boost.Build $BoostRelease is successfully installed" - Write-Host "Boost.Jam $BoostRelease is successfully installed" - return - } - - Write-Host "$BoostRelease not found" - exit 1 -} - -# Verify that Boost is on the path -if ((Get-Command -Name 'b2') -and (Get-Command -Name 'bjam')) -{ - Write-Host "Boost is on the path" -} -else -{ - Write-Host "Boost is not on the path" - exit 1 -} - -# Adding description of the software to Markdown -$tmplMark = @" -#### {0} - -_Environment:_ -* {1}: root directory of the Boost version {0} installation - -"@ - -$tmplMarkRoot = @" -#### {0} - -* PATH: contains the location of Boost version {0} -* BOOST_ROOT: root directory of the Boost version {0} installation -* {1}: root directory of the Boost version {0} installation -"@ - -$SoftwareName = 'Boost' -$Description = New-Object System.Text.StringBuilder -$BoostRootDirectory = Join-Path -Path $env:ProgramFiles -ChildPath "Boost" -$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(",") - -foreach($Boost in $BoostVersionsToInstall) -{ - Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $Boost - $BoostVersionTag = "BOOST_ROOT_{0}" -f $Boost.Replace('.', '_') - - if($boost -eq $env:BOOST_DEFAULT) - { - $null = $Description.AppendLine(($tmplMarkRoot -f $BoostVersion, $BoostVersionTag)) - } - else - { - $null = $Description.AppendLine(($tmplMark -f $BoostVersion, $BoostVersionTag)) - } -} - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString() +################################################################################ +## File: Validate-Boost.ps1 +## Desc: Validate Boost +################################################################################ + +function Validate-BoostVersion +{ + Param + ( + [String]$BoostRootPath, + [String]$BoostRelease + ) + + $ReleasePath = Join-Path -Path $BoostRootPath -ChildPath $BoostRelease + + if ((Test-Path "$ReleasePath\b2.exe") -and (Test-Path "$ReleasePath\bjam.exe")) + { + Write-Host "Boost.Build $BoostRelease is successfully installed" + Write-Host "Boost.Jam $BoostRelease is successfully installed" + return + } + + Write-Host "$BoostRelease not found" + exit 1 +} + +# Verify that Boost is on the path +if ((Get-Command -Name 'b2') -and (Get-Command -Name 'bjam')) +{ + Write-Host "Boost is on the path" +} +else +{ + Write-Host "Boost is not on the path" + exit 1 +} + +# Adding description of the software to Markdown +$tmplMark = @" +#### {0} + +_Environment:_ +* {1}: root directory of the Boost version {0} installation + +"@ + +$tmplMarkRoot = @" +#### {0} + +* PATH: contains the location of Boost version {0} +* BOOST_ROOT: root directory of the Boost version {0} installation +* {1}: root directory of the Boost version {0} installation +"@ + +$SoftwareName = 'Boost' +$Description = New-Object System.Text.StringBuilder +$BoostRootDirectory = Join-Path -Path $env:ProgramFiles -ChildPath "Boost" +$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(",") + +foreach($Boost in $BoostVersionsToInstall) +{ + Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $Boost + $BoostVersionTag = "BOOST_ROOT_{0}" -f $Boost.Replace('.', '_') + + if($boost -eq $env:BOOST_DEFAULT) + { + $null = $Description.AppendLine(($tmplMarkRoot -f $BoostVersion, $BoostVersionTag)) + } + else + { + $null = $Description.AppendLine(($tmplMark -f $BoostVersion, $BoostVersionTag)) + } +} + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString() diff --git a/images/win/scripts/Installers/Validate-Chrome.ps1 b/images/win/scripts/Installers/Validate-Chrome.ps1 index 505976e44..e27c5c9bb 100644 --- a/images/win/scripts/Installers/Validate-Chrome.ps1 +++ b/images/win/scripts/Installers/Validate-Chrome.ps1 @@ -1,25 +1,25 @@ -################################################################################ -## File: Validate-Chrome.ps1 -## Desc: Validate Google Chrome installation. -################################################################################ - -if(Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe") -{ - (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo - - $SoftwareName = "Google Chrome" - $fileVersion = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo.FileVersion - $Description = @" -_version:_ -$fileVersion -"@ - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - exit 0 -} -else -{ - Write-Host "Google Chrome is not installed." - exit 1 -} +################################################################################ +## File: Validate-Chrome.ps1 +## Desc: Validate Google Chrome installation. +################################################################################ + +if(Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe") +{ + (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo + + $SoftwareName = "Google Chrome" + $fileVersion = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo.FileVersion + $Description = @" +_version:_ +$fileVersion +"@ + + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + exit 0 +} +else +{ + Write-Host "Google Chrome is not installed." + exit 1 +} diff --git a/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 b/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 index 5e92f8a51..087ffc84b 100644 --- a/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 +++ b/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 @@ -1,28 +1,28 @@ -################################################################################ -## File: Validate-CloudFoundryCli.ps1 -## Desc: Validate Cloud Foundry CLI -################################################################################ - -if (Get-Command -Name 'cf') -{ - Write-Host "cf on path" -} -else -{ - Write-Host 'cf is not on path' - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "Cloud Foundry CLI" - -if( $(cf version) -match '\d+\.\d+\.\d+' ) -{ - $version = $Matches[0] -} - -$Description = @" -_Version:_ $version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-CloudFoundryCli.ps1 +## Desc: Validate Cloud Foundry CLI +################################################################################ + +if (Get-Command -Name 'cf') +{ + Write-Host "cf on path" +} +else +{ + Write-Host 'cf is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Cloud Foundry CLI" + +if( $(cf version) -match '\d+\.\d+\.\d+' ) +{ + $version = $Matches[0] +} + +$Description = @" +_Version:_ $version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Cmake.ps1 b/images/win/scripts/Installers/Validate-Cmake.ps1 index 49a7487c9..1d887d359 100644 --- a/images/win/scripts/Installers/Validate-Cmake.ps1 +++ b/images/win/scripts/Installers/Validate-Cmake.ps1 @@ -1,31 +1,31 @@ -################################################################################ -## File: Validate-Cmake.ps1 -## Desc: Validate Cmake -################################################################################ - -if(Get-Command -Name 'cmake') -{ - Write-Host "Cmake $(cmake -version) on path" -} -else -{ - Write-Host 'cmake not on path' - exit 1 -} - - -if( $( $(cmake -version) | Out-String) -match 'cmake version (?.*).*' ) -{ - $cmakeVersion = $Matches.version.Trim() -} - -# Adding description of the software to Markdown -$SoftwareName = "Cmake" - -$Description = @" -_Version:_ $cmakeVersion
-_Environment:_ -* PATH: contains location of cmake.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Cmake.ps1 +## Desc: Validate Cmake +################################################################################ + +if(Get-Command -Name 'cmake') +{ + Write-Host "Cmake $(cmake -version) on path" +} +else +{ + Write-Host 'cmake not on path' + exit 1 +} + + +if( $( $(cmake -version) | Out-String) -match 'cmake version (?.*).*' ) +{ + $cmakeVersion = $Matches.version.Trim() +} + +# Adding description of the software to Markdown +$SoftwareName = "Cmake" + +$Description = @" +_Version:_ $cmakeVersion
+_Environment:_ +* PATH: contains location of cmake.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-DACFx.ps1 b/images/win/scripts/Installers/Validate-DACFx.ps1 index 587b2b0bb..fb815c10e 100644 --- a/images/win/scripts/Installers/Validate-DACFx.ps1 +++ b/images/win/scripts/Installers/Validate-DACFx.ps1 @@ -1,33 +1,33 @@ -#################################################################################### -## File: Validate-DACFx.ps1 -## Desc: Validate SQL Server® Data-Tier Application Framework (DACFx) for Windows -#################################################################################### - -$env:PATH = $env:Path + ';C:\Program Files\Microsoft SQL Server\120\DAC\bin;C:\Program Files\Microsoft SQL Server\130\DAC\bin;C:\Program Files\Microsoft SQL Server\140\DAC\bin;C:\Program Files\Microsoft SQL Server\150\DAC\bin' - -if(Get-Command -Name 'SqlPackage') -{ - - Write-Host "DACFx is installed at path" (Get-Command -Name 'SqlPackage').Source -} -else -{ - throw "DACFx is not installed!" -} - -function Get-DacFxVersion -{ - $regKey = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Data-Tier Application Framework\CurrentVersion" - $Version = (Get-ItemProperty -Path $regKey).'(Default)' - return $Version -} - - -# Adding description of the software to Markdown -$SoftwareName = "SQL Server Data Tier Application Framework (x64)" - -$Description = @" -_Version:_ $(Get-DacFxVersion)
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +#################################################################################### +## File: Validate-DACFx.ps1 +## Desc: Validate SQL Server® Data-Tier Application Framework (DACFx) for Windows +#################################################################################### + +$env:PATH = $env:Path + ';C:\Program Files\Microsoft SQL Server\120\DAC\bin;C:\Program Files\Microsoft SQL Server\130\DAC\bin;C:\Program Files\Microsoft SQL Server\140\DAC\bin;C:\Program Files\Microsoft SQL Server\150\DAC\bin' + +if(Get-Command -Name 'SqlPackage') +{ + + Write-Host "DACFx is installed at path" (Get-Command -Name 'SqlPackage').Source +} +else +{ + throw "DACFx is not installed!" +} + +function Get-DacFxVersion +{ + $regKey = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Data-Tier Application Framework\CurrentVersion" + $Version = (Get-ItemProperty -Path $regKey).'(Default)' + return $Version +} + + +# Adding description of the software to Markdown +$SoftwareName = "SQL Server Data Tier Application Framework (x64)" + +$Description = @" +_Version:_ $(Get-DacFxVersion)
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Docker.ps1 b/images/win/scripts/Installers/Validate-Docker.ps1 index c3404fa9b..cc9d496ef 100644 --- a/images/win/scripts/Installers/Validate-Docker.ps1 +++ b/images/win/scripts/Installers/Validate-Docker.ps1 @@ -1,46 +1,46 @@ -################################################################################ -## File: Validate-Docker.ps1 -## Desc: Validate Docker. -################################################################################ - - -if((Get-Command -Name 'docker') -and (Get-Command -Name 'docker-compose')) -{ - Write-Host "docker $(docker version) on path" - Write-Host "docker-compose $(docker-compose version) on path" -} -else -{ - Write-Host "docker or docker-compose are not on path" - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "Docker" - -$version = $(docker version --format '{{.Server.Version}}') - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of docker.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - - -$SoftwareName = "Docker-compose" - -if( $(docker-compose --version) -match 'docker-compose version (?.*), build.*' ) -{ - $dockerComposeVersion = $Matches.version -} - -$Description = @" -_Version:_ $dockerComposeVersion
-_Environment:_ -* PATH: contains location of docker-compose.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Docker.ps1 +## Desc: Validate Docker. +################################################################################ + + +if((Get-Command -Name 'docker') -and (Get-Command -Name 'docker-compose')) +{ + Write-Host "docker $(docker version) on path" + Write-Host "docker-compose $(docker-compose version) on path" +} +else +{ + Write-Host "docker or docker-compose are not on path" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Docker" + +$version = $(docker version --format '{{.Server.Version}}') + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of docker.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + + +$SoftwareName = "Docker-compose" + +if( $(docker-compose --version) -match 'docker-compose version (?.*), build.*' ) +{ + $dockerComposeVersion = $Matches.version +} + +$Description = @" +_Version:_ $dockerComposeVersion
+_Environment:_ +* PATH: contains location of docker-compose.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-DotnetSDK.ps1 b/images/win/scripts/Installers/Validate-DotnetSDK.ps1 index a73133c3c..cb5f917bc 100644 --- a/images/win/scripts/Installers/Validate-DotnetSDK.ps1 +++ b/images/win/scripts/Installers/Validate-DotnetSDK.ps1 @@ -1,46 +1,46 @@ -################################################################################ -## File: Validate-DotnetSDK.ps1 -## Desc: Validate dotnet -################################################################################ - -if(Get-Command -Name 'dotnet') -{ - Write-Host "dotnet $(dotnet --version) on path" -} -else -{ - Write-Host "dotnet is not on path" - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = ".NET Core" - -$Description = @" -The following runtimes and SDKs are installed: - -_Environment:_ -* PATH: contains location of dotnet.exe - -_SDK:_ -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -$SdkList =(Get-ChildItem "C:\Program Files\dotnet\sdk") | Where { $_.Name -match "[0-9].*" } | Sort-Object -Descending | % { "* $($_.Name) $($_.FullName)" } - -Add-ContentToMarkdown -Content $SdkList - - - -$Runtimes = @" - -_Runtime:_ -"@ - -Add-ContentToMarkdown -Content $Runtimes - -$RuntimeList =(Get-ChildItem "C:\Program Files\dotnet\shared\Microsoft.NETCore.App") | Where { $_.Name -match "[0-9].*" } | Sort-Object -Descending | % { "* $($_.Name) $($_.FullName)" } - -Add-ContentToMarkdown -Content $RuntimeList - +################################################################################ +## File: Validate-DotnetSDK.ps1 +## Desc: Validate dotnet +################################################################################ + +if(Get-Command -Name 'dotnet') +{ + Write-Host "dotnet $(dotnet --version) on path" +} +else +{ + Write-Host "dotnet is not on path" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = ".NET Core" + +$Description = @" +The following runtimes and SDKs are installed: + +_Environment:_ +* PATH: contains location of dotnet.exe + +_SDK:_ +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +$SdkList =(Get-ChildItem "C:\Program Files\dotnet\sdk") | Where { $_.Name -match "[0-9].*" } | Sort-Object -Descending | % { "* $($_.Name) $($_.FullName)" } + +Add-ContentToMarkdown -Content $SdkList + + + +$Runtimes = @" + +_Runtime:_ +"@ + +Add-ContentToMarkdown -Content $Runtimes + +$RuntimeList =(Get-ChildItem "C:\Program Files\dotnet\shared\Microsoft.NETCore.App") | Where { $_.Name -match "[0-9].*" } | Sort-Object -Descending | % { "* $($_.Name) $($_.FullName)" } + +Add-ContentToMarkdown -Content $RuntimeList + diff --git a/images/win/scripts/Installers/Validate-DotnetTLS.ps1 b/images/win/scripts/Installers/Validate-DotnetTLS.ps1 index 2ed4a4a08..b94be5ce1 100644 --- a/images/win/scripts/Installers/Validate-DotnetTLS.ps1 +++ b/images/win/scripts/Installers/Validate-DotnetTLS.ps1 @@ -1,28 +1,28 @@ -################################################################################ -## File: Validate-DotnetTLS.ps1 -## Desc: Validate DotNetFramework security protocol to TLS 1.2 -################################################################################ - -$protocols = [Net.ServicePointManager]::SecurityProtocol -$protocolArr = $protocols -split ', ' -if($protocolArr.Contains('Tls12')) -{ - Write-Host "Tls 1.2 has been enabled." -} -else -{ - Write-Host "Tls 1.2 has not been enabled." - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "TLS12" -$version = "1.2"; - -$Description = @" -_Version:_ $version
-_Description:_ .NET has been configured to use TLS 1.2 by default -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - +################################################################################ +## File: Validate-DotnetTLS.ps1 +## Desc: Validate DotNetFramework security protocol to TLS 1.2 +################################################################################ + +$protocols = [Net.ServicePointManager]::SecurityProtocol +$protocolArr = $protocols -split ', ' +if($protocolArr.Contains('Tls12')) +{ + Write-Host "Tls 1.2 has been enabled." +} +else +{ + Write-Host "Tls 1.2 has not been enabled." + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "TLS12" +$version = "1.2"; + +$Description = @" +_Version:_ $version
+_Description:_ .NET has been configured to use TLS 1.2 by default +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + diff --git a/images/win/scripts/Installers/Validate-Firefox.ps1 b/images/win/scripts/Installers/Validate-Firefox.ps1 index afe717070..f66b2c5fb 100644 --- a/images/win/scripts/Installers/Validate-Firefox.ps1 +++ b/images/win/scripts/Installers/Validate-Firefox.ps1 @@ -1,25 +1,25 @@ -################################################################################ -## File: Validate-Firefox.ps1 -## Desc: Validate Mozilla Firefox installation. -################################################################################ - -if(Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe") -{ - (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo - - $fileVersion = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo.FileVersion - $SoftwareName = "Mozilla Firefox" - $Description = @" -_version:_ -$fileVersion -"@ - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - exit 0 -} -else -{ - Write-Host "Mozilla Firefox is not installed." - exit 1 -} +################################################################################ +## File: Validate-Firefox.ps1 +## Desc: Validate Mozilla Firefox installation. +################################################################################ + +if(Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe") +{ + (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo + + $fileVersion = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo.FileVersion + $SoftwareName = "Mozilla Firefox" + $Description = @" +_version:_ +$fileVersion +"@ + + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + exit 0 +} +else +{ + Write-Host "Mozilla Firefox is not installed." + exit 1 +} diff --git a/images/win/scripts/Installers/Validate-Git.ps1 b/images/win/scripts/Installers/Validate-Git.ps1 index dacb967b7..6f2bb33f1 100644 --- a/images/win/scripts/Installers/Validate-Git.ps1 +++ b/images/win/scripts/Installers/Validate-Git.ps1 @@ -1,49 +1,49 @@ -################################################################################ -## File: Validate-Git.ps1 -## Desc: Validate Git for Windows -################################################################################ - -if((Get-Command -Name 'git') -and (Get-Command -Name 'bash') -and (Get-Command -Name 'awk') -and (Get-Command -Name 'git-lfs')) -{ - Write-Host "$(git version) on path" - Write-Host "$(git-lfs version) on path" -} -else -{ - Write-Host "git or git-lfs are not on path." - exit 1 -} - - -if( $(git version) -match 'git version (?.*).win.*' ) -{ - $gitVersion = $Matches.version -} - -if( $(git-lfs version) -match 'git-lfs\/(?.*) \(Git.*' ) -{ - $gitLfsVersion = $Matches.version -} - -# Adding description of the software to Markdown -$SoftwareName = "Git" - -$Description = @" -_Version:_ $gitVersion
-_Environment:_ -* PATH: contains location of git.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding description of the software to Markdown -$SoftwareName = "Git Large File Storage (LFS)" - -$Description = @" -_Version:_ $gitLfsVersion
-_Environment:_ -* PATH: contains location of git-lfs.exe -* GIT_LFS_PATH: location of git-lfs.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Git.ps1 +## Desc: Validate Git for Windows +################################################################################ + +if((Get-Command -Name 'git') -and (Get-Command -Name 'bash') -and (Get-Command -Name 'awk') -and (Get-Command -Name 'git-lfs')) +{ + Write-Host "$(git version) on path" + Write-Host "$(git-lfs version) on path" +} +else +{ + Write-Host "git or git-lfs are not on path." + exit 1 +} + + +if( $(git version) -match 'git version (?.*).win.*' ) +{ + $gitVersion = $Matches.version +} + +if( $(git-lfs version) -match 'git-lfs\/(?.*) \(Git.*' ) +{ + $gitLfsVersion = $Matches.version +} + +# Adding description of the software to Markdown +$SoftwareName = "Git" + +$Description = @" +_Version:_ $gitVersion
+_Environment:_ +* PATH: contains location of git.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +# Adding description of the software to Markdown +$SoftwareName = "Git Large File Storage (LFS)" + +$Description = @" +_Version:_ $gitLfsVersion
+_Environment:_ +* PATH: contains location of git-lfs.exe +* GIT_LFS_PATH: location of git-lfs.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-GitVersion.ps1 b/images/win/scripts/Installers/Validate-GitVersion.ps1 index 32aa2d88f..4b580c385 100644 --- a/images/win/scripts/Installers/Validate-GitVersion.ps1 +++ b/images/win/scripts/Installers/Validate-GitVersion.ps1 @@ -1,25 +1,25 @@ -################################################################################ -## File: Validate-GitVersion.ps1 -## Desc: Validate GitVersion -################################################################################ - -$command = Get-Command -Name 'gitversion' -if ($command) -{ - Write-Host "gitversion on path" -} -else -{ - Write-Host 'gitversion is not on path' - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "GitVersion" -$version = $command.Version.ToString() - -$Description = @" -_Version:_ $version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-GitVersion.ps1 +## Desc: Validate GitVersion +################################################################################ + +$command = Get-Command -Name 'gitversion' +if ($command) +{ + Write-Host "gitversion on path" +} +else +{ + Write-Host 'gitversion is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "GitVersion" +$version = $command.Version.ToString() + +$Description = @" +_Version:_ $version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Go.ps1 b/images/win/scripts/Installers/Validate-Go.ps1 index 08c237475..5ff3ad169 100644 --- a/images/win/scripts/Installers/Validate-Go.ps1 +++ b/images/win/scripts/Installers/Validate-Go.ps1 @@ -1,70 +1,70 @@ -################################################################################ -## File: Validate-Go.ps1 -## Desc: Validate Go -################################################################################ - -# Function that gets the version of Go at the specified path -function Get-GoVersion -{ - Param - ( - [String]$goRootPath - ) - - $env:Path = "$goRootPath\bin;" + $env:Path - if( $(go version) -match 'go version go(?.*) win.*' ) - { - $goVersion = $Matches.version - return $goVersion - } - - Write-Host "Unable to determine Go version at " + $goRootPath - return "" -} - -# Verify that go.exe is on the path -if(Get-Command -Name 'go') -{ - Write-Host "$(go version) is on the path." -} -else -{ - Write-Host "Go is not on the path." - exit 1 -} - -# Add details of available versions in Markdown -$tmplMark = @" -#### {0} - -_Environment:_ -* {1}: root directory of the Go {0} installation - -"@ - -$tmplMarkRoot = @" -#### {0} - -_Environment:_ -* PATH: contains the location of go.exe version {0} -* GOROOT: root directory of the Go {0} installation -* {1}: root directory of the Go {0} installation -"@ - -$SoftwareName = "Go (x64)" -$Description = New-Object System.Text.StringBuilder -$goVersionsToInstall = $env:GO_VERSIONS.split(",") - -foreach($go in $goVersionsToInstall) { - $goVersion = Get-GoVersion -goRootPath "C:\Go${go}" - $goVersionTag = "GOROOT_{0}_{1}_X64" -f $go.split(".") - if ($goVersion -eq $go) { - if($go -eq $env:GO_DEFAULT) { - $null = $Description.AppendLine(($tmplMarkRoot -f $goVersion, $goVersionTag)) - } else { - $null = $Description.AppendLine(($tmplMark -f $goVersion, $goVersionTag)) - } - } -} - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString() +################################################################################ +## File: Validate-Go.ps1 +## Desc: Validate Go +################################################################################ + +# Function that gets the version of Go at the specified path +function Get-GoVersion +{ + Param + ( + [String]$goRootPath + ) + + $env:Path = "$goRootPath\bin;" + $env:Path + if( $(go version) -match 'go version go(?.*) win.*' ) + { + $goVersion = $Matches.version + return $goVersion + } + + Write-Host "Unable to determine Go version at " + $goRootPath + return "" +} + +# Verify that go.exe is on the path +if(Get-Command -Name 'go') +{ + Write-Host "$(go version) is on the path." +} +else +{ + Write-Host "Go is not on the path." + exit 1 +} + +# Add details of available versions in Markdown +$tmplMark = @" +#### {0} + +_Environment:_ +* {1}: root directory of the Go {0} installation + +"@ + +$tmplMarkRoot = @" +#### {0} + +_Environment:_ +* PATH: contains the location of go.exe version {0} +* GOROOT: root directory of the Go {0} installation +* {1}: root directory of the Go {0} installation +"@ + +$SoftwareName = "Go (x64)" +$Description = New-Object System.Text.StringBuilder +$goVersionsToInstall = $env:GO_VERSIONS.split(",") + +foreach($go in $goVersionsToInstall) { + $goVersion = Get-GoVersion -goRootPath "C:\Go${go}" + $goVersionTag = "GOROOT_{0}_{1}_X64" -f $go.split(".") + if ($goVersion -eq $go) { + if($go -eq $env:GO_DEFAULT) { + $null = $Description.AppendLine(($tmplMarkRoot -f $goVersion, $goVersionTag)) + } else { + $null = $Description.AppendLine(($tmplMark -f $goVersion, $goVersionTag)) + } + } +} + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString() diff --git a/images/win/scripts/Installers/Validate-InnoSetup.ps1 b/images/win/scripts/Installers/Validate-InnoSetup.ps1 index 3caa70165..30f28ede1 100644 --- a/images/win/scripts/Installers/Validate-InnoSetup.ps1 +++ b/images/win/scripts/Installers/Validate-InnoSetup.ps1 @@ -1,27 +1,27 @@ -################################################################################ -## File: Validate-InnoSetup.ps1 -## Desc: Validate Inno Setup -################################################################################ - -if (Get-Command -Name 'iscc') -{ - Write-Host "iscc is on PATH" -} -else -{ - Write-Host "iscc is not on PATH" - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "Inno Setup" - -$ChocoList = $(choco list --local-only innosetup) | Select-String -Pattern "InnoSetup" -$ChocoList -Match "\d+\.\d+\.\d+" -$Version = $Matches[0] - -$Description = @" -_Version:_ $Version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-InnoSetup.ps1 +## Desc: Validate Inno Setup +################################################################################ + +if (Get-Command -Name 'iscc') +{ + Write-Host "iscc is on PATH" +} +else +{ + Write-Host "iscc is not on PATH" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Inno Setup" + +$ChocoList = $(choco list --local-only innosetup) | Select-String -Pattern "InnoSetup" +$ChocoList -Match "\d+\.\d+\.\d+" +$Version = $Matches[0] + +$Description = @" +_Version:_ $Version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-JavaTools.ps1 b/images/win/scripts/Installers/Validate-JavaTools.ps1 index 91ffb42eb..0fdd5c82a 100644 --- a/images/win/scripts/Installers/Validate-JavaTools.ps1 +++ b/images/win/scripts/Installers/Validate-JavaTools.ps1 @@ -1,113 +1,113 @@ -################################################################################ -## File: Validate-JavaTools.ps1 -## Desc: Validate various JDKs and java tools -################################################################################ - -if((Get-Command -Name 'java') -and (Get-Command -Name 'mvn') -and (Get-Command -Name 'ant') -and (Get-Command -Name 'gradle')) -{ - Write-Host "Java $(java -version) on path" - Write-Host "Maven $(mvn -version) on path" - Write-Host "Ant $(ant -version) on path" - Write-Host "Gradle $(gradle -version) on path" -} -else -{ - Write-Host "one of Java,Maven,Ant,Gradle is not on path." - exit 1 -} - - -if( $( $(& $env:comspec "/s /c java -version 2>&1") | Out-String) -match '^(?.+) version "(?.+)".*' ) -{ - $javaVersion = $Matches.version -} - -$env:Path = $env:JAVA_HOME_7_X64 + "\bin;" + $env:Path - -if( $( $(& $env:comspec "/s /c java -version 2>&1") | Out-String) -match '^(?.+) version "(?.+)".*' ) -{ - $java7Version = $Matches.version -} - -$env:Path = $env:JAVA_HOME_11_X64 + "\bin;" + $env:Path - -if( $( $(& $env:comspec "/s /c java -version 2>&1") | Out-String) -match '^(?.+) version "(?.+)".*' ) -{ - $java11Version = $Matches.version -} - - -if( $(ant -version) -match 'Apache Ant\(TM\) version (?.*) compiled.*' ) -{ - $antVersion = $Matches.version -} - -if( $( $(mvn -version) | Out-String) -match 'Apache Maven (?.*) \(.*' ) -{ - $mvnVersion = $Matches.version -} - -if( $( $(gradle -version) | Out-String) -match 'Gradle (?.*)' ) -{ - $gradleVersion = $Matches.version.Trim() -} - -# Adding description of the software to Markdown -$SoftwareName = "Java Development Kit" - -$Description = @" -#### $javaVersion - -_Environment:_ -* JAVA_HOME: location of JDK -* PATH: contains bin folder of JDK - -#### $java7Version - -_Location:_ $env:JAVA_HOME_7_X64 - -#### $java11Version - -_Location:_ $env:JAVA_HOME_11_X64 -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - -# Adding description of the software to Markdown -$SoftwareName = "Ant" - -$Description = @" -_Version:_ $antVersion
-_Environment:_ -* PATH: contains location of ant.cmd -* ANT_HOME: location of ant.cmd -* COBERTURA_HOME: location of cobertura-2.1.1.jar -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - -# Adding description of the software to Markdown -$SoftwareName = "Maven" - -$Description = @" -_Version:_ $mvnVersion
-_Environment:_ -* PATH: contains location of mvn.bat -* M2_HOME: Maven installation root -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - -# Adding description of the software to Markdown -$SoftwareName = "Gradle" - -$Description = @" -_Version:_ $gradleVersion
-_Environment:_ -* PATH: contains location of gradle -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-JavaTools.ps1 +## Desc: Validate various JDKs and java tools +################################################################################ + +if((Get-Command -Name 'java') -and (Get-Command -Name 'mvn') -and (Get-Command -Name 'ant') -and (Get-Command -Name 'gradle')) +{ + Write-Host "Java $(java -version) on path" + Write-Host "Maven $(mvn -version) on path" + Write-Host "Ant $(ant -version) on path" + Write-Host "Gradle $(gradle -version) on path" +} +else +{ + Write-Host "one of Java,Maven,Ant,Gradle is not on path." + exit 1 +} + + +if( $( $(& $env:comspec "/s /c java -version 2>&1") | Out-String) -match '^(?.+) version "(?.+)".*' ) +{ + $javaVersion = $Matches.version +} + +$env:Path = $env:JAVA_HOME_7_X64 + "\bin;" + $env:Path + +if( $( $(& $env:comspec "/s /c java -version 2>&1") | Out-String) -match '^(?.+) version "(?.+)".*' ) +{ + $java7Version = $Matches.version +} + +$env:Path = $env:JAVA_HOME_11_X64 + "\bin;" + $env:Path + +if( $( $(& $env:comspec "/s /c java -version 2>&1") | Out-String) -match '^(?.+) version "(?.+)".*' ) +{ + $java11Version = $Matches.version +} + + +if( $(ant -version) -match 'Apache Ant\(TM\) version (?.*) compiled.*' ) +{ + $antVersion = $Matches.version +} + +if( $( $(mvn -version) | Out-String) -match 'Apache Maven (?.*) \(.*' ) +{ + $mvnVersion = $Matches.version +} + +if( $( $(gradle -version) | Out-String) -match 'Gradle (?.*)' ) +{ + $gradleVersion = $Matches.version.Trim() +} + +# Adding description of the software to Markdown +$SoftwareName = "Java Development Kit" + +$Description = @" +#### $javaVersion + +_Environment:_ +* JAVA_HOME: location of JDK +* PATH: contains bin folder of JDK + +#### $java7Version + +_Location:_ $env:JAVA_HOME_7_X64 + +#### $java11Version + +_Location:_ $env:JAVA_HOME_11_X64 +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + +# Adding description of the software to Markdown +$SoftwareName = "Ant" + +$Description = @" +_Version:_ $antVersion
+_Environment:_ +* PATH: contains location of ant.cmd +* ANT_HOME: location of ant.cmd +* COBERTURA_HOME: location of cobertura-2.1.1.jar +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + +# Adding description of the software to Markdown +$SoftwareName = "Maven" + +$Description = @" +_Version:_ $mvnVersion
+_Environment:_ +* PATH: contains location of mvn.bat +* M2_HOME: Maven installation root +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + +# Adding description of the software to Markdown +$SoftwareName = "Gradle" + +$Description = @" +_Version:_ $gradleVersion
+_Environment:_ +* PATH: contains location of gradle +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Jq.ps1 b/images/win/scripts/Installers/Validate-Jq.ps1 index 85bf2318a..b61ddae85 100644 --- a/images/win/scripts/Installers/Validate-Jq.ps1 +++ b/images/win/scripts/Installers/Validate-Jq.ps1 @@ -1,23 +1,23 @@ -################################################################################ -## File: Validate-Jq.ps1 -## Desc: Validate jq -################################################################################ - -if (Get-Command -Name 'jq') -{ - Write-Host "jq on path" -} -else -{ - Write-Host 'jq is not on path' - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "jq" - -$Description = @" -_Version:_ $(jq --version)
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Jq.ps1 +## Desc: Validate jq +################################################################################ + +if (Get-Command -Name 'jq') +{ + Write-Host "jq on path" +} +else +{ + Write-Host 'jq is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "jq" + +$Description = @" +_Version:_ $(jq --version)
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Kind.ps1 b/images/win/scripts/Installers/Validate-Kind.ps1 index 2a33e1de8..9dd12861a 100644 --- a/images/win/scripts/Installers/Validate-Kind.ps1 +++ b/images/win/scripts/Installers/Validate-Kind.ps1 @@ -1,28 +1,28 @@ -################################################################################ -## File: Validate-Kind.ps1 -## Desc: Validate Kind. -################################################################################ - - -if((Get-Command -Name 'kind')) -{ - Write-Host "kind $(kind version) in path" -} -else -{ - Write-Host "kind is not in path" - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "Kind" - -$version = $(kind version) - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of kind.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Kind.ps1 +## Desc: Validate Kind. +################################################################################ + + +if((Get-Command -Name 'kind')) +{ + Write-Host "kind $(kind version) in path" +} +else +{ + Write-Host "kind is not in path" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Kind" + +$version = $(kind version) + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of kind.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-KubernetesCli.ps1 b/images/win/scripts/Installers/Validate-KubernetesCli.ps1 index 05666c14a..da83f2fbe 100644 --- a/images/win/scripts/Installers/Validate-KubernetesCli.ps1 +++ b/images/win/scripts/Installers/Validate-KubernetesCli.ps1 @@ -1,28 +1,28 @@ -################################################################################ -## File: Validate-KubernetesCli.ps1 -## Desc: Validate KubernetesCli. -################################################################################ - - -if((Get-Command -Name 'kubectl')) -{ - Write-Host "kubectl $(kubectl version --client=true --short=true) in path" -} -else -{ - Write-Host "kubectl is not in path" - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "Kubectl" - -$version = $(kubectl version --client=true --short=true) - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of kubectl.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-KubernetesCli.ps1 +## Desc: Validate KubernetesCli. +################################################################################ + + +if((Get-Command -Name 'kubectl')) +{ + Write-Host "kubectl $(kubectl version --client=true --short=true) in path" +} +else +{ + Write-Host "kubectl is not in path" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Kubectl" + +$version = $(kubectl version --client=true --short=true) + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of kubectl.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Mercurial.ps1 b/images/win/scripts/Installers/Validate-Mercurial.ps1 index 7351fcab8..6212d5f28 100644 --- a/images/win/scripts/Installers/Validate-Mercurial.ps1 +++ b/images/win/scripts/Installers/Validate-Mercurial.ps1 @@ -1,25 +1,25 @@ -################################################################################ -## File: Validate-Mercurial.ps1 -## Desc: Validate Mercurial -################################################################################ - -if (Get-Command -Name 'hg') -{ - Write-Host "Mercurial on path" -} -else -{ - Write-Host 'Mercurial is not on path' - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "Mercurial" -$(hg --version).Split([System.Environment]::NewLine)[0] -match "\d+\.\d+\.\d+" -$MercurialVersion = $matches[0] - -$Description = @" -_Version:_ $MercurialVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Mercurial.ps1 +## Desc: Validate Mercurial +################################################################################ + +if (Get-Command -Name 'hg') +{ + Write-Host "Mercurial on path" +} +else +{ + Write-Host 'Mercurial is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Mercurial" +$(hg --version).Split([System.Environment]::NewLine)[0] -match "\d+\.\d+\.\d+" +$MercurialVersion = $matches[0] + +$Description = @" +_Version:_ $MercurialVersion
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-MinGW.ps1 b/images/win/scripts/Installers/Validate-MinGW.ps1 index 78c5910f3..475372cd0 100644 --- a/images/win/scripts/Installers/Validate-MinGW.ps1 +++ b/images/win/scripts/Installers/Validate-MinGW.ps1 @@ -1,57 +1,57 @@ -################################################################################ -## File: Validate-MinGW.ps1 -## Desc: Validate MinGW -################################################################################ - -if (Get-Command -Name 'gcc') -{ - Write-Host "gcc is successfully installed:" - gcc --version | Write-Host -} -else -{ - Write-Host "gcc is not on PATH" - exit 1 -} - -if (Get-Command -Name 'g++') -{ - Write-Host "g++ is successfully installed:" - g++ --version | Write-Host -} -else -{ - Write-Host "g++ is not on PATH" - exit 1 -} - -if (Get-Command -Name 'make') -{ - Write-Host "make is successfully installed:" - make --version | Write-Host -} -else -{ - Write-Host "make is not on PATH" - exit 1 -} - -# Adding description of the software to Markdown - -# `gcc --version` gives output like: -# gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.3.0 -# Copyright (C) 2015 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -$SoftwareName = "MinGW" -$(gcc --version).Split([System.Environment]::NewLine)[0] -match "\d\.\d\.\d$" -$minGwVersion = $matches[0] - -$Description = @" -_Version:_ $minGwVersion
-_Environment:_ -* PATH: contains location of the MinGW 'bin' directory -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-MinGW.ps1 +## Desc: Validate MinGW +################################################################################ + +if (Get-Command -Name 'gcc') +{ + Write-Host "gcc is successfully installed:" + gcc --version | Write-Host +} +else +{ + Write-Host "gcc is not on PATH" + exit 1 +} + +if (Get-Command -Name 'g++') +{ + Write-Host "g++ is successfully installed:" + g++ --version | Write-Host +} +else +{ + Write-Host "g++ is not on PATH" + exit 1 +} + +if (Get-Command -Name 'make') +{ + Write-Host "make is successfully installed:" + make --version | Write-Host +} +else +{ + Write-Host "make is not on PATH" + exit 1 +} + +# Adding description of the software to Markdown + +# `gcc --version` gives output like: +# gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.3.0 +# Copyright (C) 2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +$SoftwareName = "MinGW" +$(gcc --version).Split([System.Environment]::NewLine)[0] -match "\d\.\d\.\d$" +$minGwVersion = $matches[0] + +$Description = @" +_Version:_ $minGwVersion
+_Environment:_ +* PATH: contains location of the MinGW 'bin' directory +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Miniconda.ps1 b/images/win/scripts/Installers/Validate-Miniconda.ps1 index defd8a73f..ca48b40f4 100644 --- a/images/win/scripts/Installers/Validate-Miniconda.ps1 +++ b/images/win/scripts/Installers/Validate-Miniconda.ps1 @@ -1,36 +1,36 @@ -################################################################################ -## File: Validate-Miniconda.ps1 -## Desc: Validate Miniconda -################################################################################ - -if ($env:CONDA) -{ - Write-Host "The CONDA environment variable is set" - Write-Host $env:CONDA -} -else -{ - Write-Host "The CONDA environment variable is not set" - exit 1 -} - -if ((Test-Path "$env:CONDA\python.exe") -and (Test-Path "$env:CONDA\Scripts\conda.exe")) -{ - Write-Host "Miniconda is successfully installed:" - & "$env:CONDA\Scripts\conda.exe" --version | Write-Host -} -else -{ - Write-Host "Miniconda is not installed" - exit 1 -} - -$softwareName = "Miniconda" -$description = @" -_Version:_ $(& "$env:CONDA\Scripts\conda.exe" --version)
-_Environment:_ -* CONDA: contains location of the root of the Miniconda installation -"@ - -# Adding description of the software to Markdown -Add-SoftwareDetailsToMarkdown -SoftwareName $softwareName -DescriptionMarkdown $description +################################################################################ +## File: Validate-Miniconda.ps1 +## Desc: Validate Miniconda +################################################################################ + +if ($env:CONDA) +{ + Write-Host "The CONDA environment variable is set" + Write-Host $env:CONDA +} +else +{ + Write-Host "The CONDA environment variable is not set" + exit 1 +} + +if ((Test-Path "$env:CONDA\python.exe") -and (Test-Path "$env:CONDA\Scripts\conda.exe")) +{ + Write-Host "Miniconda is successfully installed:" + & "$env:CONDA\Scripts\conda.exe" --version | Write-Host +} +else +{ + Write-Host "Miniconda is not installed" + exit 1 +} + +$softwareName = "Miniconda" +$description = @" +_Version:_ $(& "$env:CONDA\Scripts\conda.exe" --version)
+_Environment:_ +* CONDA: contains location of the root of the Miniconda installation +"@ + +# Adding description of the software to Markdown +Add-SoftwareDetailsToMarkdown -SoftwareName $softwareName -DescriptionMarkdown $description diff --git a/images/win/scripts/Installers/Validate-MysqlCli.ps1 b/images/win/scripts/Installers/Validate-MysqlCli.ps1 index 2e4e82965..f056bee80 100644 --- a/images/win/scripts/Installers/Validate-MysqlCli.ps1 +++ b/images/win/scripts/Installers/Validate-MysqlCli.ps1 @@ -1,27 +1,27 @@ -################################################################################ -## File: Validate-MysqlCli.ps1 -## Desc: Validate Mysql Cli -################################################################################ - -$command = Get-Command -Name 'mysql' -if($command) -{ - Write-Host "Mysql is on path" -} -else -{ - Write-Host 'Mysql not on path' - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "Mysql" -$version = $command.Version.ToString(); - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of mysql.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-MysqlCli.ps1 +## Desc: Validate Mysql Cli +################################################################################ + +$command = Get-Command -Name 'mysql' +if($command) +{ + Write-Host "Mysql is on path" +} +else +{ + Write-Host 'Mysql not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Mysql" +$version = $command.Version.ToString(); + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of mysql.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NET472.ps1 b/images/win/scripts/Installers/Validate-NET472.ps1 index 20c9d2c0f..fb791a4ac 100644 --- a/images/win/scripts/Installers/Validate-NET472.ps1 +++ b/images/win/scripts/Installers/Validate-NET472.ps1 @@ -1,27 +1,27 @@ -################################################################################ -## File: Validate-NET472.ps1 -## Desc: Validate .NET 4.7.2 -################################################################################ - -Import-Module -Name ImageHelpers -Force - -# For reference, visit https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a -if(Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 461814 }) -{ - $version = Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Version - Write-Host "Installed .Net version " $version -} -else { - Write-Host ".Net 472 not found" - exit 1 -} - - -# Adding description of the software to Markdown -$SoftwareName = ".NET 4.7.2" - -$Description = @" -_Version:_ $version -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-NET472.ps1 +## Desc: Validate .NET 4.7.2 +################################################################################ + +Import-Module -Name ImageHelpers -Force + +# For reference, visit https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a +if(Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 461814 }) +{ + $version = Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Version + Write-Host "Installed .Net version " $version +} +else { + Write-Host ".Net 472 not found" + exit 1 +} + + +# Adding description of the software to Markdown +$SoftwareName = ".NET 4.7.2" + +$Description = @" +_Version:_ $version +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NET48.ps1 b/images/win/scripts/Installers/Validate-NET48.ps1 index fce090bd9..d48565bf8 100644 --- a/images/win/scripts/Installers/Validate-NET48.ps1 +++ b/images/win/scripts/Installers/Validate-NET48.ps1 @@ -1,27 +1,27 @@ -################################################################################ -## File: Validate-NET48.ps1 -## Desc: Validate .NET 4.8 -################################################################################ - -Import-Module -Name ImageHelpers -Force - -# For reference, visit https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a -if(Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 528049 }) -{ - $version = Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Version - Write-Host "Installed .Net version " $version -} -else { - Write-Host ".Net 48 not found" - exit 1 -} - - -# Adding description of the software to Markdown -$SoftwareName = ".NET 4.8" - -$Description = @" -_Version:_ $version -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-NET48.ps1 +## Desc: Validate .NET 4.8 +################################################################################ + +Import-Module -Name ImageHelpers -Force + +# For reference, visit https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a +if(Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 528049 }) +{ + $version = Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Version + Write-Host "Installed .Net version " $version +} +else { + Write-Host ".Net 48 not found" + exit 1 +} + + +# Adding description of the software to Markdown +$SoftwareName = ".NET 4.8" + +$Description = @" +_Version:_ $version +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NSIS.ps1 b/images/win/scripts/Installers/Validate-NSIS.ps1 index a9865e41c..b38624e75 100644 --- a/images/win/scripts/Installers/Validate-NSIS.ps1 +++ b/images/win/scripts/Installers/Validate-NSIS.ps1 @@ -1,32 +1,32 @@ -################################################################################ -## File: Validate-NSIS.ps1 -## Desc: Validate NSIS installation. -################################################################################ - -$SoftwareName = 'Nullsoft Install System (NSIS)' - -if (Get-Command -Name makensis) -{ - Write-Host "$SoftwareName is installed" -} -else -{ - Write-Host "$SoftwareName is not installed" - exit 1 -} - -# Adding description of the software to Markdown -$ChocoList = $(choco list --local-only nsis) | Select-String -Pattern "nsis" | Select-Object -First 1 - -if ($ChocoList -Match "\d+\.\d+") -{ - $Version = $Matches[0] -} - - -$Description = @" -_Version:_ $Version
-"@ - -#Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description -Write-Host $description +################################################################################ +## File: Validate-NSIS.ps1 +## Desc: Validate NSIS installation. +################################################################################ + +$SoftwareName = 'Nullsoft Install System (NSIS)' + +if (Get-Command -Name makensis) +{ + Write-Host "$SoftwareName is installed" +} +else +{ + Write-Host "$SoftwareName is not installed" + exit 1 +} + +# Adding description of the software to Markdown +$ChocoList = $(choco list --local-only nsis) | Select-String -Pattern "nsis" | Select-Object -First 1 + +if ($ChocoList -Match "\d+\.\d+") +{ + $Version = $Matches[0] +} + + +$Description = @" +_Version:_ $Version
+"@ + +#Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +Write-Host $description diff --git a/images/win/scripts/Installers/Validate-NodeLts.ps1 b/images/win/scripts/Installers/Validate-NodeLts.ps1 index 49b10b65e..14ce90c6e 100644 --- a/images/win/scripts/Installers/Validate-NodeLts.ps1 +++ b/images/win/scripts/Installers/Validate-NodeLts.ps1 @@ -1,71 +1,68 @@ -################################################################################ -## File: Validate-NodeLts.ps1 -## Desc: Validate nodejs-lts and other common node tools. -################################################################################ - -if((Get-Command -Name 'node') -and (Get-Command -Name 'npm')) -{ - Write-Host "Node $(node --version) on path" - Write-Host "Npm $(npm -version) on path" -} -else -{ - Write-Host "Node or npm is not on path" - exit 1 -} - -if((Get-Command -Name 'gulp') -and (Get-Command -Name 'grunt') -and (Get-Command -Name 'bower') -and (Get-Command -Name 'cordova') -and (Get-Command -Name 'yarn')) -{ - Write-Host "Gulp $(gulp -version) on path" - Write-Host "Grunt $(grunt -version) on path" - Write-Host "Bower $(bower -version) on path" - Write-Host "Yarn $(yarn -version) on path" -} -else -{ - Write-Host "One of Gulp, Grunt, Bower, Cordova, or Yarn is not on the path." - exit 1 -} - - - -if( $(node --version) -match 'v(?.*)' ) -{ - $nodeVersion = $Matches.version - $nodeArch = $(node -e "console.log(process.arch)") -} - -$npmVersion = $(npm -version) - -# Adding description of the software to Markdown -$SoftwareName = "Node.js" -$GulpInfo = "Gulp $(gulp -version)" -$GruntInfo = "Grunt $(grunt -version)" -$BowerInfo = "Bower $(bower -version)" -$YarnInfo = "Yarn $(yarn -version)" - -$Description = @" -_Version:_ $nodeVersion
-_Architecture:_ $nodeArch
-_Environment:_ -* PATH: contains location of node.exe
-* $GulpInfo
-* $GruntInfo
-* $BowerInfo
-* $YarnInfo
- -> Note: You can install and use another version of Node.js on Microsoft-hosted agent pools using the [Node tool installer](https://docs.microsoft.com/vsts/pipelines/tasks/tool/node-js) task. -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding description of the software to Markdown -$SoftwareName = "npm" - -$Description = @" -_Version:_ $npmVersion
-_Environment:_ -* PATH: contains location of npm.cmd -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-NodeLts.ps1 +## Desc: Validate nodejs-lts and other common node tools. +################################################################################ + +if((Get-Command -Name 'node') -and (Get-Command -Name 'npm')) +{ + Write-Host "Node $(node --version) on path" + Write-Host "Npm $(npm -version) on path" +} +else +{ + Write-Host "Node or npm is not on path" + exit 1 +} + +if((Get-Command -Name 'gulp') -and (Get-Command -Name 'grunt') -and (Get-Command -Name 'cordova') -and (Get-Command -Name 'yarn')) +{ + Write-Host "Gulp $(gulp -version) on path" + Write-Host "Grunt $(grunt -version) on path" + Write-Host "Yarn $(yarn -version) on path" +} +else +{ + Write-Host "One of Gulp, Grunt, Cordova, or Yarn is not on the path." + exit 1 +} + + + +if( $(node --version) -match 'v(?.*)' ) +{ + $nodeVersion = $Matches.version + $nodeArch = $(node -e "console.log(process.arch)") +} + +$npmVersion = $(npm -version) + +# Adding description of the software to Markdown +$SoftwareName = "Node.js" +$GulpInfo = "Gulp $(gulp -version)" +$GruntInfo = "Grunt $(grunt -version)" +$YarnInfo = "Yarn $(yarn -version)" + +$Description = @" +_Version:_ $nodeVersion
+_Architecture:_ $nodeArch
+_Environment:_ +* PATH: contains location of node.exe
+* $GulpInfo
+* $GruntInfo
+* $YarnInfo
+ +> Note: You can install and use another version of Node.js on Microsoft-hosted agent pools using the [Node tool installer](https://docs.microsoft.com/vsts/pipelines/tasks/tool/node-js) task. +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +# Adding description of the software to Markdown +$SoftwareName = "npm" + +$Description = @" +_Version:_ $npmVersion
+_Environment:_ +* PATH: contains location of npm.cmd +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-OpenSSL.ps1 b/images/win/scripts/Installers/Validate-OpenSSL.ps1 index fb7b79275..12791491d 100644 --- a/images/win/scripts/Installers/Validate-OpenSSL.ps1 +++ b/images/win/scripts/Installers/Validate-OpenSSL.ps1 @@ -1,29 +1,29 @@ -################################################################################ -## File: Validate-OpenSSL.ps1 -## Desc: Validate openssl -################################################################################ - -if (Get-Command -Name 'openssl') -{ - Write-Host "openssl on path" -} -else -{ - Write-Host 'openssl is not on path' - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "OpenSSL" - -$versions = Get-Command openssl -All -foreach ($version in $versions) -{ - $command = "& `"$($version.Source)`" version" - if ( $(Invoke-Expression -Command $command) -match '\d+\.\d+\.\d+\w?' ) - { - $Description += "_Version:_ $($Matches[0]) at $($version.Source)
" - } -} - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-OpenSSL.ps1 +## Desc: Validate openssl +################################################################################ + +if (Get-Command -Name 'openssl') +{ + Write-Host "openssl on path" +} +else +{ + Write-Host 'openssl is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "OpenSSL" + +$versions = Get-Command openssl -All +foreach ($version in $versions) +{ + $command = "& `"$($version.Source)`" version" + if ( $(Invoke-Expression -Command $command) -match '\d+\.\d+\.\d+\w?' ) + { + $Description += "_Version:_ $($Matches[0]) at $($version.Source)
" + } +} + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-PHP.ps1 b/images/win/scripts/Installers/Validate-PHP.ps1 index 6f6044efe..a8663617f 100644 --- a/images/win/scripts/Installers/Validate-PHP.ps1 +++ b/images/win/scripts/Installers/Validate-PHP.ps1 @@ -1,49 +1,49 @@ -################################################################################ -## File: Validate-PHP.ps1 -## Desc: Validate PHP -################################################################################ - -# Function that gets the version of php at the specified path -function Get-PHPVersion -{ - Param - ( - [String]$phpRootPath - ) - - $env:Path = "$phpRootPath;" + $env:Path - if($($(php --version)| Out-String) -match 'PHP (?.*) (.*cli).*') - { - $phpVersion = $Matches.version - return $phpVersion - } - - Write-Host "Unable to determine PHP version at " + $phpRootPath - exit 1 -} - -# Verify that php.exe is on the path -if(Get-Command -Name 'php') -{ - Write-Host "$(php --version) is on the path." -} -else -{ - Write-Host "php is not on the path." - exit 1 -} - -# Get available versions of PHP -$phpVersionOnPath = Get-PHPVersion -phpRootPath "C:\tools\php72" - -# Add details of available versions in Markdown -$SoftwareName = "PHP (x64)" -$Description = @" -#### $phpVersionOnPath - -_Environment:_ -* PATH: contains the location of php.exe version $phpVersionOnPath -* PHPROOT: root directory of the PHP $phpVersionOnPath installation -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-PHP.ps1 +## Desc: Validate PHP +################################################################################ + +# Function that gets the version of php at the specified path +function Get-PHPVersion +{ + Param + ( + [String]$phpRootPath + ) + + $env:Path = "$phpRootPath;" + $env:Path + if($($(php --version)| Out-String) -match 'PHP (?.*) (.*cli).*') + { + $phpVersion = $Matches.version + return $phpVersion + } + + Write-Host "Unable to determine PHP version at " + $phpRootPath + exit 1 +} + +# Verify that php.exe is on the path +if(Get-Command -Name 'php') +{ + Write-Host "$(php --version) is on the path." +} +else +{ + Write-Host "php is not on the path." + exit 1 +} + +# Get available versions of PHP +$phpVersionOnPath = Get-PHPVersion -phpRootPath "C:\tools\php72" + +# Add details of available versions in Markdown +$SoftwareName = "PHP (x64)" +$Description = @" +#### $phpVersionOnPath + +_Environment:_ +* PATH: contains the location of php.exe version $phpVersionOnPath +* PHPROOT: root directory of the PHP $phpVersionOnPath installation +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Perl.ps1 b/images/win/scripts/Installers/Validate-Perl.ps1 index 95443640f..6c0abc266 100644 --- a/images/win/scripts/Installers/Validate-Perl.ps1 +++ b/images/win/scripts/Installers/Validate-Perl.ps1 @@ -1,23 +1,23 @@ -################################################################################ -## File: Validate-Perl.ps1 -## Desc: Validate perl -################################################################################ - -if (Get-Command -Name 'perl') -{ - Write-Host "perl on path" -} -else -{ - Write-Host 'perl is not on path' - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "Perl" - -$Description = @" -_Version:_ $(perl -e 'print $^V')
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Perl.ps1 +## Desc: Validate perl +################################################################################ + +if (Get-Command -Name 'perl') +{ + Write-Host "perl on path" +} +else +{ + Write-Host 'perl is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Perl" + +$Description = @" +_Version:_ $(perl -e 'print $^V')
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-PowershellCore.ps1 b/images/win/scripts/Installers/Validate-PowershellCore.ps1 index 088a55bfc..1501ba876 100644 --- a/images/win/scripts/Installers/Validate-PowershellCore.ps1 +++ b/images/win/scripts/Installers/Validate-PowershellCore.ps1 @@ -1,28 +1,28 @@ -################################################################################ -## File: Validate-PowershellCore.ps1 -## Desc: Validate Powershell Core -################################################################################ - -if (Get-Command -Name 'pwsh') -{ - Write-Host "pwsh is on PATH" -} -else -{ - Write-Host "pwsh is not on PATH" - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "Powershell Core" - -if(($(pwsh --version) | Out-String) -match 'PowerShell (?.*)') -{ - $PowershellVersion = $Matches.version -} - -$Description = @" -_Version:_ $PowershellVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-PowershellCore.ps1 +## Desc: Validate Powershell Core +################################################################################ + +if (Get-Command -Name 'pwsh') +{ + Write-Host "pwsh is on PATH" +} +else +{ + Write-Host "pwsh is not on PATH" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Powershell Core" + +if(($(pwsh --version) | Out-String) -match 'PowerShell (?.*)') +{ + $PowershellVersion = $Matches.version +} + +$Description = @" +_Version:_ $PowershellVersion
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Python.ps1 b/images/win/scripts/Installers/Validate-Python.ps1 index 425817644..7e2ee6e46 100644 --- a/images/win/scripts/Installers/Validate-Python.ps1 +++ b/images/win/scripts/Installers/Validate-Python.ps1 @@ -1,45 +1,45 @@ -################################################################################ -## File: Validate-Python.ps1 -## Desc: Configure python on path based on what is installed in the tools cache -## Must run after tools cache is downloaded and validated -################################################################################ - -if(Get-Command -Name 'python') -{ - Write-Host "Python $(& python -V 2>&1) on path" -} -else -{ - Write-Host "Python is not on path" - exit 1 -} - -$Python3Version = $(& python -V 2>&1) - -if ($Python3Version -notlike "Python 3.*") -{ - Write-Error "Python 3 is not in the PATH" -} - - -$python2path = $Env:AGENT_TOOLSDIRECTORY + '/Python/2.7*/x64' -$python2Dir = Get-Item -Path $python2path - -$env:Path = $python2Dir.FullName + ";" + $env:Path - -$Python2Version = & $env:comspec "/s /c python --version 2>&1" - -# Adding description of the software to Markdown -$SoftwareName = "Python (64 bit)" - -$Description = @" -#### $Python3Version -_Environment:_ -* PATH: contains location of python.exe - -#### $Python2Version - -_Location:_ $Python2Path -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Python.ps1 +## Desc: Configure python on path based on what is installed in the tools cache +## Must run after tools cache is downloaded and validated +################################################################################ + +if(Get-Command -Name 'python') +{ + Write-Host "Python $(& python -V 2>&1) on path" +} +else +{ + Write-Host "Python is not on path" + exit 1 +} + +$Python3Version = $(& python -V 2>&1) + +if ($Python3Version -notlike "Python 3.*") +{ + Write-Error "Python 3 is not in the PATH" +} + + +$python2path = $Env:AGENT_TOOLSDIRECTORY + '/Python/2.7*/x64' +$python2Dir = Get-Item -Path $python2path + +$env:Path = $python2Dir.FullName + ";" + $env:Path + +$Python2Version = & $env:comspec "/s /c python --version 2>&1" + +# Adding description of the software to Markdown +$SoftwareName = "Python (64 bit)" + +$Description = @" +#### $Python3Version +_Environment:_ +* PATH: contains location of python.exe + +#### $Python2Version + +_Location:_ $Python2Path +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Ruby.ps1 b/images/win/scripts/Installers/Validate-Ruby.ps1 index 5243ab4d2..73e11a08b 100644 --- a/images/win/scripts/Installers/Validate-Ruby.ps1 +++ b/images/win/scripts/Installers/Validate-Ruby.ps1 @@ -1,53 +1,53 @@ -################################################################################ -## File: Validate-Ruby.ps1 -## Desc: Verify that Ruby is on the path and output version information. -################################################################################ - -# Function that gets the version of Ruby at the specified path -function Get-RubyVersion -{ - Param - ( - [String]$rubyRootPath - ) - - # Prepend to the path like: C:\hostedtoolcache\windows\Ruby\2.5.0\x64\bin - $env:Path = "$rubyRootPath;" + $env:Path - - # Extract the version from Ruby output like: ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32] - if( $(ruby --version) -match 'ruby (?.*) \(.*' ) - { - $rubyVersion = $Matches.version - return $rubyVersion - } - - Write-Host "Unable to determine Ruby version at " + $rubyRootPath - exit 1 -} - -# Verify that ruby is on the path -if(Get-Command -Name 'ruby') -{ - Write-Host "$(ruby --version) is on the path." -} -else -{ - Write-Host "Ruby is not on the path." - exit 1 -} - -# Default Ruby Version on Path -$rubyExeOnPath = (Get-Command -Name 'ruby').Path -$rubyBinOnPath = Split-Path -Path $rubyExeOnPath -$rubyVersionOnPath = Get-RubyVersion -rubyRootPath $rubyBinOnPath - -# Add details of available versions in Markdown -$SoftwareName = "Ruby (x64)" -$Description = @" -#### $rubyVersionOnPath -_Environment:_ -* Location: $rubyBinOnPath -* PATH: contains the location of ruby.exe version $rubyVersionOnPath -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Ruby.ps1 +## Desc: Verify that Ruby is on the path and output version information. +################################################################################ + +# Function that gets the version of Ruby at the specified path +function Get-RubyVersion +{ + Param + ( + [String]$rubyRootPath + ) + + # Prepend to the path like: C:\hostedtoolcache\windows\Ruby\2.5.0\x64\bin + $env:Path = "$rubyRootPath;" + $env:Path + + # Extract the version from Ruby output like: ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32] + if( $(ruby --version) -match 'ruby (?.*) \(.*' ) + { + $rubyVersion = $Matches.version + return $rubyVersion + } + + Write-Host "Unable to determine Ruby version at " + $rubyRootPath + exit 1 +} + +# Verify that ruby is on the path +if(Get-Command -Name 'ruby') +{ + Write-Host "$(ruby --version) is on the path." +} +else +{ + Write-Host "Ruby is not on the path." + exit 1 +} + +# Default Ruby Version on Path +$rubyExeOnPath = (Get-Command -Name 'ruby').Path +$rubyBinOnPath = Split-Path -Path $rubyExeOnPath +$rubyVersionOnPath = Get-RubyVersion -rubyRootPath $rubyBinOnPath + +# Add details of available versions in Markdown +$SoftwareName = "Ruby (x64)" +$Description = @" +#### $rubyVersionOnPath +_Environment:_ +* Location: $rubyBinOnPath +* PATH: contains the location of ruby.exe version $rubyVersionOnPath +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Rust.ps1 b/images/win/scripts/Installers/Validate-Rust.ps1 index a1e8694d4..e80a72493 100644 --- a/images/win/scripts/Installers/Validate-Rust.ps1 +++ b/images/win/scripts/Installers/Validate-Rust.ps1 @@ -1,34 +1,34 @@ -################################################################################ -## File: Validate-Rust.ps1 -## Desc: Verify that Rust is on the path and output version information. -################################################################################ - -if (Get-Command -Name 'rustc') -{ - Push-Location -Path $env:UserProfile - New-Item -Name ".rustup" -Value "C:\Rust\.rustup" -ItemType Junction - New-Item -Name ".cargo" -Value "C:\Rust\.cargo" -ItemType Junction - $RustcVersion = rustc --version - Write-Host "$RustcVersion is on the path" - Pop-Location -} -else -{ - Write-Host "rustc is not on the path" - exit 1 -} - -$RustPath = Split-Path (Get-Command -Name 'rustc').Path -$RustcVersion -Match "\d+\.\d+\.\d+" | Out-Null -$Version = $Matches[0] - -# Adding description of the software to Markdown -$SoftwareName = "Rust (64-bit)" -$Description = @" -#### $Version -_Location:_ $RustPath -_Environment:_ -* PATH: contains the location of rustc.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Rust.ps1 +## Desc: Verify that Rust is on the path and output version information. +################################################################################ + +if (Get-Command -Name 'rustc') +{ + Push-Location -Path $env:UserProfile + New-Item -Name ".rustup" -Value "C:\Rust\.rustup" -ItemType Junction + New-Item -Name ".cargo" -Value "C:\Rust\.cargo" -ItemType Junction + $RustcVersion = rustc --version + Write-Host "$RustcVersion is on the path" + Pop-Location +} +else +{ + Write-Host "rustc is not on the path" + exit 1 +} + +$RustPath = Split-Path (Get-Command -Name 'rustc').Path +$RustcVersion -Match "\d+\.\d+\.\d+" | Out-Null +$Version = $Matches[0] + +# Adding description of the software to Markdown +$SoftwareName = "Rust (64-bit)" +$Description = @" +#### $Version +_Location:_ $RustPath +_Environment:_ +* PATH: contains the location of rustc.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 b/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 index 2ca6b8fa8..5af77da62 100644 --- a/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 +++ b/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 @@ -1,37 +1,37 @@ -# Validate the installation -$env:PSModulePath = Get-SystemVariable "PSModulePath" -$modules = Get-Module -Name SQLPS -ListAvailable -Write-Host "The SQLPS Modules present are:" -$modules | Select-Object Name,Version,Path | Format-Table - -if ($modules) { - $sqlPSVersion = $modules.Version -} - -# Validate the SQLserver PS module installation -$modules = Get-Module -Name SQLServer -ListAvailable -Write-Host "The SQLServer Modules present are:" -$modules | Select-Object Name,Version,Path | Format-Table - -if ($modules) { - $sqlServerPSModuleVersion = $modules.Version -} - - -# Adding description of the software to Markdown -$SoftwareName = "SQLPS" - -$Description = @" -_Version:_ $sqlPSVersion -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding description of the software to Markdown -$SoftwareName = "SQLServer PS" - -$Description = @" -_Version:_ $sqlServerPSModuleVersion -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +# Validate the installation +$env:PSModulePath = Get-SystemVariable "PSModulePath" +$modules = Get-Module -Name SQLPS -ListAvailable +Write-Host "The SQLPS Modules present are:" +$modules | Select-Object Name,Version,Path | Format-Table + +if ($modules) { + $sqlPSVersion = $modules.Version +} + +# Validate the SQLserver PS module installation +$modules = Get-Module -Name SQLServer -ListAvailable +Write-Host "The SQLServer Modules present are:" +$modules | Select-Object Name,Version,Path | Format-Table + +if ($modules) { + $sqlServerPSModuleVersion = $modules.Version +} + + +# Adding description of the software to Markdown +$SoftwareName = "SQLPS" + +$Description = @" +_Version:_ $sqlPSVersion +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +# Adding description of the software to Markdown +$SoftwareName = "SQLServer PS" + +$Description = @" +_Version:_ $sqlServerPSModuleVersion +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Sbt.ps1 b/images/win/scripts/Installers/Validate-Sbt.ps1 index ce213c557..bea29c8b5 100644 --- a/images/win/scripts/Installers/Validate-Sbt.ps1 +++ b/images/win/scripts/Installers/Validate-Sbt.ps1 @@ -1,18 +1,17 @@ -################################################################################ -## File: Validate-Sbt.ps1 -## Team: CI-Platform -## Desc: Validate sbt for Windows -################################################################################ - -if((Get-Command -Name 'sbt')) -{ - Write-Host "sbt is on the path" -} -else -{ - Write-Host "sbt is not on path." - exit 1 -} - -# This works around issue where sbt --script-version does some copies and breaks the build -Add-SoftwareDetailsToMarkdown -SoftwareName "sbt" -DescriptionMarkdown "" +################################################################################ +## File: Validate-Sbt.ps1 +## Desc: Validate sbt for Windows +################################################################################ + +if((Get-Command -Name 'sbt')) +{ + Write-Host "sbt is on the path" +} +else +{ + Write-Host "sbt is not on path." + exit 1 +} + +# This works around issue where sbt --script-version does some copies and breaks the build +Add-SoftwareDetailsToMarkdown -SoftwareName "sbt" -DescriptionMarkdown "" diff --git a/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 b/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 index 41a6266a0..44c69ef2e 100644 --- a/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 +++ b/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 @@ -1,67 +1,67 @@ -################################################################################ -## File: Validate-Chrome.ps1 -## Desc: Validate Google Chrome installation. -################################################################################ - -$IEDriverPath = $env:IEWebDriver -$GeckoDriverPath = $env:GeckoWebDriver -$ChromeDriverPath = $env:ChromeWebDriver - -if(($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and ($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and ($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver")) -{ - - Write-Host "IEDriver installed at " - (Get-Item "C:\SeleniumWebDrivers\IEDriver\IEDriverServer.exe").VersionInfo - - - Write-Host "Gecko Driver installed at " - (Get-Item "C:\SeleniumWebDrivers\GeckoDriver\geckodriver.exe").VersionInfo - - - Write-Host "Chrome Driver installed at " - (Get-Item "C:\SeleniumWebDrivers\ChromeDriver\chromedriver.exe").VersionInfo - - $chromedriverversion = Get-Content -Path "C:\SeleniumWebDrivers\ChromeDriver\versioninfo.txt" - $geckodriverversion = Get-Content -Path "C:\SeleniumWebDrivers\GeckoDriver\versioninfo.txt" - $iedriverversion = Get-Content -Path "C:\SeleniumWebDrivers\IEDriver\versioninfo.txt" - - # Adding description of the software to Markdown - $SoftwareName = "Selenium Web Drivers" - - $Description = @" - -#### Chrome Driver - -_version:_ -$chromedriverversion - -_Environment:_ -* ChromeWebDriver: location of chromedriver.exe - -#### Gecko Driver - -_version:_ -$geckodriverversion - -_Environment:_ -* GeckoWebDriver: location of geckodriver.exe - -#### IE Driver - -_version:_ -$iedriverversion - -_Environment:_ -* IEWebDriver: location of IEDriverServer.exe - -"@ - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - exit 0 -} -else -{ - Write-Host "Selenium Web Drivers are not installed." - exit 1 -} +################################################################################ +## File: Validate-Chrome.ps1 +## Desc: Validate Google Chrome installation. +################################################################################ + +$IEDriverPath = $env:IEWebDriver +$GeckoDriverPath = $env:GeckoWebDriver +$ChromeDriverPath = $env:ChromeWebDriver + +if(($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and ($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and ($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver")) +{ + + Write-Host "IEDriver installed at " + (Get-Item "C:\SeleniumWebDrivers\IEDriver\IEDriverServer.exe").VersionInfo + + + Write-Host "Gecko Driver installed at " + (Get-Item "C:\SeleniumWebDrivers\GeckoDriver\geckodriver.exe").VersionInfo + + + Write-Host "Chrome Driver installed at " + (Get-Item "C:\SeleniumWebDrivers\ChromeDriver\chromedriver.exe").VersionInfo + + $chromedriverversion = Get-Content -Path "C:\SeleniumWebDrivers\ChromeDriver\versioninfo.txt" + $geckodriverversion = Get-Content -Path "C:\SeleniumWebDrivers\GeckoDriver\versioninfo.txt" + $iedriverversion = Get-Content -Path "C:\SeleniumWebDrivers\IEDriver\versioninfo.txt" + + # Adding description of the software to Markdown + $SoftwareName = "Selenium Web Drivers" + + $Description = @" + +#### Chrome Driver + +_version:_ +$chromedriverversion + +_Environment:_ +* ChromeWebDriver: location of chromedriver.exe + +#### Gecko Driver + +_version:_ +$geckodriverversion + +_Environment:_ +* GeckoWebDriver: location of geckodriver.exe + +#### IE Driver + +_version:_ +$iedriverversion + +_Environment:_ +* IEWebDriver: location of IEDriverServer.exe + +"@ + + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + exit 0 +} +else +{ + Write-Host "Selenium Web Drivers are not installed." + exit 1 +} diff --git a/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 b/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 index e893c0149..d2d69f1be 100644 --- a/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 +++ b/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 @@ -1,44 +1,44 @@ -################################################################################ -## File: Validate-ServiceFabricSDK.ps1 -## Desc: Validate ServiceFabricSDK -################################################################################ - -$modules = Get-Module -Name ServiceFabric -ListAvailable - -if(($modules | Measure-Object).Count -gt 0) -{ - $modules -} -else { - Write-Host "ServiceFabric Module is not present, it might not be installed" - throw "ServiceFabric Module is not present, it might not be installed" -} - - -function Get-ServiceFabricSDKVersion -{ - $regKey = "HKLM:\Software\Microsoft\Service Fabric SDK" - $installedApplications = Get-ItemProperty -Path $regKey - $Version = (Get-ItemProperty -Path $regKey).FabricSDKVersion - return $Version -} - - -function Get-ServiceFabricVersion -{ - $regKey = "HKLM:\Software\Microsoft\Service Fabric" - $installedApplications = Get-ItemProperty -Path $regKey - $Version = (Get-ItemProperty -Path $regKey).FabricVersion - return $Version -} - - -# Adding description of the software to Markdown -$SoftwareName = "Azure Service Fabric" - -$Description = @" -_SDK Version:_ $(Get-ServiceFabricSDKVersion)
-_Runtime Version:_ $(Get-ServiceFabricVersion) -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-ServiceFabricSDK.ps1 +## Desc: Validate ServiceFabricSDK +################################################################################ + +$modules = Get-Module -Name ServiceFabric -ListAvailable + +if(($modules | Measure-Object).Count -gt 0) +{ + $modules +} +else { + Write-Host "ServiceFabric Module is not present, it might not be installed" + throw "ServiceFabric Module is not present, it might not be installed" +} + + +function Get-ServiceFabricSDKVersion +{ + $regKey = "HKLM:\Software\Microsoft\Service Fabric SDK" + $installedApplications = Get-ItemProperty -Path $regKey + $Version = (Get-ItemProperty -Path $regKey).FabricSDKVersion + return $Version +} + + +function Get-ServiceFabricVersion +{ + $regKey = "HKLM:\Software\Microsoft\Service Fabric" + $installedApplications = Get-ItemProperty -Path $regKey + $Version = (Get-ItemProperty -Path $regKey).FabricVersion + return $Version +} + + +# Adding description of the software to Markdown +$SoftwareName = "Azure Service Fabric" + +$Description = @" +_SDK Version:_ $(Get-ServiceFabricSDKVersion)
+_Runtime Version:_ $(Get-ServiceFabricVersion) +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Svn.ps1 b/images/win/scripts/Installers/Validate-Svn.ps1 index 1e9b141a8..2009807e1 100644 --- a/images/win/scripts/Installers/Validate-Svn.ps1 +++ b/images/win/scripts/Installers/Validate-Svn.ps1 @@ -1,28 +1,28 @@ -################################################################################ -## File: Validate-Svn.ps1 -## Desc: Validate Subversion -################################################################################ - -if(Get-Command -Name 'svn') -{ - Write-Host "Subversion $(svn --version --quiet) is on the path." -} -else -{ - Write-Host "Subversion is not on the path." - exit 1 -} - - -$svnVersion = $(svn --version --quiet) - -# Adding description of the software to Markdown -$SoftwareName = "Subversion" - -$Description = @" -_Version:_ $svnVersion
-_Environment:_ -* PATH: contains location of svn.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Svn.ps1 +## Desc: Validate Subversion +################################################################################ + +if(Get-Command -Name 'svn') +{ + Write-Host "Subversion $(svn --version --quiet) is on the path." +} +else +{ + Write-Host "Subversion is not on the path." + exit 1 +} + + +$svnVersion = $(svn --version --quiet) + +# Adding description of the software to Markdown +$SoftwareName = "Subversion" + +$Description = @" +_Version:_ $svnVersion
+_Environment:_ +* PATH: contains location of svn.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-ToolCache.ps1 b/images/win/scripts/Installers/Validate-ToolCache.ps1 index 028f13192..e5a3e7d14 100644 --- a/images/win/scripts/Installers/Validate-ToolCache.ps1 +++ b/images/win/scripts/Installers/Validate-ToolCache.ps1 @@ -1,94 +1,94 @@ -################################################################################ -## File: Validate-ToolCache.ps1 -## Desc: Validate Tool Cache -################################################################################ - -# Helpers -function GetChildFolders { - param ( - [Parameter(Mandatory = $True)] - [string]$Path - ) - return Get-ChildItem -Path $Path -Directory -Name -} - -function ToolcacheTest { - param ( - [Parameter(Mandatory = $True)] - [string]$SoftwareName, - [Parameter(Mandatory = $True)] - [string[]]$ExecTests, - [Parameter(Mandatory = $True)] - [string]$Note - ) - if (Test-Path "$env:AGENT_TOOLSDIRECTORY\$SoftwareName") - { - $description = "" - [array]$versions = GetChildFolders -Path "$env:AGENT_TOOLSDIRECTORY\$SoftwareName" - if ($versions.count -gt 0){ - foreach ($version in $versions) - { - $architectures = GetChildFolders -Path "$env:AGENT_TOOLSDIRECTORY\$SoftwareName\$version" - - Write-Host "$SoftwareName version - $version : $([system.String]::Join(",", $architectures))" - - foreach ($arch in $architectures) - { - $path = "$env:AGENT_TOOLSDIRECTORY\$SoftwareName\$version\$arch" - foreach ($test in $ExecTests) - { - if (Test-Path "$path\$test") - { - Write-Host "$SoftwareName($test) $version($arch) is successfully installed:" - Write-Host (& "$path\$test" --version) - } - else - { - Write-Host "$SoftwareName($test) $version ($arch) is not installed" - exit 1 - } - } - - $description += "_Version:_ $version ($arch)
" - } - } - - $description += $Note - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $description - } - else - { - Write-Host "$env:AGENT_TOOLSDIRECTORY\$SoftwareName does not include any folders" - exit 1 - } - } - else - { - Write-Host "$env:AGENT_TOOLSDIRECTORY\$SoftwareName does not exist" - exit 1 - } -} - -# Python test -$PythonNote += @" -
-> Note: These versions of Python are available through the [Use Python Version](https://go.microsoft.com/fwlink/?linkid=871498) task. -"@ -$PythonTests = @("python.exe", "Scripts\pip.exe") -ToolcacheTest -SoftwareName "Python" -ExecTests $PythonTests -Note $PythonNote - -# PyPy test -$PyPyNote += @" -
-> Note: These versions of PyPy are available through the [Use Python Version](https://go.microsoft.com/fwlink/?linkid=871498) task. -"@ -$PyPyTests = @("python.exe", "bin\pip.exe") -ToolcacheTest -SoftwareName "PyPy" -ExecTests $PyPyTests -Note $PyPyNote - -# Ruby test -$RubyNote += @" -
-> Note: These versions of Ruby are available through the [Use Ruby Version](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/use-ruby-version) task. -"@ -$RubyTests = @("bin\ruby.exe") -ToolcacheTest -SoftwareName "Ruby" -ExecTests $RubyTests -Note $RubyNote +################################################################################ +## File: Validate-ToolCache.ps1 +## Desc: Validate Tool Cache +################################################################################ + +# Helpers +function GetChildFolders { + param ( + [Parameter(Mandatory = $True)] + [string]$Path + ) + return Get-ChildItem -Path $Path -Directory -Name +} + +function ToolcacheTest { + param ( + [Parameter(Mandatory = $True)] + [string]$SoftwareName, + [Parameter(Mandatory = $True)] + [string[]]$ExecTests, + [Parameter(Mandatory = $True)] + [string]$Note + ) + if (Test-Path "$env:AGENT_TOOLSDIRECTORY\$SoftwareName") + { + $description = "" + [array]$versions = GetChildFolders -Path "$env:AGENT_TOOLSDIRECTORY\$SoftwareName" + if ($versions.count -gt 0){ + foreach ($version in $versions) + { + $architectures = GetChildFolders -Path "$env:AGENT_TOOLSDIRECTORY\$SoftwareName\$version" + + Write-Host "$SoftwareName version - $version : $([system.String]::Join(",", $architectures))" + + foreach ($arch in $architectures) + { + $path = "$env:AGENT_TOOLSDIRECTORY\$SoftwareName\$version\$arch" + foreach ($test in $ExecTests) + { + if (Test-Path "$path\$test") + { + Write-Host "$SoftwareName($test) $version($arch) is successfully installed:" + Write-Host (& "$path\$test" --version) + } + else + { + Write-Host "$SoftwareName($test) $version ($arch) is not installed" + exit 1 + } + } + + $description += "_Version:_ $version ($arch)
" + } + } + + $description += $Note + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $description + } + else + { + Write-Host "$env:AGENT_TOOLSDIRECTORY\$SoftwareName does not include any folders" + exit 1 + } + } + else + { + Write-Host "$env:AGENT_TOOLSDIRECTORY\$SoftwareName does not exist" + exit 1 + } +} + +# Python test +$PythonNote += @" +
+> Note: These versions of Python are available through the [Use Python Version](https://go.microsoft.com/fwlink/?linkid=871498) task. +"@ +$PythonTests = @("python.exe", "Scripts\pip.exe") +ToolcacheTest -SoftwareName "Python" -ExecTests $PythonTests -Note $PythonNote + +# PyPy test +$PyPyNote += @" +
+> Note: These versions of PyPy are available through the [Use Python Version](https://go.microsoft.com/fwlink/?linkid=871498) task. +"@ +$PyPyTests = @("python.exe", "bin\pip.exe") +ToolcacheTest -SoftwareName "PyPy" -ExecTests $PyPyTests -Note $PyPyNote + +# Ruby test +$RubyNote += @" +
+> Note: These versions of Ruby are available through the [Use Ruby Version](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/use-ruby-version) task. +"@ +$RubyTests = @("bin\ruby.exe") +ToolcacheTest -SoftwareName "Ruby" -ExecTests $RubyTests -Note $RubyNote diff --git a/images/win/scripts/Installers/Validate-TypeScript.ps1 b/images/win/scripts/Installers/Validate-TypeScript.ps1 index 430e64561..94efab7a6 100644 --- a/images/win/scripts/Installers/Validate-TypeScript.ps1 +++ b/images/win/scripts/Installers/Validate-TypeScript.ps1 @@ -1,27 +1,26 @@ -################################################################################ -## File: Validate-TypeScript.ps1 -## Team: CI Build -## Desc: Validate Typescript Installation -################################################################################ - -if(Get-Command -Name 'tsc') -{ - Write-Host "TypeScript $(tsc --version) is on the path." -} -else -{ - Write-Host "TypeScript is not on the path." - exit 1 -} - - -$typescriptVersion = $(tsc --version) - -# Adding description of the software to Markdown -$SoftwareName = "TypeScript" - -$Description = @" -_Version:_ $typescriptVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-TypeScript.ps1 +## Desc: Validate Typescript Installation +################################################################################ + +if(Get-Command -Name 'tsc') +{ + Write-Host "TypeScript $(tsc --version) is on the path." +} +else +{ + Write-Host "TypeScript is not on the path." + exit 1 +} + + +$typescriptVersion = $(tsc --version) + +# Adding description of the software to Markdown +$SoftwareName = "TypeScript" + +$Description = @" +_Version:_ $typescriptVersion
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Vcpkg.ps1 b/images/win/scripts/Installers/Validate-Vcpkg.ps1 index 834acf0bb..49c6fc044 100644 --- a/images/win/scripts/Installers/Validate-Vcpkg.ps1 +++ b/images/win/scripts/Installers/Validate-Vcpkg.ps1 @@ -1,46 +1,46 @@ -################################################################################ -## File: Validate-Vcpkg.ps1 -## Desc: Validate vcpkg Cli -################################################################################ - -if (Get-Command -Name 'Vcpkg') -{ - Write-Host 'Vcpkg is succesfully installed:' - vcpkg version | Write-Host -} -else -{ - Write-Host 'Vcpkg is not on PATH' - exit 1 -} - -if ($env:VCPKG_INSTALLATION_ROOT) -{ - Write-Host "The VCPKG_INSTALLATION_ROOT environment variable is set" - Write-Host $env:VCPKG_INSTALLATION_ROOT -} -else -{ - Write-Host "The VCPKG_INSTALLATION_ROOT environment variable is not set" - exit 1 -} - -# Adding description of the software to Markdown - -# `vcpkg version` gives output like: -# Vcpkg package management program version 2018.11.23-nohash -# -# See LICENSE.txt for license information. - -$SoftwareName = 'Vcpkg' -$(vcpkg version).Split([System.Environment]::NewLine)[0] -match "\d+.\d+.\d+.*" -$VcpkgVersion = $Matches[0] - -$Description = @" -_Version:_ $VcpkgVersion
-_Environment:_ -* PATH: contains location of the vcpkg directory -* VCPKG_INSTALLATION_ROOT: root directory of the vcpkg installation -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Vcpkg.ps1 +## Desc: Validate vcpkg Cli +################################################################################ + +if (Get-Command -Name 'Vcpkg') +{ + Write-Host 'Vcpkg is succesfully installed:' + vcpkg version | Write-Host +} +else +{ + Write-Host 'Vcpkg is not on PATH' + exit 1 +} + +if ($env:VCPKG_INSTALLATION_ROOT) +{ + Write-Host "The VCPKG_INSTALLATION_ROOT environment variable is set" + Write-Host $env:VCPKG_INSTALLATION_ROOT +} +else +{ + Write-Host "The VCPKG_INSTALLATION_ROOT environment variable is not set" + exit 1 +} + +# Adding description of the software to Markdown + +# `vcpkg version` gives output like: +# Vcpkg package management program version 2018.11.23-nohash +# +# See LICENSE.txt for license information. + +$SoftwareName = 'Vcpkg' +$(vcpkg version).Split([System.Environment]::NewLine)[0] -match "\d+.\d+.\d+.*" +$VcpkgVersion = $Matches[0] + +$Description = @" +_Version:_ $VcpkgVersion
+_Environment:_ +* PATH: contains location of the vcpkg directory +* VCPKG_INSTALLATION_ROOT: root directory of the vcpkg installation +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-WinAppDriver.ps1 b/images/win/scripts/Installers/Validate-WinAppDriver.ps1 index 9852b3458..f92b37c44 100644 --- a/images/win/scripts/Installers/Validate-WinAppDriver.ps1 +++ b/images/win/scripts/Installers/Validate-WinAppDriver.ps1 @@ -1,45 +1,45 @@ -################################################################################ -## File: Validate-WinAppDriver.ps1 -## Desc: Validate WinAppDriver installation -################################################################################ - -$wad = "Windows Application Driver"; -if (${Env:ProgramFiles(x86)}) -{ - $wadPath = "${Env:ProgramFiles(x86)}\$wad" -} -else -{ - $wadPath = "${Env:ProgramFiles}\$wad" -} - -if(Test-Path $wadPath -PathType Any) -{ - Write-Host "WinAppDriver directory found." -} -else -{ - Write-Host "Failed to locate WinAppDriver directory. Exiting." - exit 1 -} - -#Validate if Developer Mode is enabled -$path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"; -if((Get-ItemProperty -Path $path | Select-Object -ExpandProperty "AllowDevelopmentWithoutDevLicense") -eq 1) -{ - Write-Host "Developer Mode is successfully provisioned." -} -else -{ - Write-Host "Developer Mode was not successfully provisioned." - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "WinAppDriver" -$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe").FileVersion -$Description = @" -_Version:_ $version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-WinAppDriver.ps1 +## Desc: Validate WinAppDriver installation +################################################################################ + +$wad = "Windows Application Driver"; +if (${Env:ProgramFiles(x86)}) +{ + $wadPath = "${Env:ProgramFiles(x86)}\$wad" +} +else +{ + $wadPath = "${Env:ProgramFiles}\$wad" +} + +if(Test-Path $wadPath -PathType Any) +{ + Write-Host "WinAppDriver directory found." +} +else +{ + Write-Host "Failed to locate WinAppDriver directory. Exiting." + exit 1 +} + +#Validate if Developer Mode is enabled +$path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"; +if((Get-ItemProperty -Path $path | Select-Object -ExpandProperty "AllowDevelopmentWithoutDevLicense") -eq 1) +{ + Write-Host "Developer Mode is successfully provisioned." +} +else +{ + Write-Host "Developer Mode was not successfully provisioned." + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "WinAppDriver" +$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe").FileVersion +$Description = @" +_Version:_ $version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 b/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 index 67a59d0af..335719005 100644 --- a/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 +++ b/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 @@ -1,147 +1,146 @@ -################################################################################ -## File: Initialize-VM.ps1 -## Team: CI-Platform -## Desc: VM initialization script, machine level configuration -################################################################################ - -function Disable-InternetExplorerESC { - $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" - $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" - Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force - Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force - Stop-Process -Name Explorer -Force -ErrorAction Continue - Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." -} - -function Disable-InternetExplorerWelcomeScreen { - $AdminKey = "HKLM:\Software\Policies\Microsoft\Internet Explorer\Main" - New-Item -Path $AdminKey -Value 1 -Force - Set-ItemProperty -Path $AdminKey -Name "DisableFirstRunCustomize" -Value 1 -Force - Write-Host "Disabled IE Welcome screen" -} - -function Disable-UserAccessControl { - Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 00000000 -Force - Write-Host "User Access Control (UAC) has been disabled." -} - -Import-Module -Name ImageHelpers -Force - -Write-Host "Setup PowerShellGet" -# Set-PSRepository -InstallationPolicy Trusted -Name PSGallery -Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Install-Module -Name PowerShellGet -Force -Set-PSRepository -InstallationPolicy Trusted -Name PSGallery - - -Write-Host "Disable Antivirus" -Set-MpPreference -DisableRealtimeMonitoring $true - -# Disable Windows Update -$AutoUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -If (Test-Path -Path $AutoUpdatePath) { - Set-ItemProperty -Path $AutoUpdatePath -Name NoAutoUpdate -Value 1 - Write-Host "Disabled Windows Update" -} -else { - Write-Host "Windows Update key does not exist" -} - -# Install Windows .NET Features -Install-WindowsFeature -Name NET-Framework-Features -IncludeAllSubFeature -Install-WindowsFeature -Name NET-Framework-45-Features -IncludeAllSubFeature -Install-WindowsFeature -Name BITS -IncludeAllSubFeature -Install-WindowsFeature -Name DSC-Service - -Write-Host "Disable UAC" -Disable-UserAccessControl - -Write-Host "Disable IE Welcome Screen" -Disable-InternetExplorerWelcomeScreen - -Write-Host "Disable IE ESC" -Disable-InternetExplorerESC - -Write-Host "Setting local execution policy" -Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope MachinePolicy -ErrorAction Continue | Out-Null -Get-ExecutionPolicy -List - -Write-Host "Enable long path behavior" -# See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation -Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 - -Write-Host "Install chocolatey" -$chocoExePath = 'C:\ProgramData\Chocolatey\bin' - -if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower())) { - Write-Host "Chocolatey found in PATH, skipping install..." - Exit -} - -# Add to system PATH -$systemPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) -$systemPath += ';' + $chocoExePath -[Environment]::SetEnvironmentVariable("PATH", $systemPath, [System.EnvironmentVariableTarget]::Machine) - -# Update local process' path -$userPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User) -if ($userPath) { - $env:Path = $systemPath + ";" + $userPath -} -else { - $env:Path = $systemPath -} - -# Run the installer -Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) - -# Turn off confirmation -choco feature enable -n allowGlobalConfirmation - -# Install webpi -choco install webpicmd -y - - -# Expand disk size of OS drive - -New-Item -Path d:\ -Name cmds.txt -ItemType File -Force - -Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" - -$expandResult = (diskpart /s 'd:\cmds.txt') - -Write-Host $expandResult - -Write-Host "Disk sizes after expansion" - -wmic logicaldisk get size,freespace,caption - - -# Adding description of the software to Markdown - -$Content = @" -# Hosted Windows2016 image - -The following software is installed on machines in the **Hosted Windows2016** (v$env:ImageVersion) pool. - -Components marked with **\*** have been upgraded since the previous version of the image. - -"@ - -Add-ContentToMarkdown -Content $Content - - -$SoftwareName = "Chocolatey" - -if( $( $(choco version) | Out-String) -match 'Chocolatey v(?.*).*' ) -{ - $chocoVersion = $Matches.version.Trim() -} - -$Description = @" -_Version:_ $chocoVersion
-_Environment:_ -* PATH: contains location for choco.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Initialize-VM.ps1 +## Desc: VM initialization script, machine level configuration +################################################################################ + +function Disable-InternetExplorerESC { + $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" + $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" + Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force + Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force + Stop-Process -Name Explorer -Force -ErrorAction Continue + Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." +} + +function Disable-InternetExplorerWelcomeScreen { + $AdminKey = "HKLM:\Software\Policies\Microsoft\Internet Explorer\Main" + New-Item -Path $AdminKey -Value 1 -Force + Set-ItemProperty -Path $AdminKey -Name "DisableFirstRunCustomize" -Value 1 -Force + Write-Host "Disabled IE Welcome screen" +} + +function Disable-UserAccessControl { + Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 00000000 -Force + Write-Host "User Access Control (UAC) has been disabled." +} + +Import-Module -Name ImageHelpers -Force + +Write-Host "Setup PowerShellGet" +# Set-PSRepository -InstallationPolicy Trusted -Name PSGallery +Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force +Install-Module -Name PowerShellGet -Force +Set-PSRepository -InstallationPolicy Trusted -Name PSGallery + + +Write-Host "Disable Antivirus" +Set-MpPreference -DisableRealtimeMonitoring $true + +# Disable Windows Update +$AutoUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" +If (Test-Path -Path $AutoUpdatePath) { + Set-ItemProperty -Path $AutoUpdatePath -Name NoAutoUpdate -Value 1 + Write-Host "Disabled Windows Update" +} +else { + Write-Host "Windows Update key does not exist" +} + +# Install Windows .NET Features +Install-WindowsFeature -Name NET-Framework-Features -IncludeAllSubFeature +Install-WindowsFeature -Name NET-Framework-45-Features -IncludeAllSubFeature +Install-WindowsFeature -Name BITS -IncludeAllSubFeature +Install-WindowsFeature -Name DSC-Service + +Write-Host "Disable UAC" +Disable-UserAccessControl + +Write-Host "Disable IE Welcome Screen" +Disable-InternetExplorerWelcomeScreen + +Write-Host "Disable IE ESC" +Disable-InternetExplorerESC + +Write-Host "Setting local execution policy" +Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope MachinePolicy -ErrorAction Continue | Out-Null +Get-ExecutionPolicy -List + +Write-Host "Enable long path behavior" +# See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation +Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 + +Write-Host "Install chocolatey" +$chocoExePath = 'C:\ProgramData\Chocolatey\bin' + +if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower())) { + Write-Host "Chocolatey found in PATH, skipping install..." + Exit +} + +# Add to system PATH +$systemPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) +$systemPath += ';' + $chocoExePath +[Environment]::SetEnvironmentVariable("PATH", $systemPath, [System.EnvironmentVariableTarget]::Machine) + +# Update local process' path +$userPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User) +if ($userPath) { + $env:Path = $systemPath + ";" + $userPath +} +else { + $env:Path = $systemPath +} + +# Run the installer +Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) + +# Turn off confirmation +choco feature enable -n allowGlobalConfirmation + +# Install webpi +choco install webpicmd -y + + +# Expand disk size of OS drive + +New-Item -Path d:\ -Name cmds.txt -ItemType File -Force + +Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" + +$expandResult = (diskpart /s 'd:\cmds.txt') + +Write-Host $expandResult + +Write-Host "Disk sizes after expansion" + +wmic logicaldisk get size,freespace,caption + + +# Adding description of the software to Markdown + +$Content = @" +# Azure Pipelines Hosted VS2017 image + +The following software is installed on machines in the Azure Pipelines **Hosted VS2017** (v$env:ImageVersion) pool. + +Components marked with **\*** have been upgraded since the previous version of the image. + +"@ + +Add-ContentToMarkdown -Content $Content + + +$SoftwareName = "Chocolatey" + +if( $( $(choco version) | Out-String) -match 'Chocolatey v(?.*).*' ) +{ + $chocoVersion = $Matches.version.Trim() +} + +$Description = @" +_Version:_ $chocoVersion
+_Environment:_ +* PATH: contains location for choco.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2016/Install-Python.ps1 b/images/win/scripts/Installers/Windows2016/Install-Python.ps1 index 0f6035222..f0a76ca92 100644 --- a/images/win/scripts/Installers/Windows2016/Install-Python.ps1 +++ b/images/win/scripts/Installers/Windows2016/Install-Python.ps1 @@ -1,29 +1,28 @@ -################################################################################ -## File: Install-Python.ps1 -## Team: CI-X -## Desc: Configure python on path with 3.6.* version from the tools cache -## Must run after tools cache is setup -################################################################################ - -Import-Module -Name ImageHelpers -Force - -$python36path = $Env:AGENT_TOOLSDIRECTORY + '/Python/3.6*/x64' -$pythonDir = Get-Item -Path $python36path - -if($pythonDir -is [array]) -{ - Write-Host "More than one python 3.6.* installations found" - Write-Host $pythonDir - exit 1 -} - -$currentPath = Get-MachinePath - -if ($currentPath | Select-String -SimpleMatch $pythonDir.FullName) -{ - Write-Host $pythonDir.FullName ' is already in PATH' - exit 0 -} - -Add-MachinePathItem -PathItem $pythonDir.FullName -Add-MachinePathItem -PathItem "$($pythonDir.FullName)\Scripts" +################################################################################ +## File: Install-Python.ps1 +## Desc: Configure python on path with 3.6.* version from the tools cache +## Must run after tools cache is setup +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$python36path = $Env:AGENT_TOOLSDIRECTORY + '/Python/3.6*/x64' +$pythonDir = Get-Item -Path $python36path + +if($pythonDir -is [array]) +{ + Write-Host "More than one python 3.6.* installations found" + Write-Host $pythonDir + exit 1 +} + +$currentPath = Get-MachinePath + +if ($currentPath | Select-String -SimpleMatch $pythonDir.FullName) +{ + Write-Host $pythonDir.FullName ' is already in PATH' + exit 0 +} + +Add-MachinePathItem -PathItem $pythonDir.FullName +Add-MachinePathItem -PathItem "$($pythonDir.FullName)\Scripts" diff --git a/images/win/scripts/Installers/Windows2016/Install-SSDT.ps1 b/images/win/scripts/Installers/Windows2016/Install-SSDT.ps1 index 68cf161b6..f51f49d39 100644 --- a/images/win/scripts/Installers/Windows2016/Install-SSDT.ps1 +++ b/images/win/scripts/Installers/Windows2016/Install-SSDT.ps1 @@ -1,24 +1,23 @@ -################################################################################ -## File: Install-SSDT.ps1 -## Team: CI-Platform -## Desc: Install SQL Server Data Tools for Windows -################################################################################ - -Import-Module -Name ImageHelpers -Force - -#SSDT for Visual Studio 2017 (15.8.2) -$InstallerURI = 'https://download.microsoft.com/download/D/F/8/DF8B51B9-8E9F-47F3-A27B-33EEDADD8966/SSDT-Setup-ENU.exe' -$InstallerName = 'SSDT-Setup-ENU.exe' -$logFilePath = "$env:TEMP\ssdtlog.txt" -$ArgumentList = ('/install', 'INSTALLALL', '/passive', '/norestart', "/log `"$logFilePath`"") - -$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList - -if($exitCode -ne 0 -and $exitCode -ne 3010) -{ - Write-Host "******** SSDT SETUP LOG START ********" - Write-Host $(Get-Content $logFilePath | Out-String) - Write-Host "******** SSDT SETUP LOG END ********" -} - -exit $exitCode +################################################################################ +## File: Install-SSDT.ps1 +## Desc: Install SQL Server Data Tools for Windows +################################################################################ + +Import-Module -Name ImageHelpers -Force + +#SSDT for Visual Studio 2017 (15.8.2) +$InstallerURI = 'https://download.microsoft.com/download/D/F/8/DF8B51B9-8E9F-47F3-A27B-33EEDADD8966/SSDT-Setup-ENU.exe' +$InstallerName = 'SSDT-Setup-ENU.exe' +$logFilePath = "$env:TEMP\ssdtlog.txt" +$ArgumentList = ('/install', 'INSTALLALL', '/passive', '/norestart', "/log `"$logFilePath`"") + +$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList + +if($exitCode -ne 0 -and $exitCode -ne 3010) +{ + Write-Host "******** SSDT SETUP LOG START ********" + Write-Host $(Get-Content $logFilePath | Out-String) + Write-Host "******** SSDT SETUP LOG END ********" +} + +exit $exitCode diff --git a/images/win/scripts/Installers/Windows2016/Install-VS2017.ps1 b/images/win/scripts/Installers/Windows2016/Install-VS2017.ps1 index 85b6697bf..fabcebd8c 100644 --- a/images/win/scripts/Installers/Windows2016/Install-VS2017.ps1 +++ b/images/win/scripts/Installers/Windows2016/Install-VS2017.ps1 @@ -1,202 +1,201 @@ -################################################################################ -## File: Install-VS2017.ps1 -## Team: CI-Build -## Desc: Install Visual Studio 2017 -################################################################################ - -Function InstallVS -{ - Param - ( - [String]$WorkLoads, - [String]$Sku, - [String] $VSBootstrapperURL - ) - - $exitCode = -1 - - try - { - Write-Host "Enable short name support on Windows needed for Xamarin Android AOT, defaults appear to have been changed in Azure VMs" - $shortNameEnableProcess = Start-Process -FilePath fsutil.exe -ArgumentList ('8dot3name', 'set', '0') -Wait -PassThru - $shortNameEnableExitCode = $shortNameEnableProcess.ExitCode - - if ($shortNameEnableExitCode -ne 0) - { - Write-Host -Object 'Enabling short name support on Windows failed. This needs to be enabled prior to VS 2017 install for Xamarin Andriod AOT to work.' - exit $shortNameEnableExitCode - } - - Write-Host "Downloading Bootstrapper ..." - Invoke-WebRequest -Uri $VSBootstrapperURL -OutFile "${env:Temp}\vs_$Sku.exe" - - $FilePath = "${env:Temp}\vs_$Sku.exe" - $Arguments = ('/c', $FilePath, $WorkLoads, '--quiet', '--norestart', '--wait', '--nocache' ) - - Write-Host "Starting Install ..." - $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru - $exitCode = $process.ExitCode - - if ($exitCode -eq 0 -or $exitCode -eq 3010) - { - Write-Host -Object 'Installation successful' - return $exitCode - } - else - { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - - # this wont work because of log size limitation in extension manager - # Get-Content $customLogFilePath | Write-Host - - exit $exitCode - } - } - catch - { - Write-Host -Object "Failed to install Visual Studio. Check the logs for details in $customLogFilePath" - Write-Host -Object $_.Exception.Message - exit -1 - } -} - -$WorkLoads = '--allWorkloads --includeRecommended ' + ` - '--add Microsoft.Net.Component.4.6.2.SDK ' + ` - '--add Microsoft.Net.Component.4.6.2.TargetingPack ' + ` - '--add Microsoft.Net.ComponentGroup.4.6.2.DeveloperTools ' + ` - '--add Microsoft.Net.Component.4.7.SDK ' + ` - '--add Microsoft.Net.Component.4.7.TargetingPack ' + ` - '--add Microsoft.Net.ComponentGroup.4.7.DeveloperTools ' + ` - '--add Microsoft.Net.Component.4.7.1.SDK ' + ` - '--add Microsoft.Net.Component.4.7.1.TargetingPack ' + ` - '--add Microsoft.Net.ComponentGroup.4.7.1.DeveloperTools ' + ` - '--add Microsoft.Net.ComponentGroup.4.7.2.DeveloperTools ' + ` - '--add Microsoft.Net.Core.Component.SDK.1x ' + ` - '--add Microsoft.NetCore.1x.ComponentGroup.Web ' + ` - '--add Microsoft.VisualStudio.Component.Azure.Storage.AzCopy ' + ` - '--add Microsoft.VisualStudio.Component.PowerShell.Tools ' + ` - '--add Microsoft.VisualStudio.Component.VC.140 ' + ` - '--add Component.Dotfuscator ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATL ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATL.ARM ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATL.ARM64 ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATLMFC ' + ` - '--add Microsoft.VisualStudio.Component.VC.ClangC2 ' + ` - '--add Microsoft.VisualStudio.Component.VC.CLI.Support ' + ` - '--add Microsoft.VisualStudio.Component.VC.Modules.x86.x64 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.10240 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.10586 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.14393 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.15063.Desktop ' + ` - '--add Component.Unreal ' + ` - '--add Component.Unreal.Android ' + ` - '--add Component.Android.SDK23 ' + ` - '--add Microsoft.VisualStudio.Component.TestTools.WebLoadTest ' + ` - '--add Microsoft.VisualStudio.Web.Mvc4.ComponentGroup ' + ` - '--add Component.Linux.CMake ' + ` - '--add Microsoft.Component.PythonTools.UWP ' + ` - '--remove Component.CPython3.x64 ' + ` - '--add Microsoft.Component.VC.Runtime.OSSupport ' + ` - '--add Microsoft.VisualStudio.Component.VC.Tools.ARM ' + ` - '--add Microsoft.VisualStudio.ComponentGroup.UWP.VC ' + ` - '--add Microsoft.VisualStudio.Component.VSSDK ' + ` - '--add Microsoft.VisualStudio.Component.LinqToSql ' + ` - '--add Microsoft.VisualStudio.Component.TestTools.CodedUITest ' + ` - '--add Microsoft.VisualStudio.Component.TestTools.Core ' + ` - '--add Microsoft.VisualStudio.Component.TypeScript.2.0 ' + ` - '--add Microsoft.VisualStudio.Component.TypeScript.2.1 ' + ` - '--add Microsoft.VisualStudio.Component.TypeScript.2.2 ' + ` - '--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop.arm ' + ` - '--add Microsoft.VisualStudio.Component.DslTools ' + ` - '--add Microsoft.VisualStudio.Component.Windows81SDK ' + ` - '--add Microsoft.VisualStudio.Component.WinXP ' + ` - '--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 ' + ` - '--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP ' + ` - '--add Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Managed ' + ` - '--add Microsoft.Component.Blend.SDK.WPF ' + ` - '--add Microsoft.Component.VC.Runtime.UCRTSDK ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATL.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATL.ARM.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.17134 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ' + ` - '--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre '+ ` - '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ' - -$Sku = 'Enterprise' -$VSBootstrapperURL = 'https://aka.ms/vs/15/release/vs_enterprise.exe' - -$ErrorActionPreference = 'Stop' - -# Install VS -$exitCode = InstallVS -WorkLoads $WorkLoads -Sku $Sku -VSBootstrapperURL $VSBootstrapperURL - -# Find the version of VS installed for this instance -# Only supports a single instance -$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" -$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName - -if($instanceFolders -is [array]) -{ - Write-Host "More than one instance installed" - exit 1 -} - -$catalogContent = Get-Content -Path ($instanceFolders.FullName + '\catalog.json') -$catalog = $catalogContent | ConvertFrom-Json -$version = $catalog.info.id -$VSInstallRoot = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise" -Write-Host "Visual Studio version" $version "installed" - -# Initialize Visual Studio Experimental Instance for integration testing -&"$VSInstallRoot\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit | Wait-Process - -# Updating content of MachineState.json file to disable autoupdate of VSIX extensions -$newContent = '{"Extensions":[{"Key":"1e906ff5-9da8-4091-a299-5c253c55fdc9","Value":{"ShouldAutoUpdate":false}},{"Key":"Microsoft.VisualStudio.Web.AzureFunctions","Value":{"ShouldAutoUpdate":false}}],"ShouldAutoUpdate":false,"ShouldCheckForUpdates":false}' -Set-Content -Path "$VSInstallRoot\Common7\IDE\Extensions\MachineState.json" -Value $newContent - - -# Adding description of the software to Markdown - -$SoftwareName = "Visual Studio 2017 Enterprise" - -$Description = @" -_Version:_ $version
-_Location:_ $VSInstallRoot - -The following workloads including required and recommended components are installed with Visual Studio 2017: - -* Universal Windows Platform development -* .NET desktop development -* Desktop development with C++ -* ASP.NET and web development -* Azure development -* Node.js development -* Data storage and processing -* Data science and analytical applications * -* Game development with Unity * -* Linux development with C++ * -* Game development with C++ * -* Mobile development with C++ * -* Office/SharePoint development -* Mobile development with .NET -* .NET Core cross-platform development -* Visual Studio extension development * -* Python development * -* Mobile development with JavaScript * - -In addition the following optional components are installed: - -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding explicitly added Workloads details to markdown by parsing $Workloads -Add-ContentToMarkdown -Content $($WorkLoads.Split('--') | % { if( ($_.Split(" "))[0] -like "add") { "* " +($_.Split(" "))[1] } } ) - - - -exit $exitCode +################################################################################ +## File: Install-VS2017.ps1 +## Desc: Install Visual Studio 2017 +################################################################################ + +Function InstallVS +{ + Param + ( + [String]$WorkLoads, + [String]$Sku, + [String] $VSBootstrapperURL + ) + + $exitCode = -1 + + try + { + Write-Host "Enable short name support on Windows needed for Xamarin Android AOT, defaults appear to have been changed in Azure VMs" + $shortNameEnableProcess = Start-Process -FilePath fsutil.exe -ArgumentList ('8dot3name', 'set', '0') -Wait -PassThru + $shortNameEnableExitCode = $shortNameEnableProcess.ExitCode + + if ($shortNameEnableExitCode -ne 0) + { + Write-Host -Object 'Enabling short name support on Windows failed. This needs to be enabled prior to VS 2017 install for Xamarin Andriod AOT to work.' + exit $shortNameEnableExitCode + } + + Write-Host "Downloading Bootstrapper ..." + Invoke-WebRequest -Uri $VSBootstrapperURL -OutFile "${env:Temp}\vs_$Sku.exe" + + $FilePath = "${env:Temp}\vs_$Sku.exe" + $Arguments = ('/c', $FilePath, $WorkLoads, '--quiet', '--norestart', '--wait', '--nocache' ) + + Write-Host "Starting Install ..." + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + + # this wont work because of log size limitation in extension manager + # Get-Content $customLogFilePath | Write-Host + + exit $exitCode + } + } + catch + { + Write-Host -Object "Failed to install Visual Studio. Check the logs for details in $customLogFilePath" + Write-Host -Object $_.Exception.Message + exit -1 + } +} + +$WorkLoads = '--allWorkloads --includeRecommended ' + ` + '--add Microsoft.Net.Component.4.6.2.SDK ' + ` + '--add Microsoft.Net.Component.4.6.2.TargetingPack ' + ` + '--add Microsoft.Net.ComponentGroup.4.6.2.DeveloperTools ' + ` + '--add Microsoft.Net.Component.4.7.SDK ' + ` + '--add Microsoft.Net.Component.4.7.TargetingPack ' + ` + '--add Microsoft.Net.ComponentGroup.4.7.DeveloperTools ' + ` + '--add Microsoft.Net.Component.4.7.1.SDK ' + ` + '--add Microsoft.Net.Component.4.7.1.TargetingPack ' + ` + '--add Microsoft.Net.ComponentGroup.4.7.1.DeveloperTools ' + ` + '--add Microsoft.Net.ComponentGroup.4.7.2.DeveloperTools ' + ` + '--add Microsoft.Net.Core.Component.SDK.1x ' + ` + '--add Microsoft.NetCore.1x.ComponentGroup.Web ' + ` + '--add Microsoft.VisualStudio.Component.Azure.Storage.AzCopy ' + ` + '--add Microsoft.VisualStudio.Component.PowerShell.Tools ' + ` + '--add Microsoft.VisualStudio.Component.VC.140 ' + ` + '--add Component.Dotfuscator ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATL ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATL.ARM ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATL.ARM64 ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATLMFC ' + ` + '--add Microsoft.VisualStudio.Component.VC.ClangC2 ' + ` + '--add Microsoft.VisualStudio.Component.VC.CLI.Support ' + ` + '--add Microsoft.VisualStudio.Component.VC.Modules.x86.x64 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.10240 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.10586 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.14393 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.15063.Desktop ' + ` + '--add Component.Unreal ' + ` + '--add Component.Unreal.Android ' + ` + '--add Component.Android.SDK23 ' + ` + '--add Microsoft.VisualStudio.Component.TestTools.WebLoadTest ' + ` + '--add Microsoft.VisualStudio.Web.Mvc4.ComponentGroup ' + ` + '--add Component.Linux.CMake ' + ` + '--add Microsoft.Component.PythonTools.UWP ' + ` + '--remove Component.CPython3.x64 ' + ` + '--add Microsoft.Component.VC.Runtime.OSSupport ' + ` + '--add Microsoft.VisualStudio.Component.VC.Tools.ARM ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.UWP.VC ' + ` + '--add Microsoft.VisualStudio.Component.VSSDK ' + ` + '--add Microsoft.VisualStudio.Component.LinqToSql ' + ` + '--add Microsoft.VisualStudio.Component.TestTools.CodedUITest ' + ` + '--add Microsoft.VisualStudio.Component.TestTools.Core ' + ` + '--add Microsoft.VisualStudio.Component.TypeScript.2.0 ' + ` + '--add Microsoft.VisualStudio.Component.TypeScript.2.1 ' + ` + '--add Microsoft.VisualStudio.Component.TypeScript.2.2 ' + ` + '--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop.arm ' + ` + '--add Microsoft.VisualStudio.Component.DslTools ' + ` + '--add Microsoft.VisualStudio.Component.Windows81SDK ' + ` + '--add Microsoft.VisualStudio.Component.WinXP ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Managed ' + ` + '--add Microsoft.Component.Blend.SDK.WPF ' + ` + '--add Microsoft.Component.VC.Runtime.UCRTSDK ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATL.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATL.ARM.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.17134 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre '+ ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ' + +$Sku = 'Enterprise' +$VSBootstrapperURL = 'https://aka.ms/vs/15/release/vs_enterprise.exe' + +$ErrorActionPreference = 'Stop' + +# Install VS +$exitCode = InstallVS -WorkLoads $WorkLoads -Sku $Sku -VSBootstrapperURL $VSBootstrapperURL + +# Find the version of VS installed for this instance +# Only supports a single instance +$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" +$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName + +if($instanceFolders -is [array]) +{ + Write-Host "More than one instance installed" + exit 1 +} + +$catalogContent = Get-Content -Path ($instanceFolders.FullName + '\catalog.json') +$catalog = $catalogContent | ConvertFrom-Json +$version = $catalog.info.id +$VSInstallRoot = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise" +Write-Host "Visual Studio version" $version "installed" + +# Initialize Visual Studio Experimental Instance for integration testing +&"$VSInstallRoot\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit | Wait-Process + +# Updating content of MachineState.json file to disable autoupdate of VSIX extensions +$newContent = '{"Extensions":[{"Key":"1e906ff5-9da8-4091-a299-5c253c55fdc9","Value":{"ShouldAutoUpdate":false}},{"Key":"Microsoft.VisualStudio.Web.AzureFunctions","Value":{"ShouldAutoUpdate":false}}],"ShouldAutoUpdate":false,"ShouldCheckForUpdates":false}' +Set-Content -Path "$VSInstallRoot\Common7\IDE\Extensions\MachineState.json" -Value $newContent + + +# Adding description of the software to Markdown + +$SoftwareName = "Visual Studio 2017 Enterprise" + +$Description = @" +_Version:_ $version
+_Location:_ $VSInstallRoot + +The following workloads including required and recommended components are installed with Visual Studio 2017: + +* Universal Windows Platform development +* .NET desktop development +* Desktop development with C++ +* ASP.NET and web development +* Azure development +* Node.js development +* Data storage and processing +* Data science and analytical applications * +* Game development with Unity * +* Linux development with C++ * +* Game development with C++ * +* Mobile development with C++ * +* Office/SharePoint development +* Mobile development with .NET +* .NET Core cross-platform development +* Visual Studio extension development * +* Python development * +* Mobile development with JavaScript * + +In addition the following optional components are installed: + +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +# Adding explicitly added Workloads details to markdown by parsing $Workloads +Add-ContentToMarkdown -Content $($WorkLoads.Split('--') | % { if( ($_.Split(" "))[0] -like "add") { "* " +($_.Split(" "))[1] } } ) + + + +exit $exitCode diff --git a/images/win/scripts/Installers/Windows2016/Install-WDK.ps1 b/images/win/scripts/Installers/Windows2016/Install-WDK.ps1 index e1e54da94..58707f973 100644 --- a/images/win/scripts/Installers/Windows2016/Install-WDK.ps1 +++ b/images/win/scripts/Installers/Windows2016/Install-WDK.ps1 @@ -1,52 +1,51 @@ -################################################################################ -## File: Install-WDK.ps1 -## Team: CI-X -## Desc: Install the Windows Driver Kit -################################################################################ - -# Version: 10.0.17763.0 -# Update Validate-WDK.ps1 if the version changes! -# There doesn't seem to be any way to check the version programmatically - -# Requires Windows SDK with the same version number as the WDK -$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014" -$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156" - -# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI -$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet") - -if ($sdkExitCode -ne 0) -{ - Write-Host "Failed to install the Windows SDK." - exit $sdkExitCode -} - -# `wdksetup.exe /features + /quiet` installs all features without showing the GUI -$wdkExitCode = Install-EXE -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList ("/features", "+", "/quiet") - -if ($wdkExitCode -ne 0) -{ - Write-Host "Failed to install the Windows Driver Kit." - exit $wdkExitCode -} - -# Need to install the VSIX to get the build targets when running VSBuild -Write-Host "Installing WDK.vsix" -$process = Start-Process ` - -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe" ` - -ArgumentList ("/quiet", '"C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"') ` - -Wait ` - -PassThru - -$exitCode = $process.ExitCode - -if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed -{ - Write-Host "WDK.vsix installed successfully" -} -else -{ - Write-Host "Unsuccessful exit code returned by the installation process: $exitCode." -} - -exit $exitCode \ No newline at end of file +################################################################################ +## File: Install-WDK.ps1 +## Desc: Install the Windows Driver Kit +################################################################################ + +# Version: 10.0.17763.0 +# Update Validate-WDK.ps1 if the version changes! +# There doesn't seem to be any way to check the version programmatically + +# Requires Windows SDK with the same version number as the WDK +$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014" +$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156" + +# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI +$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet") + +if ($sdkExitCode -ne 0) +{ + Write-Host "Failed to install the Windows SDK." + exit $sdkExitCode +} + +# `wdksetup.exe /features + /quiet` installs all features without showing the GUI +$wdkExitCode = Install-EXE -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList ("/features", "+", "/quiet") + +if ($wdkExitCode -ne 0) +{ + Write-Host "Failed to install the Windows Driver Kit." + exit $wdkExitCode +} + +# Need to install the VSIX to get the build targets when running VSBuild +Write-Host "Installing WDK.vsix" +$process = Start-Process ` + -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe" ` + -ArgumentList ("/quiet", '"C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"') ` + -Wait ` + -PassThru + +$exitCode = $process.ExitCode + +if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed +{ + Write-Host "WDK.vsix installed successfully" +} +else +{ + Write-Host "Unsuccessful exit code returned by the installation process: $exitCode." +} + +exit $exitCode diff --git a/images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1 b/images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1 index 4bfccaa18..992f6a9e8 100644 --- a/images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1 +++ b/images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1 @@ -1,15 +1,14 @@ -################################################################################ -## File: Install-Win81SDK.ps1 -## Team: CI-Platform -## Desc: Install Windows 8.1 SDK -################################################################################ - -Import-Module -Name ImageHelpers -Force - -$InstallerURI = 'http://download.microsoft.com/download/B/0/C/B0C80BA3-8AD6-4958-810B-6882485230B5/standalonesdk/sdksetup.exe' -$InstallerName = 'sdksetup.exe' -$ArgumentList = ('/quiet', '/norestart') - -$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList - -exit $exitCode +################################################################################ +## File: Install-Win81SDK.ps1 +## Desc: Install Windows 8.1 SDK +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$InstallerURI = 'http://download.microsoft.com/download/B/0/C/B0C80BA3-8AD6-4958-810B-6882485230B5/standalonesdk/sdksetup.exe' +$InstallerName = 'sdksetup.exe' +$ArgumentList = ('/quiet', '/norestart') + +$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList + +exit $exitCode diff --git a/images/win/scripts/Installers/Windows2016/Install-Wix.ps1 b/images/win/scripts/Installers/Windows2016/Install-Wix.ps1 index e45fdc4f7..44ee25c2c 100644 --- a/images/win/scripts/Installers/Windows2016/Install-Wix.ps1 +++ b/images/win/scripts/Installers/Windows2016/Install-Wix.ps1 @@ -1,54 +1,53 @@ -################################################################################ -## File: Install-Wix.ps1 -## Team: CI-Build -## Desc: Install WIX. -################################################################################ -function Install-VsixExtension -{ - Param - ( - [String]$Url, - [String]$Name - ) - - $exitCode = -1 - - try - { - Write-Host "Downloading $Name..." - $FilePath = "${env:Temp}\$Name" - - Invoke-WebRequest -Uri $Url -OutFile $FilePath - - $ArgumentList = ('/quiet', $FilePath) - - Write-Host "Starting Install $Name..." - $process = Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList $ArgumentList -Wait -PassThru - $exitCode = $process.ExitCode - - if ($exitCode -eq 0 -or $exitCode -eq 3010) - { - Write-Host -Object 'Installation successful' - return $exitCode - } - else - { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - return $exitCode - } - } - catch - { - Write-Host -Object "Failed to install the Extension $Name" - Write-Host -Object $_.Exception.Message - return -1 - } -} - - -choco install wixtoolset -y --force - -#Installing VS extension 'Wix Toolset Visual Studio 2017 Extension' -$exitCode = Install-VsixExtension -Url 'https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix' -Name 'Votive2017.vsix' - -return $exitCode +################################################################################ +## File: Install-Wix.ps1 +## Desc: Install WIX. +################################################################################ +function Install-VsixExtension +{ + Param + ( + [String]$Url, + [String]$Name + ) + + $exitCode = -1 + + try + { + Write-Host "Downloading $Name..." + $FilePath = "${env:Temp}\$Name" + + Invoke-WebRequest -Uri $Url -OutFile $FilePath + + $ArgumentList = ('/quiet', $FilePath) + + Write-Host "Starting Install $Name..." + $process = Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList $ArgumentList -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + return $exitCode + } + } + catch + { + Write-Host -Object "Failed to install the Extension $Name" + Write-Host -Object $_.Exception.Message + return -1 + } +} + + +choco install wixtoolset -y --force + +#Installing VS extension 'Wix Toolset Visual Studio 2017 Extension' +$exitCode = Install-VsixExtension -Url 'https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix' -Name 'Votive2017.vsix' + +return $exitCode diff --git a/images/win/scripts/Installers/Windows2016/Run-Antivirus.ps1 b/images/win/scripts/Installers/Windows2016/Run-Antivirus.ps1 index 52fa5c832..77b3b2bc9 100644 --- a/images/win/scripts/Installers/Windows2016/Run-Antivirus.ps1 +++ b/images/win/scripts/Installers/Windows2016/Run-Antivirus.ps1 @@ -1,20 +1,19 @@ -################################################################################ -## File: Run-Antivirus.ps1 -## Team: CI-Platform -## Desc: Run a full antivirus scan. -## Run right after cleanup before we sysprep -################################################################################ - -Write-Host "Run antivirus" -Push-Location "C:\Program Files\Windows Defender" - -# Tell Defender to use 100% of the CPU during the scan -Set-MpPreference -ScanAvgCPULoadFactor 100 - -# Full Scan -.\MpCmdRun.exe -Scan -ScanType 2 -Pop-Location - -Write-Host "Set antivirus parmeters" -Set-MpPreference -ScanAvgCPULoadFactor 5 ` - -ExclusionPath "D:\", "C:\" \ No newline at end of file +################################################################################ +## File: Run-Antivirus.ps1 +## Desc: Run a full antivirus scan. +## Run right after cleanup before we sysprep +################################################################################ + +Write-Host "Run antivirus" +Push-Location "C:\Program Files\Windows Defender" + +# Tell Defender to use 100% of the CPU during the scan +Set-MpPreference -ScanAvgCPULoadFactor 100 + +# Full Scan +.\MpCmdRun.exe -Scan -ScanType 2 +Pop-Location + +Write-Host "Set antivirus parmeters" +Set-MpPreference -ScanAvgCPULoadFactor 5 ` + -ExclusionPath "D:\", "C:\" diff --git a/images/win/scripts/Installers/Windows2016/Update-DockerImages.ps1 b/images/win/scripts/Installers/Windows2016/Update-DockerImages.ps1 index 14eb1f026..d396d0185 100644 --- a/images/win/scripts/Installers/Windows2016/Update-DockerImages.ps1 +++ b/images/win/scripts/Installers/Windows2016/Update-DockerImages.ps1 @@ -1,36 +1,35 @@ -################################################################################ -## File: Update-DockerImages.ps1 -## Team: ReleaseManagement -## Desc: Pull some standard docker images. -## Must be run after docker is installed. -################################################################################ - -function DockerPull { - Param ([string]$image) - - Write-Host Installing $image ... - docker pull $image - - if (!$?) { - echo "Docker pull failed with a non-zero exit code" - exit 1 - } -} - -DockerPull mcr.microsoft.com/windows/servercore:ltsc2016 -DockerPull mcr.microsoft.com/windows/nanoserver:10.0.14393.953 -DockerPull microsoft/aspnetcore-build:1.0-2.0 -DockerPull mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2016 -DockerPull mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2016 - -# Adding description of the software to Markdown - -$SoftwareName = "Docker images" - -$Description = @" -The following container images have been cached: -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -Add-ContentToMarkdown -Content $(docker images --digests --format "* {{.Repository}}:{{.Tag}} (Digest: {{.Digest}})") \ No newline at end of file +################################################################################ +## File: Update-DockerImages.ps1 +## Desc: Pull some standard docker images. +## Must be run after docker is installed. +################################################################################ + +function DockerPull { + Param ([string]$image) + + Write-Host Installing $image ... + docker pull $image + + if (!$?) { + echo "Docker pull failed with a non-zero exit code" + exit 1 + } +} + +DockerPull mcr.microsoft.com/windows/servercore:ltsc2016 +DockerPull mcr.microsoft.com/windows/nanoserver:10.0.14393.953 +DockerPull microsoft/aspnetcore-build:1.0-2.0 +DockerPull mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2016 +DockerPull mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2016 + +# Adding description of the software to Markdown + +$SoftwareName = "Docker images" + +$Description = @" +The following container images have been cached: +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +Add-ContentToMarkdown -Content $(docker images --digests --format "* {{.Repository}}:{{.Tag}} (Digest: {{.Digest}})") diff --git a/images/win/scripts/Installers/Windows2016/Validate-SSDT.ps1 b/images/win/scripts/Installers/Windows2016/Validate-SSDT.ps1 index e786eb64e..9d9a1c4a4 100644 --- a/images/win/scripts/Installers/Windows2016/Validate-SSDT.ps1 +++ b/images/win/scripts/Installers/Windows2016/Validate-SSDT.ps1 @@ -1,51 +1,50 @@ -################################################################################ -## File: Validate-SSDT.ps1 -## Team: CI-Platform -## Desc: Validate SQL Server Data Tools for Windows -################################################################################ - -Import-Module -Name ImageHelpers -Force - -function Get-SSDTExtensionPackage { - $vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" - $instanceFolders = Get-ChildItem -Path $vsProgramData.FullName - - if($instanceFolders -is [array]) - { - Write-Host "More than one instance installed" - exit 1 - } - - $stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json') - $state = $stateContent | ConvertFrom-Json - $SsdtPackage = $state.packages | where { $_.id -eq "SSDT" } - return $SsdtPackage -} - - -$SsdtPackage = Get-SSDTExtensionPackage - -if($SsdtPackage){ - Write-Host "SSDT version" $SsdtPackage.version "installed" -} -else { - Write-Host "SSDT is not installed" - exit 1 -} - - -# Adding description of the software to Markdown -$SoftwareName = "SQL Server Data Tools for VS 2017" - -$Description = @" -_Version:_ $($SsdtPackage.version)
- -The following components are installed: - -* SQL Server Data Tools -* SQL Server Analysis Services Designer -* SQL Server Integration Services Designer -* SQL Server Reporting Services Designers -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file +################################################################################ +## File: Validate-SSDT.ps1 +## Desc: Validate SQL Server Data Tools for Windows +################################################################################ + +Import-Module -Name ImageHelpers -Force + +function Get-SSDTExtensionPackage { + $vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" + $instanceFolders = Get-ChildItem -Path $vsProgramData.FullName + + if($instanceFolders -is [array]) + { + Write-Host "More than one instance installed" + exit 1 + } + + $stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json') + $state = $stateContent | ConvertFrom-Json + $SsdtPackage = $state.packages | where { $_.id -eq "SSDT" } + return $SsdtPackage +} + + +$SsdtPackage = Get-SSDTExtensionPackage + +if($SsdtPackage){ + Write-Host "SSDT version" $SsdtPackage.version "installed" +} +else { + Write-Host "SSDT is not installed" + exit 1 +} + + +# Adding description of the software to Markdown +$SoftwareName = "SQL Server Data Tools for VS 2017" + +$Description = @" +_Version:_ $($SsdtPackage.version)
+ +The following components are installed: + +* SQL Server Data Tools +* SQL Server Analysis Services Designer +* SQL Server Integration Services Designer +* SQL Server Reporting Services Designers +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2016/Validate-WDK.ps1 b/images/win/scripts/Installers/Windows2016/Validate-WDK.ps1 index d98843f3e..f9edf1609 100644 --- a/images/win/scripts/Installers/Windows2016/Validate-WDK.ps1 +++ b/images/win/scripts/Installers/Windows2016/Validate-WDK.ps1 @@ -1,14 +1,13 @@ -################################################################################ -## File: Validate-WDK.ps1 -## Team: CI-X -## Desc: Validate the installation of the Windows Driver Kit -################################################################################ - -# Adding description of the software to Markdown -$SoftwareName = "Windows Driver Kit" - -$Description = @" -_Version:_ 10.0.17763.0
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file +################################################################################ +## File: Validate-WDK.ps1 +## Desc: Validate the installation of the Windows Driver Kit +################################################################################ + +# Adding description of the software to Markdown +$SoftwareName = "Windows Driver Kit" + +$Description = @" +_Version:_ 10.0.17763.0
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2016/Validate-Wix.ps1 b/images/win/scripts/Installers/Windows2016/Validate-Wix.ps1 index 7a59f67e3..090df37a9 100644 --- a/images/win/scripts/Installers/Windows2016/Validate-Wix.ps1 +++ b/images/win/scripts/Installers/Windows2016/Validate-Wix.ps1 @@ -1,63 +1,62 @@ -################################################################################ -## File: Validate-Wix.ps1 -## Team: CI-Build -## Desc: Validate WIX. -################################################################################ - -Import-Module -Name ImageHelpers -Force -function Get-WixVersion { - $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" - $installedApplications = Get-ItemProperty -Path $regKey - $Version = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("wix") } | Select-Object -First 1).DisplayVersion - return $Version -} - -#Gets the extension details from state.json -function Get-WixExtensionPackage { - $vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" - $instanceFolders = Get-ChildItem -Path $vsProgramData.FullName - - if($instanceFolders -is [array]) - { - Write-Host "More than one instance installed" - exit 1 - } - - $stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json') - $state = $stateContent | ConvertFrom-Json - $WixPackage = $state.packages | where { $_.id -eq "WixToolset.VisualStudioExtension.Dev15" } - return $WixPackage -} - -$WixToolSetVersion = Get-WixVersion - -if($WixToolSetVersion) { - Write-Host "Wix Toolset version" $WixPackage.version "installed" -} -else { - Write-Host "Wix Toolset is not installed" - exit 1 -} - -$WixPackage = Get-WixExtensionPackage - -if($WixPackage) { - Write-Host "Wix Extension version" $WixPackage.version "installed" -} -else { - Write-Host "Wix Extension is not installed" - exit 1 -} - - -# Adding description of the software to Markdown -$SoftwareName = "WIX Tools" - -$Description = @" -_Toolset Version:_ $WixToolSetVersion
-_WIX Toolset Studio 2017 Extension Version:_ $($WixPackage.version)
-_Environment:_ -* WIX: Installation root of WIX -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file +################################################################################ +## File: Validate-Wix.ps1 +## Desc: Validate WIX. +################################################################################ + +Import-Module -Name ImageHelpers -Force +function Get-WixVersion { + $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" + $installedApplications = Get-ItemProperty -Path $regKey + $Version = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("wix") } | Select-Object -First 1).DisplayVersion + return $Version +} + +#Gets the extension details from state.json +function Get-WixExtensionPackage { + $vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" + $instanceFolders = Get-ChildItem -Path $vsProgramData.FullName + + if($instanceFolders -is [array]) + { + Write-Host "More than one instance installed" + exit 1 + } + + $stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json') + $state = $stateContent | ConvertFrom-Json + $WixPackage = $state.packages | where { $_.id -eq "WixToolset.VisualStudioExtension.Dev15" } + return $WixPackage +} + +$WixToolSetVersion = Get-WixVersion + +if($WixToolSetVersion) { + Write-Host "Wix Toolset version" $WixPackage.version "installed" +} +else { + Write-Host "Wix Toolset is not installed" + exit 1 +} + +$WixPackage = Get-WixExtensionPackage + +if($WixPackage) { + Write-Host "Wix Extension version" $WixPackage.version "installed" +} +else { + Write-Host "Wix Extension is not installed" + exit 1 +} + + +# Adding description of the software to Markdown +$SoftwareName = "WIX Tools" + +$Description = @" +_Toolset Version:_ $WixToolSetVersion
+_WIX Toolset Studio 2017 Extension Version:_ $($WixPackage.version)
+_Environment:_ +* WIX: Installation root of WIX +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 b/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 index 8b9d2d027..83087f706 100644 --- a/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 +++ b/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 @@ -1,146 +1,145 @@ -################################################################################ -## File: Initialize-VM.ps1 -## Team: CI-Platform -## Desc: VM initialization script, machine level configuration -################################################################################ - -function Disable-InternetExplorerESC { - $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" - $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" - Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force - Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force - Stop-Process -Name Explorer -Force -ErrorAction Continue - Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." -} - -function Disable-InternetExplorerWelcomeScreen { - $AdminKey = "HKLM:\Software\Policies\Microsoft\Internet Explorer\Main" - New-Item -Path $AdminKey -Value 1 -Force - Set-ItemProperty -Path $AdminKey -Name "DisableFirstRunCustomize" -Value 1 -Force - Write-Host "Disabled IE Welcome screen" -} - -function Disable-UserAccessControl { - Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 00000000 -Force - Write-Host "User Access Control (UAC) has been disabled." -} - -Import-Module -Name ImageHelpers -Force - -Write-Host "Setup PowerShellGet" -# Set-PSRepository -InstallationPolicy Trusted -Name PSGallery -Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Install-Module -Name PowerShellGet -Force -Set-PSRepository -InstallationPolicy Trusted -Name PSGallery - - -Write-Host "Disable Antivirus" -Set-MpPreference -DisableRealtimeMonitoring $true - -# Disable Windows Update -$AutoUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -If (Test-Path -Path $AutoUpdatePath) { - Set-ItemProperty -Path $AutoUpdatePath -Name NoAutoUpdate -Value 1 - Write-Host "Disabled Windows Update" -} -else { - Write-Host "Windows Update key does not exist" -} - -# Install .NET Framework 3.5 (required by Chocolatey) -Install-WindowsFeature -Name NET-Framework-Features -IncludeAllSubFeature -# Explicitly install all 4.7 sub features to include ASP.Net. -# As of 1/16/2019, WinServer 19 lists .Net 4.7 as NET-Framework-45-Features -Install-WindowsFeature -Name NET-Framework-45-Features -IncludeAllSubFeature - -Write-Host "Disable UAC" -Disable-UserAccessControl - -Write-Host "Disable IE Welcome Screen" -Disable-InternetExplorerWelcomeScreen - -Write-Host "Disable IE ESC" -Disable-InternetExplorerESC - -Write-Host "Setting local execution policy" -Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine -ErrorAction Continue | Out-Null -Get-ExecutionPolicy -List - -Write-Host "Enable long path behavior" -# See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation -Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 - -Write-Host "Install chocolatey" -$chocoExePath = 'C:\ProgramData\Chocolatey\bin' - -if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower())) { - Write-Host "Chocolatey found in PATH, skipping install..." - Exit -} - -# Add to system PATH -$systemPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) -$systemPath += ';' + $chocoExePath -[Environment]::SetEnvironmentVariable("PATH", $systemPath, [System.EnvironmentVariableTarget]::Machine) - -# Update local process' path -$userPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User) -if ($userPath) { - $env:Path = $systemPath + ";" + $userPath -} -else { - $env:Path = $systemPath -} - -# Run the installer -Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) - -# Turn off confirmation -choco feature enable -n allowGlobalConfirmation - -# Install webpi -choco install webpicmd -y - -# Expand disk size of OS drive - -New-Item -Path d:\ -Name cmds.txt -ItemType File -Force - -Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" - -$expandResult = (diskpart /s 'd:\cmds.txt') - -Write-Host $expandResult - -Write-Host "Disk sizes after expansion" - -wmic logicaldisk get size,freespace,caption - - -# Adding description of the software to Markdown - -$Content = @" -# Hosted Windows 2019 - -The following software is installed on machines in the **Hosted Windows 2019** (v$env:ImageVersion) pool. - -Components marked with **\*** have been upgraded since the previous version of the image. - -"@ - -Add-ContentToMarkdown -Content $Content - - -$SoftwareName = "Chocolatey" - -if( $( $(choco version) | Out-String) -match 'Chocolatey v(?.*).*' ) -{ - $chocoVersion = $Matches.version.Trim() -} - -$Description = @" -_Version:_ $chocoVersion
-_Environment:_ -* PATH: contains location for choco.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Initialize-VM.ps1 +## Desc: VM initialization script, machine level configuration +################################################################################ + +function Disable-InternetExplorerESC { + $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" + $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" + Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force + Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force + Stop-Process -Name Explorer -Force -ErrorAction Continue + Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." +} + +function Disable-InternetExplorerWelcomeScreen { + $AdminKey = "HKLM:\Software\Policies\Microsoft\Internet Explorer\Main" + New-Item -Path $AdminKey -Value 1 -Force + Set-ItemProperty -Path $AdminKey -Name "DisableFirstRunCustomize" -Value 1 -Force + Write-Host "Disabled IE Welcome screen" +} + +function Disable-UserAccessControl { + Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 00000000 -Force + Write-Host "User Access Control (UAC) has been disabled." +} + +Import-Module -Name ImageHelpers -Force + +Write-Host "Setup PowerShellGet" +# Set-PSRepository -InstallationPolicy Trusted -Name PSGallery +Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force +Install-Module -Name PowerShellGet -Force +Set-PSRepository -InstallationPolicy Trusted -Name PSGallery + + +Write-Host "Disable Antivirus" +Set-MpPreference -DisableRealtimeMonitoring $true + +# Disable Windows Update +$AutoUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" +If (Test-Path -Path $AutoUpdatePath) { + Set-ItemProperty -Path $AutoUpdatePath -Name NoAutoUpdate -Value 1 + Write-Host "Disabled Windows Update" +} +else { + Write-Host "Windows Update key does not exist" +} + +# Install .NET Framework 3.5 (required by Chocolatey) +Install-WindowsFeature -Name NET-Framework-Features -IncludeAllSubFeature +# Explicitly install all 4.7 sub features to include ASP.Net. +# As of 1/16/2019, WinServer 19 lists .Net 4.7 as NET-Framework-45-Features +Install-WindowsFeature -Name NET-Framework-45-Features -IncludeAllSubFeature + +Write-Host "Disable UAC" +Disable-UserAccessControl + +Write-Host "Disable IE Welcome Screen" +Disable-InternetExplorerWelcomeScreen + +Write-Host "Disable IE ESC" +Disable-InternetExplorerESC + +Write-Host "Setting local execution policy" +Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine -ErrorAction Continue | Out-Null +Get-ExecutionPolicy -List + +Write-Host "Enable long path behavior" +# See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation +Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 + +Write-Host "Install chocolatey" +$chocoExePath = 'C:\ProgramData\Chocolatey\bin' + +if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower())) { + Write-Host "Chocolatey found in PATH, skipping install..." + Exit +} + +# Add to system PATH +$systemPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) +$systemPath += ';' + $chocoExePath +[Environment]::SetEnvironmentVariable("PATH", $systemPath, [System.EnvironmentVariableTarget]::Machine) + +# Update local process' path +$userPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User) +if ($userPath) { + $env:Path = $systemPath + ";" + $userPath +} +else { + $env:Path = $systemPath +} + +# Run the installer +Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) + +# Turn off confirmation +choco feature enable -n allowGlobalConfirmation + +# Install webpi +choco install webpicmd -y + +# Expand disk size of OS drive + +New-Item -Path d:\ -Name cmds.txt -ItemType File -Force + +Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" + +$expandResult = (diskpart /s 'd:\cmds.txt') + +Write-Host $expandResult + +Write-Host "Disk sizes after expansion" + +wmic logicaldisk get size,freespace,caption + + +# Adding description of the software to Markdown + +$Content = @" +# Azure Pipelines Hosted Windows 2019 with VS2019 image + +The following software is installed on machines in the Azure Pipelines **Hosted Windows 2019 with VS2019** (v$env:ImageVersion) pool. + +Components marked with **\*** have been upgraded since the previous version of the image. + +"@ + +Add-ContentToMarkdown -Content $Content + + +$SoftwareName = "Chocolatey" + +if( $( $(choco version) | Out-String) -match 'Chocolatey v(?.*).*' ) +{ + $chocoVersion = $Matches.version.Trim() +} + +$Description = @" +_Version:_ $chocoVersion
+_Environment:_ +* PATH: contains location for choco.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2019/Install-Python.ps1 b/images/win/scripts/Installers/Windows2019/Install-Python.ps1 index 0dc6d6e1a..932ec197e 100644 --- a/images/win/scripts/Installers/Windows2019/Install-Python.ps1 +++ b/images/win/scripts/Installers/Windows2019/Install-Python.ps1 @@ -1,29 +1,28 @@ -################################################################################ -## File: Install-Python.ps1 -## Team: CI-X -## Desc: Configure python on path with 3.7.* version from the tools cache -## Must run after tools cache is setup -################################################################################ - -Import-Module -Name ImageHelpers -Force - -$python37path = $Env:AGENT_TOOLSDIRECTORY + '/Python/3.7*/x64' -$pythonDir = Get-Item -Path $python37path - -if($pythonDir -is [array]) -{ - Write-Host "More than one python 3.7.* installations found" - Write-Host $pythonDir - exit 1 -} - -$currentPath = Get-MachinePath - -if ($currentPath | Select-String -SimpleMatch $pythonDir.FullName) -{ - Write-Host $pythonDir.FullName ' is already in PATH' - exit 0 -} - -Add-MachinePathItem -PathItem $pythonDir.FullName -Add-MachinePathItem -PathItem "$($pythonDir.FullName)\Scripts" +################################################################################ +## File: Install-Python.ps1 +## Desc: Configure python on path with 3.7.* version from the tools cache +## Must run after tools cache is setup +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$python37path = $Env:AGENT_TOOLSDIRECTORY + '/Python/3.7*/x64' +$pythonDir = Get-Item -Path $python37path + +if($pythonDir -is [array]) +{ + Write-Host "More than one python 3.7.* installations found" + Write-Host $pythonDir + exit 1 +} + +$currentPath = Get-MachinePath + +if ($currentPath | Select-String -SimpleMatch $pythonDir.FullName) +{ + Write-Host $pythonDir.FullName ' is already in PATH' + exit 0 +} + +Add-MachinePathItem -PathItem $pythonDir.FullName +Add-MachinePathItem -PathItem "$($pythonDir.FullName)\Scripts" diff --git a/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 index f01c5d119..3bca3310a 100644 --- a/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 +++ b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 @@ -1,191 +1,189 @@ -################################################################################ -## File: Install-VS2019.ps1 -## Team: CI-Build -## Desc: Install Visual Studio 2019 -################################################################################ -$ErrorActionPreference = "Stop" - -Function InstallVS -{ - Param - ( - [String]$WorkLoads, - [String]$Sku, - [String] $VSBootstrapperURL - ) - - $exitCode = -1 - - try - { - Write-Host "Enable short name support on Windows needed for Xamarin Android AOT, defaults appear to have been changed in Azure VMs" - $shortNameEnableProcess = Start-Process -FilePath fsutil.exe -ArgumentList ('8dot3name', 'set', '0') -Wait -PassThru - $shortNameEnableExitCode = $shortNameEnableProcess.ExitCode - - if ($shortNameEnableExitCode -ne 0) - { - Write-Host -Object 'Enabling short name support on Windows failed. This needs to be enabled prior to VS 2017 install for Xamarin Andriod AOT to work.' - exit $shortNameEnableExitCode - } - - Write-Host "Downloading Bootstrapper ..." - Invoke-WebRequest -Uri $VSBootstrapperURL -OutFile "${env:Temp}\vs_$Sku.exe" - - $FilePath = "${env:Temp}\vs_$Sku.exe" - $Arguments = ('/c', $FilePath, $WorkLoads, '--quiet', '--norestart', '--wait', '--nocache' ) - - Write-Host "Starting Install ..." - $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru - $exitCode = $process.ExitCode - - if ($exitCode -eq 0 -or $exitCode -eq 3010) - { - Write-Host -Object 'Installation successful' - return $exitCode - } - else - { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - - # this wont work because of log size limitation in extension manager - # Get-Content $customLogFilePath | Write-Host - - exit $exitCode - } - } - catch - { - Write-Host -Object "Failed to install Visual Studio. Check the logs for details in $customLogFilePath" - Write-Host -Object $_.Exception.Message - exit -1 - } -} - -$WorkLoads = '--allWorkloads --includeRecommended ' + ` - '--add Component.Dotfuscator ' + ` - '--add Component.Linux.CMake ' + ` - '--add Component.UnityEngine.x64 ' + ` - '--add Component.UnityEngine.x86 ' + ` - '--add Component.Unreal.Android ' + ` - '--add Microsoft.Component.Azure.DataLake.Tools ' + ` - '--add Microsoft.Component.CookiecutterTools ' + ` - '--add Microsoft.Component.PythonTools.Miniconda ' + ` - '--add Microsoft.Component.PythonTools.Web ' + ` - '--add Microsoft.Component.VC.Runtime.UCRTSDK ' + ` - '--add Microsoft.Net.ComponentGroup.4.6.2.DeveloperTools ' + ` - '--add Microsoft.Net.ComponentGroup.4.7.1.DeveloperTools ' + ` - '--add Microsoft.Net.ComponentGroup.4.7.DeveloperTools ' + ` - '--add Microsoft.VisualStudio.Component.AspNet45 ' + ` - '--add Microsoft.VisualStudio.Component.Azure.Kubernetes.Tools ' + ` - '--add Microsoft.VisualStudio.Component.Azure.MobileAppsSdk ' + ` - '--add Microsoft.VisualStudio.Component.Azure.ServiceFabric.Tools ' + ` - '--add Microsoft.VisualStudio.Component.Azure.Storage.AzCopy ' + ` - '--add Microsoft.VisualStudio.Component.Debugger.JustInTime ' + ` - '--add Microsoft.VisualStudio.Component.DslTools ' + ` - '--add Microsoft.VisualStudio.Component.EntityFramework ' + ` - '--add Microsoft.VisualStudio.Component.FSharp.Desktop ' + ` - '--add Microsoft.VisualStudio.Component.LinqToSql ' + ` - '--add Microsoft.VisualStudio.Component.PortableLibrary ' + ` - '--add Microsoft.VisualStudio.Component.TeamOffice ' + ` - '--add Microsoft.VisualStudio.Component.TestTools.CodedUITest ' + ` - '--add Microsoft.VisualStudio.Component.TestTools.WebLoadTest ' + ` - '--add Microsoft.VisualStudio.Component.UWP.VC.ARM64 ' + ` - '--add Microsoft.VisualStudio.Component.VC.140 ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATL.ARM ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATLMFC ' + ` - '--add Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.CLI.Support ' + ` - '--add Microsoft.VisualStudio.Component.VC.CMake.Project ' + ` - '--add Microsoft.VisualStudio.Component.VC.DiagnosticTools ' + ` - '--add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ' + ` - '--add Microsoft.VisualStudio.Component.VC.MFC.ARM ' + ` - '--add Microsoft.VisualStudio.Component.VC.MFC.ARM.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ' + ` - '--add Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.Redist.MSM ' + ` - '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre ' + ` - '--add Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest ' + ` - '--add Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest ' + ` - '--add Microsoft.VisualStudio.Component.VC.v141 ' + ` - '--add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.16299 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.17134 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ' + ` - '--add Microsoft.VisualStudio.Component.Windows10SDK.18362 ' + ` - '--add Microsoft.VisualStudio.ComponentGroup.Azure.CloudServices ' + ` - '--add Microsoft.VisualStudio.ComponentGroup.Azure.ResourceManager.Tools ' + ` - '--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang ' + ` - '--add Microsoft.VisualStudio.ComponentGroup.Web.CloudTools ' + ` - '--add Microsoft.VisualStudio.Workload.Azure ' + ` - '--add Microsoft.VisualStudio.Workload.Data ' + ` - '--add Microsoft.VisualStudio.Workload.DataScience ' + ` - '--add Microsoft.VisualStudio.Workload.ManagedDesktop ' + ` - '--add Microsoft.VisualStudio.Workload.ManagedGame ' + ` - '--add Microsoft.VisualStudio.Workload.NativeCrossPlat ' + ` - '--add Microsoft.VisualStudio.Workload.NativeDesktop ' + ` - '--add Microsoft.VisualStudio.Workload.NativeGame ' + ` - '--add Microsoft.VisualStudio.Workload.NativeMobile ' + ` - '--add Microsoft.VisualStudio.Workload.NetCoreTools ' + ` - '--add Microsoft.VisualStudio.Workload.NetCrossPlat ' + ` - '--add Microsoft.VisualStudio.Workload.NetWeb ' + ` - '--add Microsoft.VisualStudio.Workload.Node ' + ` - '--add Microsoft.VisualStudio.Workload.Office ' + ` - '--add Microsoft.VisualStudio.Workload.Python ' + ` - '--remove Component.CPython3.x64 ' + ` - '--add Microsoft.VisualStudio.Workload.Universal ' + ` - '--add Microsoft.VisualStudio.Workload.VisualStudioExtension' - - -$ReleaseInPath = 'Enterprise' -$Sku = 'Enterprise' -$VSBootstrapperURL = 'https://aka.ms/vs/16/release/vs_Enterprise.exe' - -$ErrorActionPreference = 'Stop' - -# Install VS -$exitCode = InstallVS -WorkLoads $WorkLoads -Sku $Sku -VSBootstrapperURL $VSBootstrapperURL - -# Find the version of VS installed for this instance -# Only supports a single instance -$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" -$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName - -if($instanceFolders -is [array]) -{ - Write-Host "More than one instance installed" - exit 1 -} - -$catalogContent = Get-Content -Path ($instanceFolders.FullName + '\catalog.json') -$catalog = $catalogContent | ConvertFrom-Json -$version = $catalog.info.id -Write-Host "Visual Studio version" $version "installed" - -# Initialize Visual Studio Experimental Instance -&"C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit - -# Updating content of MachineState.json file to disable autoupdate of VSIX extensions -$newContent = '{"Extensions":[{"Key":"1e906ff5-9da8-4091-a299-5c253c55fdc9","Value":{"ShouldAutoUpdate":false}},{"Key":"Microsoft.VisualStudio.Web.AzureFunctions","Value":{"ShouldAutoUpdate":false}}],"ShouldAutoUpdate":false,"ShouldCheckForUpdates":false}' -Set-Content -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath\Common7\IDE\Extensions\MachineState.json" -Value $newContent - - -# Adding description of the software to Markdown - -$SoftwareName = "Visual Studio 2019 Enterprise" - -$Description = @" -_Version:_ $version
-_Location:_ C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath - -The following workloads and components are installed with Visual Studio 2019: -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding explicitly added Workloads details to markdown by parsing $Workloads -Add-ContentToMarkdown -Content $($WorkLoads.Split('--') | % { if( ($_.Split(" "))[0] -like "add") { "* " +($_.Split(" "))[1] } } ) - - -exit $exitCode +################################################################################ +## File: Install-VS2019.ps1 +## Desc: Install Visual Studio 2019 +################################################################################ +$ErrorActionPreference = "Stop" + +Function InstallVS +{ + Param + ( + [String]$WorkLoads, + [String]$Sku, + [String] $VSBootstrapperURL + ) + + $exitCode = -1 + + try + { + Write-Host "Enable short name support on Windows needed for Xamarin Android AOT, defaults appear to have been changed in Azure VMs" + $shortNameEnableProcess = Start-Process -FilePath fsutil.exe -ArgumentList ('8dot3name', 'set', '0') -Wait -PassThru + $shortNameEnableExitCode = $shortNameEnableProcess.ExitCode + + if ($shortNameEnableExitCode -ne 0) + { + Write-Host -Object 'Enabling short name support on Windows failed. This needs to be enabled prior to VS 2017 install for Xamarin Andriod AOT to work.' + exit $shortNameEnableExitCode + } + + Write-Host "Downloading Bootstrapper ..." + Invoke-WebRequest -Uri $VSBootstrapperURL -OutFile "${env:Temp}\vs_$Sku.exe" + + $FilePath = "${env:Temp}\vs_$Sku.exe" + $Arguments = ('/c', $FilePath, $WorkLoads, '--quiet', '--norestart', '--wait', '--nocache' ) + + Write-Host "Starting Install ..." + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + + # this wont work because of log size limitation in extension manager + # Get-Content $customLogFilePath | Write-Host + + exit $exitCode + } + } + catch + { + Write-Host -Object "Failed to install Visual Studio. Check the logs for details in $customLogFilePath" + Write-Host -Object $_.Exception.Message + exit -1 + } +} + +$WorkLoads = '--allWorkloads --includeRecommended ' + ` + '--add Component.Dotfuscator ' + ` + '--add Component.Linux.CMake ' + ` + '--add Component.UnityEngine.x64 ' + ` + '--add Component.UnityEngine.x86 ' + ` + '--add Component.Unreal.Android ' + ` + '--add Microsoft.Component.Azure.DataLake.Tools ' + ` + '--add Microsoft.Component.CookiecutterTools ' + ` + '--add Microsoft.Component.PythonTools.Miniconda ' + ` + '--add Microsoft.Component.PythonTools.Web ' + ` + '--add Microsoft.Component.VC.Runtime.UCRTSDK ' + ` + '--add Microsoft.Net.ComponentGroup.4.6.2.DeveloperTools ' + ` + '--add Microsoft.Net.ComponentGroup.4.7.1.DeveloperTools ' + ` + '--add Microsoft.Net.ComponentGroup.4.7.DeveloperTools ' + ` + '--add Microsoft.VisualStudio.Component.AspNet45 ' + ` + '--add Microsoft.VisualStudio.Component.Azure.Kubernetes.Tools ' + ` + '--add Microsoft.VisualStudio.Component.Azure.MobileAppsSdk ' + ` + '--add Microsoft.VisualStudio.Component.Azure.ServiceFabric.Tools ' + ` + '--add Microsoft.VisualStudio.Component.Azure.Storage.AzCopy ' + ` + '--add Microsoft.VisualStudio.Component.Debugger.JustInTime ' + ` + '--add Microsoft.VisualStudio.Component.DslTools ' + ` + '--add Microsoft.VisualStudio.Component.EntityFramework ' + ` + '--add Microsoft.VisualStudio.Component.FSharp.Desktop ' + ` + '--add Microsoft.VisualStudio.Component.LinqToSql ' + ` + '--add Microsoft.VisualStudio.Component.PortableLibrary ' + ` + '--add Microsoft.VisualStudio.Component.TeamOffice ' + ` + '--add Microsoft.VisualStudio.Component.TestTools.CodedUITest ' + ` + '--add Microsoft.VisualStudio.Component.TestTools.WebLoadTest ' + ` + '--add Microsoft.VisualStudio.Component.UWP.VC.ARM64 ' + ` + '--add Microsoft.VisualStudio.Component.VC.140 ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATL.ARM ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATLMFC ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.CLI.Support ' + ` + '--add Microsoft.VisualStudio.Component.VC.CMake.Project ' + ` + '--add Microsoft.VisualStudio.Component.VC.DiagnosticTools ' + ` + '--add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ' + ` + '--add Microsoft.VisualStudio.Component.VC.MFC.ARM ' + ` + '--add Microsoft.VisualStudio.Component.VC.MFC.ARM.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ' + ` + '--add Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest ' + ` + '--add Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest ' + ` + '--add Microsoft.VisualStudio.Component.VC.v141 ' + ` + '--add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.16299 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.17134 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.18362 ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.Azure.CloudServices ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.Azure.ResourceManager.Tools ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.Web.CloudTools ' + ` + '--add Microsoft.VisualStudio.Workload.Azure ' + ` + '--add Microsoft.VisualStudio.Workload.Data ' + ` + '--add Microsoft.VisualStudio.Workload.DataScience ' + ` + '--add Microsoft.VisualStudio.Workload.ManagedDesktop ' + ` + '--add Microsoft.VisualStudio.Workload.ManagedGame ' + ` + '--add Microsoft.VisualStudio.Workload.NativeCrossPlat ' + ` + '--add Microsoft.VisualStudio.Workload.NativeDesktop ' + ` + '--add Microsoft.VisualStudio.Workload.NativeGame ' + ` + '--add Microsoft.VisualStudio.Workload.NativeMobile ' + ` + '--add Microsoft.VisualStudio.Workload.NetCoreTools ' + ` + '--add Microsoft.VisualStudio.Workload.NetCrossPlat ' + ` + '--add Microsoft.VisualStudio.Workload.NetWeb ' + ` + '--add Microsoft.VisualStudio.Workload.Node ' + ` + '--add Microsoft.VisualStudio.Workload.Office ' + ` + '--add Microsoft.VisualStudio.Workload.Python ' + ` + '--remove Component.CPython3.x64 ' + ` + '--add Microsoft.VisualStudio.Workload.Universal ' + ` + '--add Microsoft.VisualStudio.Workload.VisualStudioExtension' + + +$ReleaseInPath = 'Enterprise' +$Sku = 'Enterprise' +$VSBootstrapperURL = 'https://aka.ms/vs/16/release/vs_Enterprise.exe' + +$ErrorActionPreference = 'Stop' + +# Install VS +$exitCode = InstallVS -WorkLoads $WorkLoads -Sku $Sku -VSBootstrapperURL $VSBootstrapperURL + +# Find the version of VS installed for this instance +# Only supports a single instance +$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" +$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName + +if($instanceFolders -is [array]) +{ + Write-Host "More than one instance installed" + exit 1 +} + +$catalogContent = Get-Content -Path ($instanceFolders.FullName + '\catalog.json') +$catalog = $catalogContent | ConvertFrom-Json +$version = $catalog.info.id +Write-Host "Visual Studio version" $version "installed" + +# Initialize Visual Studio Experimental Instance +&"C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit + +# Updating content of MachineState.json file to disable autoupdate of VSIX extensions +$newContent = '{"Extensions":[{"Key":"1e906ff5-9da8-4091-a299-5c253c55fdc9","Value":{"ShouldAutoUpdate":false}},{"Key":"Microsoft.VisualStudio.Web.AzureFunctions","Value":{"ShouldAutoUpdate":false}}],"ShouldAutoUpdate":false,"ShouldCheckForUpdates":false}' +Set-Content -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath\Common7\IDE\Extensions\MachineState.json" -Value $newContent + + +# Adding description of the software to Markdown + +$SoftwareName = "Visual Studio 2019 Enterprise" + +$Description = @" +_Version:_ $version
+_Location:_ C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath + +The following workloads and components are installed with Visual Studio 2019: +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +# Adding explicitly added Workloads details to markdown by parsing $Workloads +Add-ContentToMarkdown -Content $($WorkLoads.Split('--') | % { if( ($_.Split(" "))[0] -like "add") { "* " +($_.Split(" "))[1] } } ) + + +exit $exitCode diff --git a/images/win/scripts/Installers/Windows2019/Install-WDK.ps1 b/images/win/scripts/Installers/Windows2019/Install-WDK.ps1 index b28d9c9ff..7b312d6e2 100644 --- a/images/win/scripts/Installers/Windows2019/Install-WDK.ps1 +++ b/images/win/scripts/Installers/Windows2019/Install-WDK.ps1 @@ -1,54 +1,53 @@ -################################################################################ -## File: Install-WDK.ps1 -## Team: CI-X -## Desc: Install the Windows Driver Kit -################################################################################ - -# Version: 10.0.17763.0 -# Update Validate-WDK.ps1 if the version changes! -# There doesn't seem to be any way to check the version programmatically - -# Requires Windows SDK with the same version number as the WDK -$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014" -$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156" - -# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI -$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet") - -if ($sdkExitCode -ne 0) -{ - Write-Host "Failed to install the Windows SDK." - exit $sdkExitCode -} - -# `wdksetup.exe /features + /quiet` installs all features without showing the GUI -$wdkExitCode = Install-EXE -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList ("/features", "+", "/quiet") - -if ($wdkExitCode -ne 0) -{ - Write-Host "Failed to install the Windows Driver Kit." - exit $wdkExitCode -} - -# Need to install the VSIX to get the build targets when running VSBuild -# Write-Host "Installing WDK.vsix" -<# ISSUE - VSIX installer failing on VS2019 - $process = Start-Process ` - -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VSIXInstaller.exe" ` - -ArgumentList ("/quiet", '"C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"') ` - -Wait ` - -PassThru - - $exitCode = $process.ExitCode - -if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed -{ - Write-Host "WDK.vsix installed successfully" -} -else -{ - Write-Host "Unsuccessful exit code returned by the installation process: $exitCode." -} - -exit $exitCode -#> +################################################################################ +## File: Install-WDK.ps1 +## Desc: Install the Windows Driver Kit +################################################################################ + +# Version: 10.0.17763.0 +# Update Validate-WDK.ps1 if the version changes! +# There doesn't seem to be any way to check the version programmatically + +# Requires Windows SDK with the same version number as the WDK +$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014" +$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156" + +# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI +$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet") + +if ($sdkExitCode -ne 0) +{ + Write-Host "Failed to install the Windows SDK." + exit $sdkExitCode +} + +# `wdksetup.exe /features + /quiet` installs all features without showing the GUI +$wdkExitCode = Install-EXE -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList ("/features", "+", "/quiet") + +if ($wdkExitCode -ne 0) +{ + Write-Host "Failed to install the Windows Driver Kit." + exit $wdkExitCode +} + +# Need to install the VSIX to get the build targets when running VSBuild +# Write-Host "Installing WDK.vsix" +<# ISSUE - VSIX installer failing on VS2019 + $process = Start-Process ` + -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VSIXInstaller.exe" ` + -ArgumentList ("/quiet", '"C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"') ` + -Wait ` + -PassThru + + $exitCode = $process.ExitCode + +if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed +{ + Write-Host "WDK.vsix installed successfully" +} +else +{ + Write-Host "Unsuccessful exit code returned by the installation process: $exitCode." +} + +exit $exitCode +#> diff --git a/images/win/scripts/Installers/Windows2019/Install-Wix.ps1 b/images/win/scripts/Installers/Windows2019/Install-Wix.ps1 index 860bbab40..8fc79bc49 100644 --- a/images/win/scripts/Installers/Windows2019/Install-Wix.ps1 +++ b/images/win/scripts/Installers/Windows2019/Install-Wix.ps1 @@ -1,54 +1,53 @@ -################################################################################ -## File: Install-Wix.ps1 -## Team: CI-Build -## Desc: Install WIX. -################################################################################ -function Install-VsixExtension -{ - Param - ( - [String]$Url, - [String]$Name - ) - - $ReleaseInPath = 'Enterprise' - $exitCode = -1 - - try - { - Write-Host "Downloading $Name..." - $FilePath = "${env:Temp}\$Name" - - Invoke-WebRequest -Uri $Url -OutFile $FilePath - - $ArgumentList = ('/quiet', $FilePath) - - Write-Host "Starting Install $Name..." - $process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath\Common7\IDE\VSIXInstaller.exe" -ArgumentList $ArgumentList -Wait -PassThru - $exitCode = $process.ExitCode - - if ($exitCode -eq 0 -or $exitCode -eq 3010) - { - Write-Host -Object 'Installation successful' - return $exitCode - } - else - { - Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." - return $exitCode - } - } - catch - { - Write-Host -Object "Failed to install the Extension $Name" - Write-Host -Object $_.Exception.Message - return -1 - } -} - - -choco install wixtoolset -y --force - -#Installing VS extension 'Wix Toolset Visual Studio 2019 Extension' -$exitCode = Install-VsixExtension -Url 'https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix' -Name 'Votive2019.vsix' -#return $exitCode +################################################################################ +## File: Install-Wix.ps1 +## Desc: Install WIX. +################################################################################ +function Install-VsixExtension +{ + Param + ( + [String]$Url, + [String]$Name + ) + + $ReleaseInPath = 'Enterprise' + $exitCode = -1 + + try + { + Write-Host "Downloading $Name..." + $FilePath = "${env:Temp}\$Name" + + Invoke-WebRequest -Uri $Url -OutFile $FilePath + + $ArgumentList = ('/quiet', $FilePath) + + Write-Host "Starting Install $Name..." + $process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath\Common7\IDE\VSIXInstaller.exe" -ArgumentList $ArgumentList -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + return $exitCode + } + } + catch + { + Write-Host -Object "Failed to install the Extension $Name" + Write-Host -Object $_.Exception.Message + return -1 + } +} + + +choco install wixtoolset -y --force + +#Installing VS extension 'Wix Toolset Visual Studio 2019 Extension' +$exitCode = Install-VsixExtension -Url 'https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix' -Name 'Votive2019.vsix' +#return $exitCode diff --git a/images/win/scripts/Installers/Windows2019/Run-Antivirus.ps1 b/images/win/scripts/Installers/Windows2019/Run-Antivirus.ps1 index 94c635898..e38126af0 100644 --- a/images/win/scripts/Installers/Windows2019/Run-Antivirus.ps1 +++ b/images/win/scripts/Installers/Windows2019/Run-Antivirus.ps1 @@ -1,28 +1,27 @@ -################################################################################ -## File: Run-Antivirus.ps1 -## Team: CI-Platform -## Desc: Run a full antivirus scan. -## Run right after cleanup before we sysprep -################################################################################ - -Write-Host "Make sure windefend is going to start" -Start-Service windefend -ErrorAction Continue - -Write-Host "Waiting for windefend to report as running" -$service = Get-Service "Windefend" -$service.WaitForStatus("Running","00:10:00") - -Write-Host "Run antivirus" -Push-Location "C:\Program Files\Windows Defender" - -# Tell Defender to use 100% of the CPU during the scan -Set-MpPreference -ScanAvgCPULoadFactor 100 - -# Full Scan -.\MpCmdRun.exe -Scan -ScanType 2 -Pop-Location - -Update-MpSignature -Write-Host "Set antivirus parmeters" -Set-MpPreference -ScanAvgCPULoadFactor 5 ` - -ExclusionPath "D:\", "C:\" \ No newline at end of file +################################################################################ +## File: Run-Antivirus.ps1 +## Desc: Run a full antivirus scan. +## Run right after cleanup before we sysprep +################################################################################ + +Write-Host "Make sure windefend is going to start" +Start-Service windefend -ErrorAction Continue + +Write-Host "Waiting for windefend to report as running" +$service = Get-Service "Windefend" +$service.WaitForStatus("Running","00:10:00") + +Write-Host "Run antivirus" +Push-Location "C:\Program Files\Windows Defender" + +# Tell Defender to use 100% of the CPU during the scan +Set-MpPreference -ScanAvgCPULoadFactor 100 + +# Full Scan +.\MpCmdRun.exe -Scan -ScanType 2 +Pop-Location + +Update-MpSignature +Write-Host "Set antivirus parmeters" +Set-MpPreference -ScanAvgCPULoadFactor 5 ` + -ExclusionPath "D:\", "C:\" diff --git a/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 b/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 index ba9693cd0..2e15f85e4 100644 --- a/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 +++ b/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 @@ -1,37 +1,36 @@ -################################################################################ -## File: Update-DockerImages.ps1 -## Team: ReleaseManagement -## Desc: Pull some standard docker images. -## Must be run after docker is installed. -################################################################################ - -function DockerPull { - Param ([string]$image) - - Write-Host Installing $image ... - docker pull $image - - if (!$?) { - echo "Docker pull failed with a non-zero exit code" - exit 1 - } -} - -DockerPull mcr.microsoft.com/windows/servercore:ltsc2019 -DockerPull mcr.microsoft.com/windows/nanoserver:1809 -DockerPull microsoft/aspnetcore-build:1.0-2.0 -DockerPull mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 -DockerPull mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019 - - -# Adding description of the software to Markdown - -$SoftwareName = "Docker images" - -$Description = @" -The following container images have been cached: -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -Add-ContentToMarkdown -Content $(docker images --digests --format "* {{.Repository}}:{{.Tag}} (Digest: {{.Digest}})") +################################################################################ +## File: Update-DockerImages.ps1 +## Desc: Pull some standard docker images. +## Must be run after docker is installed. +################################################################################ + +function DockerPull { + Param ([string]$image) + + Write-Host Installing $image ... + docker pull $image + + if (!$?) { + echo "Docker pull failed with a non-zero exit code" + exit 1 + } +} + +DockerPull mcr.microsoft.com/windows/servercore:ltsc2019 +DockerPull mcr.microsoft.com/windows/nanoserver:1809 +DockerPull microsoft/aspnetcore-build:1.0-2.0 +DockerPull mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 +DockerPull mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019 + + +# Adding description of the software to Markdown + +$SoftwareName = "Docker images" + +$Description = @" +The following container images have been cached: +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +Add-ContentToMarkdown -Content $(docker images --digests --format "* {{.Repository}}:{{.Tag}} (Digest: {{.Digest}})") diff --git a/images/win/scripts/Installers/Windows2019/Validate-WDK.ps1 b/images/win/scripts/Installers/Windows2019/Validate-WDK.ps1 index d98843f3e..f9edf1609 100644 --- a/images/win/scripts/Installers/Windows2019/Validate-WDK.ps1 +++ b/images/win/scripts/Installers/Windows2019/Validate-WDK.ps1 @@ -1,14 +1,13 @@ -################################################################################ -## File: Validate-WDK.ps1 -## Team: CI-X -## Desc: Validate the installation of the Windows Driver Kit -################################################################################ - -# Adding description of the software to Markdown -$SoftwareName = "Windows Driver Kit" - -$Description = @" -_Version:_ 10.0.17763.0
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file +################################################################################ +## File: Validate-WDK.ps1 +## Desc: Validate the installation of the Windows Driver Kit +################################################################################ + +# Adding description of the software to Markdown +$SoftwareName = "Windows Driver Kit" + +$Description = @" +_Version:_ 10.0.17763.0
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2019/Validate-Wix.ps1 b/images/win/scripts/Installers/Windows2019/Validate-Wix.ps1 index 70f957558..94724a3de 100644 --- a/images/win/scripts/Installers/Windows2019/Validate-Wix.ps1 +++ b/images/win/scripts/Installers/Windows2019/Validate-Wix.ps1 @@ -1,62 +1,61 @@ -################################################################################ -## File: Validate-Wix.ps1 -## Team: CI-Build -## Desc: Validate WIX. -################################################################################ - -Import-Module -Name ImageHelpers -Force -function Get-WixVersion { - $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" - $installedApplications = Get-ItemProperty -Path $regKey - $Version = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("wix") } | Select-Object -First 1).DisplayVersion - return $Version -} - -#Gets the extension details from state.json -function Get-WixExtensionPackage { - $vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" - $instanceFolders = Get-ChildItem -Path $vsProgramData.FullName - - if($instanceFolders -is [array]) - { - Write-Host "More than one instance installed" - exit 1 - } - - $stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json') - $state = $stateContent | ConvertFrom-Json - $WixPackage = $state.packages | where { $_.id -eq "WixToolset.VisualStudioExtension.Dev16" } - return $WixPackage -} - -$WixToolSetVersion = Get-WixVersion - -if($WixToolSetVersion) { - Write-Host "Wix Toolset version" $WixPackage.version "installed" -} -else { - Write-Host "Wix Toolset is not installed" - exit 1 -} - -$WixPackage = Get-WixExtensionPackage - -if($WixPackage) { - Write-Host "Wix Extension version" $WixPackage.version "installed" -} -else { - Write-Host "Wix Extension is not installed" - exit 1 -} - -# Adding description of the software to Markdown -$SoftwareName = "WIX Tools" - -$Description = @" -_Toolset Version:_ $WixToolSetVersion
-_WIX Toolset Visual Studio Extension Version:_ $($WixPackage.version)
-_Environment:_ -* WIX: Installation root of WIX -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +################################################################################ +## File: Validate-Wix.ps1 +## Desc: Validate WIX. +################################################################################ + +Import-Module -Name ImageHelpers -Force +function Get-WixVersion { + $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" + $installedApplications = Get-ItemProperty -Path $regKey + $Version = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("wix") } | Select-Object -First 1).DisplayVersion + return $Version +} + +#Gets the extension details from state.json +function Get-WixExtensionPackage { + $vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" + $instanceFolders = Get-ChildItem -Path $vsProgramData.FullName + + if($instanceFolders -is [array]) + { + Write-Host "More than one instance installed" + exit 1 + } + + $stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json') + $state = $stateContent | ConvertFrom-Json + $WixPackage = $state.packages | where { $_.id -eq "WixToolset.VisualStudioExtension.Dev16" } + return $WixPackage +} + +$WixToolSetVersion = Get-WixVersion + +if($WixToolSetVersion) { + Write-Host "Wix Toolset version" $WixPackage.version "installed" +} +else { + Write-Host "Wix Toolset is not installed" + exit 1 +} + +$WixPackage = Get-WixExtensionPackage + +if($WixPackage) { + Write-Host "Wix Extension version" $WixPackage.version "installed" +} +else { + Write-Host "Wix Extension is not installed" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "WIX Tools" + +$Description = @" +_Toolset Version:_ $WixToolSetVersion
+_WIX Toolset Visual Studio Extension Version:_ $($WixPackage.version)
+_Environment:_ +* WIX: Installation root of WIX +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description