From 132a24700ff47b4edd7aeac8921d1cdee5eccc58 Mon Sep 17 00:00:00 2001 From: Lessley Dennington Date: Mon, 15 Aug 2022 07:56:26 -0700 Subject: [PATCH] install from source: add support for Jammy Jellyfish The dotnet team recently added support for installing natively from Jammy feeds on Ubuntu 22.04: https://github.com/dotnet/core/issues/7699 This unfortunately created problems with our current install from source script, as it caused conflicts with the packages.microsoft.com feed we use in the install from for Debian/Ubuntu. This change modifies the Debian/Ubuntu dotnet install to install from Jammy feeds for users on Ubuntu 22.04 and greater while continuing to use the packages.microsoft.com feed for Debian and older Ubuntu versions. --- .../Packaging.Linux/install-from-source.sh | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/linux/Packaging.Linux/install-from-source.sh b/src/linux/Packaging.Linux/install-from-source.sh index cf57321f95..847dd546f6 100755 --- a/src/linux/Packaging.Linux/install-from-source.sh +++ b/src/linux/Packaging.Linux/install-from-source.sh @@ -120,22 +120,38 @@ case "$distribution" in $sudo_cmd apt update install_shared_packages apt install - # add dotnet package repository/signing key - $sudo_cmd apt update && $sudo_cmd apt install wget -y - curl -LO https://packages.microsoft.com/config/"$distribution"/"$version"/packages-microsoft-prod.deb - $sudo_cmd dpkg -i packages-microsoft-prod.deb - rm packages-microsoft-prod.deb + # For Ubuntu versions 22.04 (Jammy Jellyfish) and greater, we use the + # native Jammy feeds. For Debian and Ubuntu versions less than 22.04, we + # use the packages.microsoft.com feed. + normalizedVersion=$(echo $version | sed 's/\.//') + useMicrosoftFeed=true + if [ $distribution = ubuntu ] && [ $normalizedVersion -ge 2204 ]; then + useMicrosoftFeed=false + fi + + if $useMicrosoftFeed; then + # add dotnet package repository/signing key + $sudo_cmd apt update && $sudo_cmd apt install wget -y + curl -LO https://packages.microsoft.com/config/"$distribution"/"$version"/packages-microsoft-prod.deb + $sudo_cmd dpkg -i packages-microsoft-prod.deb + rm packages-microsoft-prod.deb - # proactively install tzdata to prevent prompts - export DEBIAN_FRONTEND=noninteractive - $sudo_cmd apt install -y --no-install-recommends tzdata + # proactively install tzdata to prevent prompts + export DEBIAN_FRONTEND=noninteractive + $sudo_cmd apt install -y --no-install-recommends tzdata + fi # install dotnet packages and dependencies if needed if [ -z "$(verify_existing_dotnet_installation)" ]; then $sudo_cmd apt update - $sudo_cmd apt install apt-transport-https -y - $sudo_cmd apt update - $sudo_cmd apt install dotnet-sdk-6.0 dpkg-dev -y + + if $useMicrosoftFeed; then + $sudo_cmd apt install apt-transport-https -y + $sudo_cmd apt update + $sudo_cmd apt install dotnet-sdk-6.0 dpkg-dev -y + else + $sudo_cmd apt install dotnet6 + fi fi ;; linuxmint)