Azure / aztfexport

A tool to bring existing Azure resources under Terraform's management
https://azure.github.io/aztfexport/
Mozilla Public License 2.0
1.63k stars 190 forks source link

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

Closed daviewales closed 3 months ago

daviewales commented 5 months ago

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 commented 5 months ago

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

daviewales commented 5 months ago

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