Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Consider auto-detecting OS release for Ubuntu installation instructions #535

Open
daviewales opened this issue Jun 21, 2024 · 2 comments
Open

Comments

@daviewales
Copy link

For example, instead of:

ver=20.04 # or 22.04
apt-add-repository https://packages.microsoft.com/ubuntu/${ver}/prod

You might instead suggest:

apt-add-repository https://packages.microsoft.com/ubuntu/$(lsb_release -sr)/prod
@magodo
Copy link
Collaborator

magodo commented Jun 21, 2024

@daviewales The reason here is because we only ship the release to those two versions for now.

@daviewales
Copy link
Author

You could comment that perhaps?
I opened the issue because I forgot what version I was on, assumed it was 20.04, and then it didn't work.
Auto-detecting is an improvement, because the default copy-paste path will now work on two versions instead of one.

Here's another version which tracks the supported versions, and only attempts to install on supported systems, and prints a friendly error message on unsupported systems:

# Note: Only 20.04 and 22.04 are currently supported
SUPPORTED='20.04 22.04'
if grep $(lsb_release -sr) <<< "$SUPPORTED"; then
    sudo apt-add-repository https://packages.microsoft.com/ubuntu/$(lsb_release -sr)/prod
else
    echo $(lsb_release -sr) is not currently supported
    echo "supported versions: $SUPPORTED"
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants