From d0398f5357d95dcbd34761e324ba422958a959ac Mon Sep 17 00:00:00 2001 From: Nikita Bykov <49442273+nikita-bykov@users.noreply.github.com> Date: Mon, 13 Apr 2020 17:38:35 +0300 Subject: [PATCH 01/14] Add Alibaba cloud aliyun-cli (#688) * added aliyun cli to windows * added aliyun cli to Ubuntu Co-authored-by: Nikita Bykov --- images/linux/scripts/installers/aliyun-cli.sh | 27 +++++++++++++++++++ images/linux/ubuntu1604.json | 1 + images/linux/ubuntu1804.json | 1 + images/win/Windows2016-Azure.json | 12 +++++++++ images/win/Windows2019-Azure.json | 12 +++++++++ .../scripts/Installers/Install-AliyunCli.ps1 | 6 +++++ .../scripts/Installers/Validate-AliyunCli.ps1 | 24 +++++++++++++++++ 7 files changed, 83 insertions(+) create mode 100644 images/linux/scripts/installers/aliyun-cli.sh create mode 100644 images/win/scripts/Installers/Install-AliyunCli.ps1 create mode 100644 images/win/scripts/Installers/Validate-AliyunCli.ps1 diff --git a/images/linux/scripts/installers/aliyun-cli.sh b/images/linux/scripts/installers/aliyun-cli.sh new file mode 100644 index 000000000..e3e1ec14c --- /dev/null +++ b/images/linux/scripts/installers/aliyun-cli.sh @@ -0,0 +1,27 @@ +#!/bin/bash +################################################################################ +## File: aliyun-cli.sh +## Desc: Installs Alibaba Cloud CLI +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Alibaba Cloud CLI +URL=$(curl -s https://api.github.com/repos/aliyun/aliyun-cli/releases/latest | jq -r '.assets[].browser_download_url | select(contains("aliyun-cli-linux"))') +wget -P /tmp $URL +tar xzvf /tmp/aliyun-cli-linux-*-amd64.tgz +mv aliyun /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 aliyun ; then + echo "aliyun was not installed" + exit 1 +fi + +# Document what was added to the image +aliyun_version="$(aliyun --version | grep "Alibaba Cloud Command Line Interface Version" | cut -d " " -f 7)" +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Alibaba Cloud CLI ($aliyun_version)" \ No newline at end of file diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 4d4138d8c..bf47f0c4c 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -171,6 +171,7 @@ "{{template_dir}}/scripts/installers/azure-cli.sh", "{{template_dir}}/scripts/installers/azure-devops-cli.sh", "{{template_dir}}/scripts/installers/1604/basic.sh", + "{{template_dir}}/scripts/installers/aliyun-cli.sh", "{{template_dir}}/scripts/installers/aws.sh", "{{template_dir}}/scripts/installers/build-essential.sh", "{{template_dir}}/scripts/installers/nvm.sh", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 444077348..d2129a208 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -174,6 +174,7 @@ "{{template_dir}}/scripts/installers/azure-cli.sh", "{{template_dir}}/scripts/installers/azure-devops-cli.sh", "{{template_dir}}/scripts/installers/1804/basic.sh", + "{{template_dir}}/scripts/installers/aliyun-cli.sh", "{{template_dir}}/scripts/installers/aws.sh", "{{template_dir}}/scripts/installers/build-essential.sh", "{{template_dir}}/scripts/installers/clang.sh", diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 805892e62..97a06702f 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -299,6 +299,12 @@ "{{ template_dir }}/scripts/Installers/Install-Bazel.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AliyunCli.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -731,6 +737,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Bazel.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AliyunCli.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 69b42f8d7..e66147fca 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -578,6 +578,12 @@ "{{ template_dir }}/scripts/Installers/Install-Bazel.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AliyunCli.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -862,6 +868,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Bazel.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AliyunCli.ps1" + ] + }, { "type": "file", "source": "C:\\InstalledSoftware.md", diff --git a/images/win/scripts/Installers/Install-AliyunCli.ps1 b/images/win/scripts/Installers/Install-AliyunCli.ps1 new file mode 100644 index 000000000..95b462b61 --- /dev/null +++ b/images/win/scripts/Installers/Install-AliyunCli.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-AliyunCli.ps1 +## Desc: Install Alibaba Cloud CLI +################################################################################ + +choco install aliyun-cli -y \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-AliyunCli.ps1 b/images/win/scripts/Installers/Validate-AliyunCli.ps1 new file mode 100644 index 000000000..2f72deca8 --- /dev/null +++ b/images/win/scripts/Installers/Validate-AliyunCli.ps1 @@ -0,0 +1,24 @@ +################################################################################ +## File: Validate-AliyunCli.ps1 +## Desc: Validate Alibaba Cloud CLI +################################################################################ + +if (Get-Command -Name 'aliyun') +{ + Write-Host "Alibaba Cloud CLI on path" +} +else +{ + Write-Host 'Alibaba Cloud CLI is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$aliyun_version = ((aliyun --version | Select-String "Alibaba Cloud Command Line Interface Version ") -Split(" "))[6] + +$SoftwareName = "Alibaba Cloud CLI" +$Description = @" +_Version:_ $aliyun_version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file From 20515c42066478d2075ef79ed21dbeb7b00685b9 Mon Sep 17 00:00:00 2001 From: Image generation service account Date: Mon, 13 Apr 2020 16:09:45 +0000 Subject: [PATCH 02/14] Updating readme file for ubuntu16 version 20200406.2 --- images/linux/Ubuntu1604-README.md | 51 ++++++++++++++++++------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/images/linux/Ubuntu1604-README.md b/images/linux/Ubuntu1604-README.md index 708681f39..8b0400432 100644 --- a/images/linux/Ubuntu1604-README.md +++ b/images/linux/Ubuntu1604-README.md @@ -1,11 +1,11 @@ # Ubuntu 16.04.6 LTS -The following software is installed on machines with the 20200330.1 update. +The following software is installed on machines with the 20200406.2 update. *** - 7-Zip 9.20 - Ansible (ansible 2.9.6) - AzCopy (azcopy 7.3.0-netcore) -- Azure CLI (azure-cli 2.2.0) -- Azure CLI (azure-devops 0.17.0) +- Azure CLI (azure-cli 2.3.1) +- Azure CLI (azure-devops 0.18.0) - Basic CLI: - curl - dnsutils @@ -34,12 +34,13 @@ The following software is installed on machines with the 20200330.1 update. - wget - zip - zstd -- AWS CLI (aws-cli/1.18.31 Python/2.7.12 Linux/4.15.0-1071-azure botocore/1.15.31) +- AWS CLI (aws-cli/1.18.37 Python/2.7.12 Linux/4.15.0-1075-azure botocore/1.15.37) - build-essential +- nvm (0.35.3) - Clang 6.0 (6.0.0) - Clang 8 (8.0.0) - Clang 9 (9.0.1) -- Swift version 5.2 (swift-5.2-RELEASE) +- Swift version 5.2.1 (swift-5.2.1-RELEASE) Target: x86_64-unknown-linux-gnu - CMake (cmake version 3.16.2) - Docker Compose (docker-compose version 1.25.4, build 8d51620a) @@ -111,7 +112,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.301 - 2.1.300 - Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 10.7) -- Firefox (Mozilla Firefox 74.0) +- Firefox (Mozilla Firefox 74.0.1) - Geckodriver (0.26.0); Gecko Driver is available via GECKOWEBDRIVER environment variable - GNU C++ 7.4.0 - GNU C++ 8.3.0 @@ -121,9 +122,9 @@ Target: x86_64-unknown-linux-gnu - Git (2.26.0) - Git Large File Storage (LFS) (2.10.0) - Hub CLI (2.14.2) -- Google Chrome (Google Chrome 80.0.3987.149 ) +- Google Chrome (Google Chrome 80.0.3987.163 ) - ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}); Chrome Driver is available via CHROMEWEBDRIVER environment variable -- Google Cloud SDK (286.0.0) +- Google Cloud SDK (287.0.0) - Haskell Cabal (cabal-install version 2.0.0.1 compiled using version 2.0.1.1 of the Cabal library ) - Haskell Cabal (cabal-install version 2.2.0.0 @@ -132,6 +133,8 @@ compiled using version 2.2.0.1 of the Cabal library ) compiled using version 2.4.1.0 of the Cabal library ) - Haskell Cabal (cabal-install version 3.0.1.0 compiled using version 3.0.2.0 of the Cabal library ) +- Haskell Cabal (cabal-install version 3.2.0.0 +compiled using version 3.2.0.0 of the Cabal library ) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.0.2) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.2.2) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.4.4) @@ -142,9 +145,10 @@ compiled using version 3.0.2.0 of the Cabal library ) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.8.1) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.8.2) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.8.3) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.10.1) - Haskell Stack (Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2) -- Heroku (heroku/7.39.1 linux-x64 node-v12.13.0) -- HHVM (HipHop VM 4.50.0 (rel)) +- Heroku (heroku/7.39.2 linux-x64 node-v12.13.0) +- HHVM (HipHop VM 4.52.0 (rel)) - ImageMagick - Azul Zulu OpenJDK: - 7 (openjdk version "1.7.0_252") @@ -174,7 +178,7 @@ Local version: Unknown) - Webpack (4.42.1) - Webpack CLI (3.3.11) - Yarn (1.22.4) -- Bazel (bazel 2.2.0) +- Bazel (bazel 3.0.0) - Bazelisk (1.3.0) - PhantomJS (2.1.1) - PHP 5.6 (PHP 5.6.40-26+ubuntu16.04.1+deb.sury.org+1 (cli) ) @@ -197,9 +201,9 @@ Local version: Unknown) - clippy (0.0.212) - rustdoc (1.42.0) - bindgen (0.53.2) -- cbindgen (0.13.2) +- cbindgen (0.14.0) - Julia (julia version 1.4.0) -- sbt (1.3.8) +- sbt (1.3.9) - Selenium server standalone (available via SELENIUM_JAR_PATH environment variable) - Sphinx Open Source Search Server - Subversion (svn, version 1.9.3 (r1718519)) @@ -207,6 +211,9 @@ Local version: Unknown) - Packer (1.5.5) - Vcpkg 2020.02.04-unknownhash - Zeit Now CLI (17.1.1) +- MongoDB on Linux (2020-04-07T01:29:52.795+0000 I CONTROL [initandlisten] db version v4.2.5 +2020-04-07T01:29:52.795+0000 I CONTROL [initandlisten] git version: 2261279b51ea13df08ae708ff278f0679c59dc32 +2020-04-07T01:29:52.795+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016) - Go 1.11 (go version go1.11.13 linux/amd64) - Go 1.12 (go version go1.12.17 linux/amd64) - Go 1.13 (go version go1.13.9 linux/amd64) @@ -279,13 +286,13 @@ Local version: Unknown) - Az Module (3.1.0) - Az Module (3.5.0) - Cached container images + - node:10 (Digest: sha256:816cfaee24dc2cea534e21d7f9c55f3b22c8bc6af61d8445f8d0178168ef3b28) + - node:12 (Digest: sha256:46f4c17e1edbde36d60a9f6362db7912cfe301bac89afef7cc92421ab3e7ca18) + - buildpack-deps:stretch (Digest: sha256:a711a64b26285b42cd02618a191ec6c99650449f698858e0e2cc0535ab85e4dd) + - debian:9 (Digest: sha256:344470192d10cf7cf0bedcb183effbe99065829a8dbe68e65e703faf46fc10c1) + - debian:8 (Digest: sha256:a77aa078ad4769799286bba5fc198deda5bfd4d0144a24e6aa0c8dddf0a22833) - node:10-alpine (Digest: sha256:9a88e3bc3f845b74d2fd8adcbc64608736a8be4a3e9dc7aa34fa743e3677a552) - node:12-alpine (Digest: sha256:6b5b783c9cfe229af0bd5b0b677dd32005bb22d58465f3d0fe7fbd1c60ce068c) - - node:10 (Digest: sha256:df200903ff34c07c1b9112b4fd9d1342c11eb7d99525f2b366c487f91dda8131) - - node:12 (Digest: sha256:facc1cbde6e5aa3255092b1a1417451953c80bd31ab5a4403f8bcd90b90a8407) - - buildpack-deps:stretch (Digest: sha256:dc901bbf4b34e4ca8771c0d0773e557221452f97bcf0c732de7ecda3782bdf97) - - debian:9 (Digest: sha256:ddb131307ad9c70ebf8c7962ba73c20101f68c7a511915aea3ad3b7ad47b9d20) - - debian:8 (Digest: sha256:2c9b2323299846c5298c12db373da310f8114f2941ae3f496e95270cc8ca5ebd) - alpine:3.8 (Digest: sha256:2bb501e6173d9d006e56de5bce2720eb06396803300fe1687b58a7ff32bf4c14) - alpine:3.9 (Digest: sha256:115731bab0862031b44766733890091c17924f9b7781b79997f5f163be262178) - alpine:3.10 (Digest: sha256:7c3773f7bcc969f03f8f653910001d99a9d324b4b9caa008846ad2c3089f5a5f) @@ -299,10 +306,10 @@ Local version: Unknown) - Python 3.7.6 - Python 3.8.2 - Ruby: - - Ruby 2.4.9 - - Ruby 2.5.7 - - Ruby 2.6.5 - - Ruby 2.7.0 + - Ruby 2.4.10 + - Ruby 2.5.8 + - Ruby 2.6.6 + - Ruby 2.7.1 - PyPy: - PyPy 2.7.17 - PyPy 3.6.9 From 44e904205f61fdc8018a9a1f615f8e7c61187827 Mon Sep 17 00:00:00 2001 From: Luke Duddridge <338863+elduddz@users.noreply.github.com> Date: Tue, 14 Apr 2020 06:51:57 +0100 Subject: [PATCH 03/14] Chocolatey Helper (#646) * Add basic choco install wrapper * Use Install-Choco on mingw * move azure-cli install to defence * Rename ChocoInstall to ChocoHelpers --- .../win/scripts/ImageHelpers/ChocoHelpers.ps1 | 33 +++++++++++++++++++ .../scripts/ImageHelpers/ImageHelpers.psm1 | 2 ++ .../scripts/ImageHelpers/InstallHelpers.ps1 | 3 +- .../scripts/ImageHelpers/MarkdownHelpers.ps1 | 2 +- .../scripts/Installers/Install-AzureCli.ps1 | 2 +- .../win/scripts/Installers/Install-MinGW.ps1 | 2 +- 6 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 images/win/scripts/ImageHelpers/ChocoHelpers.ps1 diff --git a/images/win/scripts/ImageHelpers/ChocoHelpers.ps1 b/images/win/scripts/ImageHelpers/ChocoHelpers.ps1 new file mode 100644 index 000000000..f81ad0a1f --- /dev/null +++ b/images/win/scripts/ImageHelpers/ChocoHelpers.ps1 @@ -0,0 +1,33 @@ +function Install-Choco { + [CmdletBinding()] + param( + [Parameter(Mandatory)] + [string]$install, + [int]$retries = 5 + ) + + begin { } + process { + $condition = $false + $count = 0 + do { + Write-Output "running: powershell choco install $install -y" + powershell choco install $install -y + + $installed = powershell choco list -lo $install --all + $match = (($installed -match "^$install.*").Length -ne 0) + if ($match) { + Write-Output "package installed: $install" + $condition = $true + } + else { + $count++ + if ($count -eq $retries) { + Write-Error "Could not install $install after $count attempts" + exit 1 + } + } + } while ($condition -eq $false) + } + end { } +} \ No newline at end of file diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 index c40b10989..9e750b8db 100644 --- a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -4,6 +4,7 @@ param() . $PSScriptRoot\PathHelpers.ps1 . $PSScriptRoot\InstallHelpers.ps1 . $PSScriptRoot\MarkdownHelpers.ps1 +. $PSScriptRoot\ChocoHelpers.ps1 Export-ModuleMember -Function @( 'Test-MachinePath' @@ -26,4 +27,5 @@ Export-ModuleMember -Function @( 'Get-WinVersion' 'Test-IsWin19' 'Test-IsWin16' + 'Install-Choco' ) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index a016e5fd7..13f2fbf9d 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -3,7 +3,8 @@ function Install-MSI Param ( [String]$MsiUrl, - [String]$MsiName + [String]$MsiName, + [int]$retries = 5 ) $exitCode = -1 diff --git a/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 b/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 index da5d53e2c..49becbc9b 100644 --- a/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 @@ -1,5 +1,5 @@ function Add-ContentToMarkdown { - [CmdletBinding()] + param( $Content = "" ) diff --git a/images/win/scripts/Installers/Install-AzureCli.ps1 b/images/win/scripts/Installers/Install-AzureCli.ps1 index 4756bce3b..ca96558a5 100644 --- a/images/win/scripts/Installers/Install-AzureCli.ps1 +++ b/images/win/scripts/Installers/Install-AzureCli.ps1 @@ -3,7 +3,7 @@ ## Desc: Install Azure CLI ################################################################################ -choco install azure-cli -y +Install-Choco "azure-cli" $AzureCliExtensionPath = Join-Path $Env:CommonProgramFiles 'AzureCliExtensionDirectory' New-Item -ItemType "directory" -Path $AzureCliExtensionPath diff --git a/images/win/scripts/Installers/Install-MinGW.ps1 b/images/win/scripts/Installers/Install-MinGW.ps1 index fe97ddde7..c2aa0f52c 100644 --- a/images/win/scripts/Installers/Install-MinGW.ps1 +++ b/images/win/scripts/Installers/Install-MinGW.ps1 @@ -5,7 +5,7 @@ Import-Module -Name ImageHelpers -Force -choco install -y mingw +Install-Choco "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 From bb9538cc9b547051c01ff5a20439b9660ffcb6e7 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 14 Apr 2020 13:23:44 +0500 Subject: [PATCH 04/14] Migrate /etc/environment modifications to helpers (#660) * migrate rust * Migrate PHP composer * Migrate dotnet core sdk * rename `var_*` to `variable_*` * rename *etcEnvironmentVar functions to *etcEnvironmentVariable * add AppendEtcEnvironmentVariable and PrependEtcEnvironmentVariable * rename addEtcEnvironmentPathElement to prependEtcEnvironmentPath * Remove updatepath.sh Co-authored-by: Sergey Dolin --- .../linux/scripts/helpers/etc-environment.sh | 61 ++++++++++++------- images/linux/scripts/installers/1604/php.sh | 5 ++ images/linux/scripts/installers/1804/php.sh | 4 ++ .../scripts/installers/dotnetcore-sdk.sh | 4 +- images/linux/scripts/installers/homebrew.sh | 2 +- images/linux/scripts/installers/rust.sh | 6 +- images/linux/scripts/installers/updatepath.sh | 7 --- images/linux/ubuntu1604.json | 1 - images/linux/ubuntu1804.json | 1 - 9 files changed, 55 insertions(+), 36 deletions(-) delete mode 100644 images/linux/scripts/installers/updatepath.sh diff --git a/images/linux/scripts/helpers/etc-environment.sh b/images/linux/scripts/helpers/etc-environment.sh index bedc7119d..f0a68cf40 100644 --- a/images/linux/scripts/helpers/etc-environment.sh +++ b/images/linux/scripts/helpers/etc-environment.sh @@ -8,42 +8,57 @@ # values containg slashes (i.e. directory path) # The values containing '%' will break the functions -function getEtcEnvironmentVar { - var_name="$1" - # remove `var_name=` and possible quotes from the line - grep "^${var_name}=" /etc/environment |sed -E "s%^${var_name}=\"?([^\"]+)\"?.*$%\1%" +function getEtcEnvironmentVariable { + variable_name="$1" + # remove `variable_name=` and possible quotes from the line + grep "^${variable_name}=" /etc/environment |sed -E "s%^${variable_name}=\"?([^\"]+)\"?.*$%\1%" } -function addEtcEnvironmentVar { - var_name="$1" - var_value="$2" +function addEtcEnvironmentVariable { + variable_name="$1" + variable_value="$2" - echo "$var_name=\"$var_value\"" | sudo tee -a /etc/environment + echo "$variable_name=\"$variable_value\"" | sudo tee -a /etc/environment } -function replaceEtcEnvironmentVar { - var_name="$1" - var_value="$2" +function replaceEtcEnvironmentVariable { + variable_name="$1" + variable_value="$2" - # modify /etc/environemnt in place by replacing a string that begins with var_name - sudo sed -ie "s%^${var_name}=.*$%${var_name}=\"${var_value}\"%" /etc/environment + # modify /etc/environemnt in place by replacing a string that begins with variable_name + sudo sed -ie "s%^${variable_name}=.*$%${variable_name}=\"${variable_value}\"%" /etc/environment } -function setEtcEnvironmentVar { - var_name="$1" - var_value="$2" +function setEtcEnvironmentVariable { + variable_name="$1" + variable_value="$2" - if grep "$var_name" /etc/environment > /dev/null; then - replaceEtcEnvironmentVar $var_name $var_value + if grep "$variable_name" /etc/environment > /dev/null; then + replaceEtcEnvironmentVariable $variable_name $variable_value else - addEtcEnvironmentVar $var_name $var_value + addEtcEnvironmentVariable $variable_name $variable_value fi } -function addEtcEnvironmentPathElement { +function prependEtcEnvironmentVariable { + variable_name="$1" + element="$2" + # TODO: handle the case if the variable does not exist + existing_value=$(getEtcEnvironmentVariable "${variable_name}") + setEtcEnvironmentVariable "${variable_name}" "${element}:${existing_value}" +} + +function appendEtcEnvironmentVariable { + variable_name="$1" + element="$2" + # TODO: handle the case if the variable does not exist + existing_value=$(getEtcEnvironmentVariable "${variable_name}") + setEtcEnvironmentVariable "${variable_name}" "${existing_value}:${element}" +} + +function prependEtcEnvironmentPath { element="$1" - etc_path=$(getEtcEnvironmentVar PATH) - setEtcEnvironmentVar PATH "${element}:${etc_path}" + prependEtcEnvironmentVariable PATH "${element}" } # Process /etc/environment as if it were shell script with `export VAR=...` expressions @@ -59,7 +74,7 @@ function reloadEtcEnvironment { # add `export ` to every variable of /etc/environemnt except PATH and eval the result shell script eval $(grep -v '^PATH=' /etc/environment | sed -e 's%^%export %') # handle PATH specially - etc_path=$(getEtcEnvironmentVar PATH) + etc_path=$(getEtcEnvironmentVariable PATH) export PATH="$PATH:$etc_path" } diff --git a/images/linux/scripts/installers/1604/php.sh b/images/linux/scripts/installers/1604/php.sh index 147cedd6b..44f2ad3b7 100644 --- a/images/linux/scripts/installers/1604/php.sh +++ b/images/linux/scripts/installers/1604/php.sh @@ -5,6 +5,7 @@ ################################################################################ # Source the helpers for use with the script +source $HELPER_SCRIPTS/etc-environment.sh source $HELPER_SCRIPTS/document.sh LSB_RELEASE=$(lsb_release -rs) @@ -276,6 +277,9 @@ php composer-setup.php sudo mv composer.phar /usr/bin/composer php -r "unlink('composer-setup.php');" +# Update /etc/environment +prependEtcEnvironmentPath /home/runner/.config/composer/vendor/bin + # Add composer bin folder to path echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /etc/skel/.bashrc @@ -293,6 +297,7 @@ for cmd in php php5.6 php7.0 php7.1 php7.2 php7.3 php7.4 composer phpunit; do 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))" diff --git a/images/linux/scripts/installers/1804/php.sh b/images/linux/scripts/installers/1804/php.sh index 09d5cd96b..8ab10d785 100644 --- a/images/linux/scripts/installers/1804/php.sh +++ b/images/linux/scripts/installers/1804/php.sh @@ -5,6 +5,7 @@ ################################################################################ # Source the helpers for use with the script +source $HELPER_SCRIPTS/etc-environment.sh source $HELPER_SCRIPTS/document.sh LSB_RELEASE=$(lsb_release -rs) @@ -193,6 +194,9 @@ php composer-setup.php sudo mv composer.phar /usr/bin/composer php -r "unlink('composer-setup.php');" +# Update /etc/environment +prependEtcEnvironmentPath /home/runner/.config/composer/vendor/bin + # Add composer bin folder to path echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /etc/skel/.bashrc diff --git a/images/linux/scripts/installers/dotnetcore-sdk.sh b/images/linux/scripts/installers/dotnetcore-sdk.sh index d0e138103..70d712e28 100644 --- a/images/linux/scripts/installers/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/dotnetcore-sdk.sh @@ -3,6 +3,7 @@ ## File: dotnetcore-sdk.sh ## Desc: Installs .NET Core SDK ################################################################################ +source $HELPER_SCRIPTS/etc-environment.sh source $HELPER_SCRIPTS/apt.sh source $HELPER_SCRIPTS/document.sh @@ -95,5 +96,6 @@ done # NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test # Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine -echo "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" | tee -a /etc/environment +setEtcEnvironmentVariable DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1 +prependEtcEnvironmentPath /home/runner/.dotnet/tools echo 'export PATH="$PATH:$HOME/.dotnet/tools"' | tee -a /etc/skel/.bashrc diff --git a/images/linux/scripts/installers/homebrew.sh b/images/linux/scripts/installers/homebrew.sh index 58c8a11de..17622f5cb 100644 --- a/images/linux/scripts/installers/homebrew.sh +++ b/images/linux/scripts/installers/homebrew.sh @@ -20,7 +20,7 @@ sudo chmod -R o+w $HOMEBREW_PREFIX brew shellenv|grep 'export HOMEBREW'|sed -E 's/^export (.*);$/\1/' | sudo tee -a /etc/environment # add brew executables locations to PATH brew_path=$(brew shellenv|grep '^export PATH' |sed -E 's/^export PATH="([^$]+)\$.*/\1/') -addEtcEnvironmentPathElement "$brew_path" +prependEtcEnvironmentPath "$brew_path" # Validate the installation ad hoc echo "Validate the installation reloading /etc/environment" diff --git a/images/linux/scripts/installers/rust.sh b/images/linux/scripts/installers/rust.sh index 850868a4d..c3f0ae949 100644 --- a/images/linux/scripts/installers/rust.sh +++ b/images/linux/scripts/installers/rust.sh @@ -5,10 +5,9 @@ ################################################################################ # Source the helpers for use with the script +source $HELPER_SCRIPTS/etc-environment.sh source $HELPER_SCRIPTS/document.sh -set -e - export RUSTUP_HOME=/usr/share/rust/.rustup export CARGO_HOME=/usr/share/rust/.cargo @@ -33,6 +32,9 @@ for cmd in rustup rustc rustdoc cargo rustfmt cargo-clippy bindgen cbindgen; do fi done +# Update /etc/environemnt +prependEtcEnvironmentPath "${CARGO_HOME}/bin" + # Rust Symlinks are added to a default profile /etc/skel pushd /etc/skel ln -sf $RUSTUP_HOME .rustup diff --git a/images/linux/scripts/installers/updatepath.sh b/images/linux/scripts/installers/updatepath.sh deleted file mode 100644 index 527ba5240..000000000 --- a/images/linux/scripts/installers/updatepath.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -CARGO_HOME=/usr/share/rust/.cargo -DOTNET_TOOLS_HOME=/home/runner/.dotnet/tools -PHP_COMPOSER_HOME=/home/runner/.config/composer/vendor/bin -BREW_PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin -echo "PATH=${BREW_PATH}:${CARGO_HOME}/bin:${PATH}:${DOTNET_TOOLS_HOME}:${PHP_COMPOSER_HOME}" | tee -a /etc/environment diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index bf47f0c4c..c38547674 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -218,7 +218,6 @@ "{{template_dir}}/scripts/installers/packer.sh", "{{template_dir}}/scripts/installers/vcpkg.sh", "{{template_dir}}/scripts/installers/zeit-now.sh", - "{{template_dir}}/scripts/installers/updatepath.sh", "{{template_dir}}/scripts/installers/dpkg-config.sh", "{{template_dir}}/scripts/installers/mongodb.sh", "{{template_dir}}/scripts/installers/rndgenerator.sh" diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index d2129a208..1c4e704b5 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -222,7 +222,6 @@ "{{template_dir}}/scripts/installers/packer.sh", "{{template_dir}}/scripts/installers/vcpkg.sh", "{{template_dir}}/scripts/installers/zeit-now.sh", - "{{template_dir}}/scripts/installers/updatepath.sh", "{{template_dir}}/scripts/installers/dpkg-config.sh", "{{template_dir}}/scripts/installers/mongodb.sh", "{{template_dir}}/scripts/installers/rndgenerator.sh" From 83d31983bac21256e99f64eed3d9cc93577fb160 Mon Sep 17 00:00:00 2001 From: Andy Mishechkin <57713077+andy-mishechkin@users.noreply.github.com> Date: Tue, 14 Apr 2020 16:10:21 +0400 Subject: [PATCH 05/14] Ubuntu 14.04 Docker container has been added (#714) --- images/linux/scripts/installers/docker-moby.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/images/linux/scripts/installers/docker-moby.sh b/images/linux/scripts/installers/docker-moby.sh index b9d43b546..1f371a8cb 100644 --- a/images/linux/scripts/installers/docker-moby.sh +++ b/images/linux/scripts/installers/docker-moby.sh @@ -44,6 +44,7 @@ docker pull alpine:3.7 docker pull alpine:3.8 docker pull alpine:3.9 docker pull alpine:3.10 +docker pull ubuntu:14.04 ## Add version information to the metadata file echo "Documenting Docker version" From 8abd45c3a8c2f777498e0df36853faf163558b15 Mon Sep 17 00:00:00 2001 From: Nikita Bykov <49442273+nikita-bykov@users.noreply.github.com> Date: Tue, 14 Apr 2020 15:13:37 +0300 Subject: [PATCH 06/14] Pre-install Android NDK 20 on Ubuntu (#711) * added ndk 20 Co-authored-by: Nikita Bykov --- images/linux/scripts/installers/1604/android.sh | 2 ++ images/linux/scripts/installers/1804/android.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/images/linux/scripts/installers/1604/android.sh b/images/linux/scripts/installers/1604/android.sh index 8dd2d6fa4..beb5cdc73 100644 --- a/images/linux/scripts/installers/1604/android.sh +++ b/images/linux/scripts/installers/1604/android.sh @@ -41,6 +41,7 @@ fi # Install the following SDKs and build tools, passing in "y" to accept licenses. echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \ "ndk-bundle" \ + "ndk;20.0.5594570" \ "platform-tools" \ "platforms;android-29" \ "platforms;android-28" \ @@ -160,5 +161,6 @@ 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)" +DocumentInstalledItem "Android NDK 20.0.5594570" DocumentInstalledItem "Android ConstraintLayout 1.0.2" DocumentInstalledItem "Android ConstraintLayout 1.0.1" diff --git a/images/linux/scripts/installers/1804/android.sh b/images/linux/scripts/installers/1804/android.sh index 0bb58fb8e..60d216434 100644 --- a/images/linux/scripts/installers/1804/android.sh +++ b/images/linux/scripts/installers/1804/android.sh @@ -40,6 +40,7 @@ fi # Install the following SDKs and build tools, passing in "y" to accept licenses. echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager \ "ndk-bundle" \ + "ndk;20.0.5594570" \ "platform-tools" \ "platforms;android-29" \ "platforms;android-28" \ @@ -149,3 +150,4 @@ 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)" +DocumentInstalledItem "Android NDK 20.0.5594570" From bd3709460b286ffade35dd83b2be9a76d5e99d4c Mon Sep 17 00:00:00 2001 From: Alejandro Pauly Date: Tue, 14 Apr 2020 16:13:30 -0400 Subject: [PATCH 07/14] Fix Git installer to download directly from release (#718) * Install Git for Windows directly from official release rather than Chocolatey. --- images/win/scripts/Installers/Install-Git.ps1 | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index 24efc5bd0..0466fcd1c 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -5,9 +5,33 @@ 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" +function getSimpleValue([string] $url, [string] $filename ) { + $fullpath = "${env:Temp}\$filename" + Invoke-WebRequest -Uri $url -OutFile $fullpath + $value = Get-Content $fullpath -Raw + + return $value +} + +# Install the latest version of Git for Windows +$gitTag = getSimpleValue -url "https://gitforwindows.org/latest-tag.txt" -filename "gitlatesttag.txt" +$gitVersion = getSimpleValue -url "https://gitforwindows.org/latest-version.txt" -filename "gitlatestversion.txt"; + +$installerFile = "Git-$gitVersion-64-bit.exe"; +$downloadUrl = "https://github.com/git-for-windows/git/releases/download/$gitTag/$installerFile"; +Install-Exe -Url $downloadUrl ` + -Name $installerFile ` + -ArgumentList ( + "/VERYSILENT", ` + "/NORESTART", ` + "/NOCANCEL", ` + "/SP-", ` + "/CLOSEAPPLICATIONS", ` + "/RESTARTAPPLICATIONS", ` + "/o:PathOption=CmdTools", ` + "/o:BashTerminalOption=ConHost", ` + "/COMPONENTS=gitlfs") + choco install hub # Disable GCM machine-wide From cf559641b40626dd0c19b267b49e44ea54ec2275 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Wed, 15 Apr 2020 10:24:45 +0300 Subject: [PATCH 08/14] fix Julia destination folder --- images/win/scripts/Installers/Install-Julia.ps1 | 2 +- images/win/scripts/Installers/Validate-Julia.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-Julia.ps1 b/images/win/scripts/Installers/Install-Julia.ps1 index 90547472b..f1f421168 100644 --- a/images/win/scripts/Installers/Install-Julia.ps1 +++ b/images/win/scripts/Installers/Install-Julia.ps1 @@ -3,4 +3,4 @@ ## Desc: Install Julia ################################################################################ -choco install julia -y --ia "/D=C:\Julia" +choco install julia -y --ia "/DIR=C:\Julia" diff --git a/images/win/scripts/Installers/Validate-Julia.ps1 b/images/win/scripts/Installers/Validate-Julia.ps1 index e31bd39f6..41f9310ae 100644 --- a/images/win/scripts/Installers/Validate-Julia.ps1 +++ b/images/win/scripts/Installers/Validate-Julia.ps1 @@ -4,7 +4,7 @@ ################################################################################ # Verify that julia.exe is on the path -if(Get-Command -Name 'julia') +if((Get-Command -Name 'julia') -and (Test-Path -Path 'C:\Julia')) { Write-Host "$(julia --version) is on the path." } From 66376977a001c9847b64a2c206e17f43a3448f75 Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev Date: Wed, 15 Apr 2020 14:05:30 +0300 Subject: [PATCH 09/14] add particular commit for vcpkg --- images/linux/scripts/installers/vcpkg.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/vcpkg.sh b/images/linux/scripts/installers/vcpkg.sh index 9f6e60aa7..9a99a8862 100644 --- a/images/linux/scripts/installers/vcpkg.sh +++ b/images/linux/scripts/installers/vcpkg.sh @@ -12,7 +12,10 @@ 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 +git clone https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT +# Workaround to avoid issues caused by this PR https://github.com/microsoft/vcpkg/pull/10834 +git checkout 1e19af09e53e5f306ed89c2033817a21e5ee0bcf + $VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh $VCPKG_INSTALLATION_ROOT/vcpkg integrate install chmod 0777 -R $VCPKG_INSTALLATION_ROOT From 5048c104df87bf91318288afeb945c5ee0d737d5 Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev Date: Wed, 15 Apr 2020 17:34:44 +0300 Subject: [PATCH 10/14] add cd --- images/linux/scripts/installers/vcpkg.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/images/linux/scripts/installers/vcpkg.sh b/images/linux/scripts/installers/vcpkg.sh index 9a99a8862..d9672348e 100644 --- a/images/linux/scripts/installers/vcpkg.sh +++ b/images/linux/scripts/installers/vcpkg.sh @@ -14,6 +14,7 @@ echo "VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a /etc/environm # Install vcpkg git clone https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT # Workaround to avoid issues caused by this PR https://github.com/microsoft/vcpkg/pull/10834 +cd $VCPKG_INSTALLATION_ROOT git checkout 1e19af09e53e5f306ed89c2033817a21e5ee0bcf $VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh From d4435d6a1172d2e19f096e53d4d012643bc95261 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Thu, 16 Apr 2020 16:34:59 +0500 Subject: [PATCH 11/14] Add AWS SAM CLI (#615) Added in its own block because must be run as non-root user Co-authored-by: Sergey Dolin --- .../linux/scripts/installers/aws-sam-cli.sh | 24 +++++++++++++++++++ images/linux/ubuntu1604.json | 12 ++++++++++ images/linux/ubuntu1804.json | 12 ++++++++++ 3 files changed, 48 insertions(+) create mode 100644 images/linux/scripts/installers/aws-sam-cli.sh diff --git a/images/linux/scripts/installers/aws-sam-cli.sh b/images/linux/scripts/installers/aws-sam-cli.sh new file mode 100644 index 000000000..3cee60156 --- /dev/null +++ b/images/linux/scripts/installers/aws-sam-cli.sh @@ -0,0 +1,24 @@ +#!/bin/bash +################################################################################ +## File: aws-sam-cli.sh +## Desc: Installs AWS SAM CLI +## Must be run as non-root user after homebrew and clang +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install aws sam cli +brew tap aws/tap +brew install aws-sam-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 ! sam --version; then + echo "AWS SAM CLI was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "AWS $(sam --version)" \ No newline at end of file diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index c38547674..38f6a20e5 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -229,6 +229,18 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/aws-sam-cli.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts": [ diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 1c4e704b5..dccbbe964 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -233,6 +233,18 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/aws-sam-cli.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts": [ From edce722a68601539a77135215c2b1142e8951d20 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:53:30 +0300 Subject: [PATCH 12/14] Improve choco stability by adding retry logic on Windows images (#721) Add retry logic for choco install to avoid random failures --- images/win/Windows2016-Azure.json | 4 --- .../win/scripts/ImageHelpers/ChocoHelpers.ps1 | 35 +++++++++---------- .../scripts/ImageHelpers/ImageHelpers.psm1 | 2 +- .../win/scripts/Installers/Install-7zip.ps1 | 2 +- images/win/scripts/Installers/Install-AWS.ps1 | 2 +- .../scripts/Installers/Install-AliyunCli.ps1 | 2 +- .../scripts/Installers/Install-AzureCli.ps1 | 2 +- .../win/scripts/Installers/Install-Bazel.ps1 | 2 +- .../win/scripts/Installers/Install-Cmake.ps1 | 2 +- .../win/scripts/Installers/Install-Docker.ps1 | 6 ++-- .../win/scripts/Installers/Install-Edge.ps1 | 2 +- images/win/scripts/Installers/Install-Git.ps1 | 2 +- .../scripts/Installers/Install-GitVersion.ps1 | 2 +- .../scripts/Installers/Install-InnoSetup.ps1 | 2 +- .../scripts/Installers/Install-JavaTools.ps1 | 6 ++-- images/win/scripts/Installers/Install-Jq.ps1 | 2 +- .../win/scripts/Installers/Install-Julia.ps1 | 2 +- .../Installers/Install-KubernetesCli.ps1 | 2 +- .../scripts/Installers/Install-Mercurial.ps1 | 2 +- .../win/scripts/Installers/Install-MinGW.ps1 | 2 +- .../win/scripts/Installers/Install-NSIS.ps1 | 2 +- .../scripts/Installers/Install-NodeLts.ps1 | 2 +- .../scripts/Installers/Install-OpenSSL.ps1 | 2 +- images/win/scripts/Installers/Install-PHP.ps1 | 4 +-- .../win/scripts/Installers/Install-Packer.ps1 | 2 +- .../win/scripts/Installers/Install-Perl.ps1 | 2 +- images/win/scripts/Installers/Install-Sbt.ps1 | 2 +- images/win/scripts/Installers/Install-Svn.ps1 | 2 +- .../scripts/Installers/Install-VSWhere.ps1 | 2 +- images/win/scripts/Installers/Install-Wix.ps1 | 4 +-- .../win/scripts/Installers/Install-Zstd.ps1 | 2 +- .../Installers/Windows2016/Initialize-VM.ps1 | 5 ++- .../Installers/Windows2019/Initialize-VM.ps1 | 2 +- 33 files changed, 57 insertions(+), 59 deletions(-) diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 97a06702f..8732a9fb1 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -175,10 +175,6 @@ "{{ template_dir }}/scripts/Installers/Windows2016/Update-DockerImages.ps1" ] }, - { - "type": "powershell", - "inline": ["choco install vcredist140 -y"] - }, { "type": "powershell", "valid_exit_codes": [ diff --git a/images/win/scripts/ImageHelpers/ChocoHelpers.ps1 b/images/win/scripts/ImageHelpers/ChocoHelpers.ps1 index f81ad0a1f..ee1f39128 100644 --- a/images/win/scripts/ImageHelpers/ChocoHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/ChocoHelpers.ps1 @@ -1,33 +1,32 @@ -function Install-Choco { +function Choco-Install { [CmdletBinding()] param( [Parameter(Mandatory)] - [string]$install, - [int]$retries = 5 + [string] $PackageName, + [string[]] $ArgumentList, + [int] $RetryCount = 5 ) - begin { } process { - $condition = $false - $count = 0 - do { - Write-Output "running: powershell choco install $install -y" - powershell choco install $install -y + $count = 1 + while($true) + { + Write-Host "Running [#$count]: choco install $packageName -y $argumentList" + choco install $packageName -y @argumentList - $installed = powershell choco list -lo $install --all - $match = (($installed -match "^$install.*").Length -ne 0) - if ($match) { - Write-Output "package installed: $install" - $condition = $true + $pkg = choco list --localonly $packageName --exact --all --limitoutput + if ($pkg) { + Write-Host "Package installed: $pkg" + break } else { $count++ - if ($count -eq $retries) { - Write-Error "Could not install $install after $count attempts" + if ($count -ge $retryCount) { + Write-Host "Could not install $packageName after $count attempts" exit 1 } + Start-Sleep -Seconds 30 } - } while ($condition -eq $false) + } } - end { } } \ No newline at end of file diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 index 9e750b8db..b34539265 100644 --- a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -27,5 +27,5 @@ Export-ModuleMember -Function @( 'Get-WinVersion' 'Test-IsWin19' 'Test-IsWin16' - 'Install-Choco' + 'Choco-Install' ) diff --git a/images/win/scripts/Installers/Install-7zip.ps1 b/images/win/scripts/Installers/Install-7zip.ps1 index 4e86ad3c6..419c81782 100644 --- a/images/win/scripts/Installers/Install-7zip.ps1 +++ b/images/win/scripts/Installers/Install-7zip.ps1 @@ -3,4 +3,4 @@ ## Desc: Install 7zip ################################################################################ -choco install 7zip.install -y +Choco-Install -PackageName 7zip.install diff --git a/images/win/scripts/Installers/Install-AWS.ps1 b/images/win/scripts/Installers/Install-AWS.ps1 index 124f32d20..b5ad9a6d2 100644 --- a/images/win/scripts/Installers/Install-AWS.ps1 +++ b/images/win/scripts/Installers/Install-AWS.ps1 @@ -3,7 +3,7 @@ ## Desc: Install awscli ################################################################################ -choco install awscli -y +Choco-Install -PackageName awscli $env:PATH =$env:PATH + ";$Env:Programfiles\Amazon\AWSCLIV2" diff --git a/images/win/scripts/Installers/Install-AliyunCli.ps1 b/images/win/scripts/Installers/Install-AliyunCli.ps1 index 95b462b61..b46eb8a60 100644 --- a/images/win/scripts/Installers/Install-AliyunCli.ps1 +++ b/images/win/scripts/Installers/Install-AliyunCli.ps1 @@ -3,4 +3,4 @@ ## Desc: Install Alibaba Cloud CLI ################################################################################ -choco install aliyun-cli -y \ No newline at end of file +Choco-Install -PackageName aliyun-cli \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-AzureCli.ps1 b/images/win/scripts/Installers/Install-AzureCli.ps1 index ca96558a5..4b5d7dae1 100644 --- a/images/win/scripts/Installers/Install-AzureCli.ps1 +++ b/images/win/scripts/Installers/Install-AzureCli.ps1 @@ -3,7 +3,7 @@ ## Desc: Install Azure CLI ################################################################################ -Install-Choco "azure-cli" +Choco-Install -PackageName azure-cli $AzureCliExtensionPath = Join-Path $Env:CommonProgramFiles 'AzureCliExtensionDirectory' New-Item -ItemType "directory" -Path $AzureCliExtensionPath diff --git a/images/win/scripts/Installers/Install-Bazel.ps1 b/images/win/scripts/Installers/Install-Bazel.ps1 index fb14a856b..fabbecd01 100644 --- a/images/win/scripts/Installers/Install-Bazel.ps1 +++ b/images/win/scripts/Installers/Install-Bazel.ps1 @@ -3,6 +3,6 @@ ## Desc: Install Bazel and Bazelisk (A user-friendly launcher for Bazel) ################################################################################ -choco install bazel -y +Choco-Install -PackageName bazel npm install -g @bazel/bazelisk \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Cmake.ps1 b/images/win/scripts/Installers/Install-Cmake.ps1 index b0ba514ee..37183d5e6 100644 --- a/images/win/scripts/Installers/Install-Cmake.ps1 +++ b/images/win/scripts/Installers/Install-Cmake.ps1 @@ -3,4 +3,4 @@ ## Desc: Install Cmake ################################################################################ -choco install cmake.install -y --installargs 'ADD_CMAKE_TO_PATH=""System""' +Choco-Install -PackageName cmake.install -ArgumentList "--installargs",'ADD_CMAKE_TO_PATH=""System""' diff --git a/images/win/scripts/Installers/Install-Docker.ps1 b/images/win/scripts/Installers/Install-Docker.ps1 index ec4f0d895..35e988ada 100644 --- a/images/win/scripts/Installers/Install-Docker.ps1 +++ b/images/win/scripts/Installers/Install-Docker.ps1 @@ -13,8 +13,8 @@ Write-Host "Install-Package Docker" Install-Package -Name docker -ProviderName DockerMsftProvider -Force Start-Service docker -choco install docker-compose -y +Write-Host "Install-Package Docker-Compose" +Choco-Install -PackageName docker-compose -# Install helm Write-Host "Install Helm" -choco install kubernetes-helm \ No newline at end of file +Choco-Install -PackageName kubernetes-helm \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-Edge.ps1 b/images/win/scripts/Installers/Install-Edge.ps1 index b84f0fc14..430e8bbb9 100644 --- a/images/win/scripts/Installers/Install-Edge.ps1 +++ b/images/win/scripts/Installers/Install-Edge.ps1 @@ -3,7 +3,7 @@ ## Desc: Install latest stable version of Microsoft Edge browser ################################################################################ -choco install microsoft-edge -y +Choco-Install -PackageName microsoft-edge # Install Microsoft Edge Web Driver Write-Host "Install Edge WebDriver" diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index 0466fcd1c..5270675af 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -32,7 +32,7 @@ Install-Exe -Url $downloadUrl ` "/o:BashTerminalOption=ConHost", ` "/COMPONENTS=gitlfs") -choco install hub +Choco-Install -PackageName hub # Disable GCM machine-wide [Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine) diff --git a/images/win/scripts/Installers/Install-GitVersion.ps1 b/images/win/scripts/Installers/Install-GitVersion.ps1 index b97358e0c..1e27e49f9 100644 --- a/images/win/scripts/Installers/Install-GitVersion.ps1 +++ b/images/win/scripts/Installers/Install-GitVersion.ps1 @@ -3,4 +3,4 @@ ## Desc: Install GitVersion ################################################################################ -choco install gitversion.portable -y +Choco-Install -PackageName gitversion.portable diff --git a/images/win/scripts/Installers/Install-InnoSetup.ps1 b/images/win/scripts/Installers/Install-InnoSetup.ps1 index 8020120d1..17f26962e 100644 --- a/images/win/scripts/Installers/Install-InnoSetup.ps1 +++ b/images/win/scripts/Installers/Install-InnoSetup.ps1 @@ -3,4 +3,4 @@ ## Desc: Install Inno Setup ################################################################################ -choco install innosetup -y +Choco-Install -PackageName innosetup diff --git a/images/win/scripts/Installers/Install-JavaTools.ps1 b/images/win/scripts/Installers/Install-JavaTools.ps1 index 68c0209fd..e88fc7453 100644 --- a/images/win/scripts/Installers/Install-JavaTools.ps1 +++ b/images/win/scripts/Installers/Install-JavaTools.ps1 @@ -61,9 +61,9 @@ 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.3 -choco install gradle -y +Choco-Install -PackageName ant -ArgumentList "-i" +Choco-Install -PackageName maven -ArgumentList "-i", "--version=3.6.3" +Choco-Install -PackageName gradle # 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 diff --git a/images/win/scripts/Installers/Install-Jq.ps1 b/images/win/scripts/Installers/Install-Jq.ps1 index 1ccb42da8..5a383d797 100644 --- a/images/win/scripts/Installers/Install-Jq.ps1 +++ b/images/win/scripts/Installers/Install-Jq.ps1 @@ -3,4 +3,4 @@ ## Desc: Install jq ################################################################################ -choco install jq -y +Choco-Install -PackageName jq diff --git a/images/win/scripts/Installers/Install-Julia.ps1 b/images/win/scripts/Installers/Install-Julia.ps1 index f1f421168..6677b5d1d 100644 --- a/images/win/scripts/Installers/Install-Julia.ps1 +++ b/images/win/scripts/Installers/Install-Julia.ps1 @@ -3,4 +3,4 @@ ## Desc: Install Julia ################################################################################ -choco install julia -y --ia "/DIR=C:\Julia" +Choco-Install -PackageName julia -ArgumentList "--ia","/DIR=C:\Julia" diff --git a/images/win/scripts/Installers/Install-KubernetesCli.ps1 b/images/win/scripts/Installers/Install-KubernetesCli.ps1 index 8c7350c0f..c6ad04bc7 100644 --- a/images/win/scripts/Installers/Install-KubernetesCli.ps1 +++ b/images/win/scripts/Installers/Install-KubernetesCli.ps1 @@ -3,4 +3,4 @@ ## Desc: Install KubernetesCli ################################################################################ -choco install kubernetes-cli -y +Choco-Install -PackageName kubernetes-cli diff --git a/images/win/scripts/Installers/Install-Mercurial.ps1 b/images/win/scripts/Installers/Install-Mercurial.ps1 index 65a5cdefa..da820d1b3 100644 --- a/images/win/scripts/Installers/Install-Mercurial.ps1 +++ b/images/win/scripts/Installers/Install-Mercurial.ps1 @@ -3,7 +3,7 @@ ## Desc: Install Mercurial ################################################################################ -choco install hg -y --version 5.0.0 +Choco-Install -PackageName hg -ArgumentList "--version", "5.0.0" $hgPath = "${env:ProgramFiles}\Mercurial\" Add-MachinePathItem $hgPath diff --git a/images/win/scripts/Installers/Install-MinGW.ps1 b/images/win/scripts/Installers/Install-MinGW.ps1 index c2aa0f52c..ac585b9d8 100644 --- a/images/win/scripts/Installers/Install-MinGW.ps1 +++ b/images/win/scripts/Installers/Install-MinGW.ps1 @@ -5,7 +5,7 @@ Import-Module -Name ImageHelpers -Force -Install-Choco "mingw" +Choco-Install -PackageName 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 diff --git a/images/win/scripts/Installers/Install-NSIS.ps1 b/images/win/scripts/Installers/Install-NSIS.ps1 index c8c5e370e..71ceb70d7 100644 --- a/images/win/scripts/Installers/Install-NSIS.ps1 +++ b/images/win/scripts/Installers/Install-NSIS.ps1 @@ -3,7 +3,7 @@ ## Desc: Install NSIS ################################################################################ -choco install nsis -y +Choco-Install -PackageName nsis $NsisPath = "${env:ProgramFiles(x86)}\NSIS\" Add-MachinePathItem $NsisPath diff --git a/images/win/scripts/Installers/Install-NodeLts.ps1 b/images/win/scripts/Installers/Install-NodeLts.ps1 index e1ec5f0fb..c1ee0579a 100644 --- a/images/win/scripts/Installers/Install-NodeLts.ps1 +++ b/images/win/scripts/Installers/Install-NodeLts.ps1 @@ -12,7 +12,7 @@ $CachePath = 'C:\npm\cache' New-Item -Path $PrefixPath -Force -ItemType Directory New-Item -Path $CachePath -Force -ItemType Directory -choco install nodejs-lts -y --force +Choco-Install -PackageName nodejs-lts -ArgumentList "--force" Add-MachinePathItem $PrefixPath $env:Path = Get-MachinePath diff --git a/images/win/scripts/Installers/Install-OpenSSL.ps1 b/images/win/scripts/Installers/Install-OpenSSL.ps1 index 5ff783398..4f43ad435 100644 --- a/images/win/scripts/Installers/Install-OpenSSL.ps1 +++ b/images/win/scripts/Installers/Install-OpenSSL.ps1 @@ -3,4 +3,4 @@ ## Desc: Install OpenSSL ################################################################################ -choco install openssl.light -y +Choco-Install -PackageName openssl.light diff --git a/images/win/scripts/Installers/Install-PHP.ps1 b/images/win/scripts/Installers/Install-PHP.ps1 index 72db2ee27..f4fc4f1d1 100644 --- a/images/win/scripts/Installers/Install-PHP.ps1 +++ b/images/win/scripts/Installers/Install-PHP.ps1 @@ -8,10 +8,10 @@ Import-Module -Name ImageHelpers # Install latest PHP in chocolatey $installDir = "c:\tools\php" -choco install php -y --force --params "/InstallDir:$installDir" +Choco-Install -PackageName php -ArgumentList "--force", "--params", "/InstallDir:$installDir" # Install latest Composer in chocolatey -choco install composer --ia "/DEV=$installDir /PHP=$installDir" +Choco-Install -PackageName composer -ArgumentList "--ia", "/DEV=$installDir /PHP=$installDir" # update path to extensions and enable curl and mbstring extensions, and enable php openssl 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"' -replace 'extension=";php_openssl.dll"','extension_dir = "php_openssl.dll"') | Set-Content -Path $installDir\php.ini diff --git a/images/win/scripts/Installers/Install-Packer.ps1 b/images/win/scripts/Installers/Install-Packer.ps1 index 4374175d1..6d74fbf77 100644 --- a/images/win/scripts/Installers/Install-Packer.ps1 +++ b/images/win/scripts/Installers/Install-Packer.ps1 @@ -3,4 +3,4 @@ ## Desc: Install Packer ################################################################################ -choco install packer -y +Choco-Install -PackageName packer diff --git a/images/win/scripts/Installers/Install-Perl.ps1 b/images/win/scripts/Installers/Install-Perl.ps1 index 59b1e11a0..350e6c676 100644 --- a/images/win/scripts/Installers/Install-Perl.ps1 +++ b/images/win/scripts/Installers/Install-Perl.ps1 @@ -3,4 +3,4 @@ ## Desc: Install Perl ################################################################################ -choco install strawberryperl -y +Choco-Install -PackageName strawberryperl diff --git a/images/win/scripts/Installers/Install-Sbt.ps1 b/images/win/scripts/Installers/Install-Sbt.ps1 index b96ed5ac8..bc0e95a20 100644 --- a/images/win/scripts/Installers/Install-Sbt.ps1 +++ b/images/win/scripts/Installers/Install-Sbt.ps1 @@ -8,7 +8,7 @@ Import-Module -Name ImageHelpers # Install the latest version of sbt. # See https://chocolatey.org/packages/sbt -choco install sbt -y +Choco-Install -PackageName sbt $env:SBT_HOME="${env:ProgramFiles(x86)}\sbt" diff --git a/images/win/scripts/Installers/Install-Svn.ps1 b/images/win/scripts/Installers/Install-Svn.ps1 index 45dd52319..315c4ef8a 100644 --- a/images/win/scripts/Installers/Install-Svn.ps1 +++ b/images/win/scripts/Installers/Install-Svn.ps1 @@ -3,4 +3,4 @@ ## Desc: Install Subversion ################################################################################ -choco install svn -y +Choco-Install -PackageName svn diff --git a/images/win/scripts/Installers/Install-VSWhere.ps1 b/images/win/scripts/Installers/Install-VSWhere.ps1 index d60986540..5c623c936 100644 --- a/images/win/scripts/Installers/Install-VSWhere.ps1 +++ b/images/win/scripts/Installers/Install-VSWhere.ps1 @@ -3,4 +3,4 @@ ## Desc: Install latest stable version of VSWhere ################################################################################ -choco install vswhere -y +Choco-Install -PackageName vswhere diff --git a/images/win/scripts/Installers/Install-Wix.ps1 b/images/win/scripts/Installers/Install-Wix.ps1 index 076be86c9..25469dab8 100644 --- a/images/win/scripts/Installers/Install-Wix.ps1 +++ b/images/win/scripts/Installers/Install-Wix.ps1 @@ -3,9 +3,9 @@ ## Desc: Install WIX. ################################################################################ -Import-Module -Name ImageHelpers -Force; +Import-Module -Name ImageHelpers -Force -choco install wixtoolset -y --force +Choco-Install -PackageName wixtoolset -ArgumentList "--force" if(Test-IsWin19) { diff --git a/images/win/scripts/Installers/Install-Zstd.ps1 b/images/win/scripts/Installers/Install-Zstd.ps1 index 098334ebe..2251143bc 100644 --- a/images/win/scripts/Installers/Install-Zstd.ps1 +++ b/images/win/scripts/Installers/Install-Zstd.ps1 @@ -3,4 +3,4 @@ ## Desc: Install zstd ################################################################################ -choco install zstandard -y +Choco-Install -PackageName zstandard diff --git a/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 b/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 index 6f7dd13e8..d8fa7a059 100644 --- a/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 +++ b/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 @@ -111,7 +111,10 @@ choco feature enable -n allowGlobalConfirmation Remove-Item -Path $env:ChocolateyInstall\bin\cpack.exe -Force # Install webpi -choco install webpicmd -y +Choco-Install -PackageName webpicmd + +# Install vcredist140 +Choco-Install -PackageName vcredist140 # Expand disk size of OS drive diff --git a/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 b/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 index 4f05935c9..92e153d73 100644 --- a/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 +++ b/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 @@ -109,7 +109,7 @@ choco feature enable -n allowGlobalConfirmation Remove-Item -Path $env:ChocolateyInstall\bin\cpack.exe -Force # Install webpi -choco install webpicmd -y +Choco-Install -PackageName webpicmd # Expand disk size of OS drive From cb4a6e0cc0d25b8dc023afec6e053da8ac10cd61 Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:37:59 +0000 Subject: [PATCH 13/14] add libgbm (#734) --- images/linux/scripts/installers/1604/basic.sh | 2 ++ images/linux/scripts/installers/1804/basic.sh | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/images/linux/scripts/installers/1604/basic.sh b/images/linux/scripts/installers/1604/basic.sh index adc1e8098..e579e1c01 100644 --- a/images/linux/scripts/installers/1604/basic.sh +++ b/images/linux/scripts/installers/1604/basic.sh @@ -49,6 +49,7 @@ apt-fast install -y --no-install-recommends \ libgconf-2-4 \ dbus \ xvfb \ + libgbm-dev \ libgtk-3-0 \ tk \ fakeroot \ @@ -80,6 +81,7 @@ DocumentInstalledItemIndent "jq" DocumentInstalledItemIndent "libc++-dev" DocumentInstalledItemIndent "libc++abi-dev" DocumentInstalledItemIndent "libcurl3" +DocumentInstalledItemIndent "libgbm-dev" DocumentInstalledItemIndent "libicu55" DocumentInstalledItemIndent "libunwind8" DocumentInstalledItemIndent "locales" diff --git a/images/linux/scripts/installers/1804/basic.sh b/images/linux/scripts/installers/1804/basic.sh index c12c7a819..29cb15b40 100644 --- a/images/linux/scripts/installers/1804/basic.sh +++ b/images/linux/scripts/installers/1804/basic.sh @@ -97,6 +97,9 @@ apt-get install -y --no-install-recommends dbus echo "Install xvfb" apt-get install -y --no-install-recommends xvfb +echo "Install libgbm-dev" +apt-get install -y --no-install-recommends libgbm-dev + echo "Install libgtk" apt-get install -y --no-install-recommends libgtk-3-0 @@ -147,6 +150,7 @@ DocumentInstalledItemIndent "iproute2" DocumentInstalledItemIndent "iputils-ping" DocumentInstalledItemIndent "jq" DocumentInstalledItemIndent "libcurl3" +DocumentInstalledItemIndent "libgbm-dev" DocumentInstalledItemIndent "libicu55" DocumentInstalledItemIndent "libunwind8" DocumentInstalledItemIndent "locales" From b1cf25f87347fa4d84260ac91431f11231b12e74 Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:38:10 +0000 Subject: [PATCH 14/14] [Ubuntu] Remove workaround for vcpkg (#728) * remove workaround * add workaround for ubuntu 16 * remove sudo * Spelling * remove extra lines --- images/linux/scripts/installers/vcpkg.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/images/linux/scripts/installers/vcpkg.sh b/images/linux/scripts/installers/vcpkg.sh index d9672348e..69f50c5e7 100644 --- a/images/linux/scripts/installers/vcpkg.sh +++ b/images/linux/scripts/installers/vcpkg.sh @@ -6,22 +6,30 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/os.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 https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT -# Workaround to avoid issues caused by this PR https://github.com/microsoft/vcpkg/pull/10834 -cd $VCPKG_INSTALLATION_ROOT -git checkout 1e19af09e53e5f306ed89c2033817a21e5ee0bcf +git clone --depth=1 https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT + +# vcpkg requires g++ version 7+, yet Ubuntu 16 default is 5.4. Set version 7 as default temporarily +if isUbuntu16; then + ln -sf g++-7 /usr/bin/g++ +fi $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 +# Set back g++ 5.4 as default +if isUbuntu16; then + ln -sf g++-5 /usr/bin/g++ +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 vcpkg; then