Skip to content

Commit

Permalink
install from source: add support for Jammy Jellyfish
Browse files Browse the repository at this point in the history
The dotnet team recently added support for installing natively from Jammy feeds on
Ubuntu 22.04:

dotnet/core#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.
  • Loading branch information
ldennington committed Aug 15, 2022
1 parent a9fcb46 commit c5d0a81
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions src/linux/Packaging.Linux/install-from-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,39 @@ 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
# use packages.microsoft.com feed to install dotnet on Debian or Ubuntu
# distros before 22.04 (Jammy Jellyfish). For 22.04 and after, use
# native Jammy feeds.
isJammyOrGreater=$(dpkg --compare-versions "21.04" "lt" "22.04"; echo $?)
useMicrosoftFeed=true
if [ $distribution = "ubuntu" ] && [ $isJammyOrGreater -eq 1 ]; 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
# install from packages.microsoft.com
$sudo_cmd apt install apt-transport-https -y
$sudo_cmd apt update
$sudo_cmd apt install dotnet-sdk-6.0 dpkg-dev -y
else
# install from Jammy
$sudo_cmd apt install dotnet6 -y
fi
fi
;;
linuxmint)
Expand Down

0 comments on commit c5d0a81

Please sign in to comment.