Azure / aztfexport

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

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

Open daviewales opened 2 weeks ago

daviewales commented 2 weeks 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 2 weeks ago

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

daviewales commented 1 week 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