Skip to content

Refactor AWS CLI installation script#1690

Open
faangbait wants to merge 2 commits into
devcontainers:mainfrom
faangbait:aws-cli-patch
Open

Refactor AWS CLI installation script#1690
faangbait wants to merge 2 commits into
devcontainers:mainfrom
faangbait:aws-cli-patch

Conversation

@faangbait

Copy link
Copy Markdown

Refactor package installation for different Linux distributions and clean up the script. Added support for Alpine and RedHat package managers.

All of the package installation code + OS detection was ripped straight from common-utils.

# Bring in ID, ID_LIKE, VERSION_ID, VERSION_CODENAME
. /etc/os-release
# Get an adjusted ID independent of distro variants
if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then
ADJUSTED_ID="debian"
elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "azurelinux" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then
ADJUSTED_ID="rhel"
VERSION_CODENAME="${ID}${VERSION_ID}"
elif [ "${ID}" = "alpine" ]; then
ADJUSTED_ID="alpine"
else
echo "Linux distro ${ID} not supported."
exit 1
fi
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
# As of 1 July 2024, mirrorlist.centos.org no longer exists.
# Update the repo files to reference vault.centos.org.
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
fi
# Install packages for appropriate OS
case "${ADJUSTED_ID}" in
"debian")
install_debian_packages
;;
"rhel")
install_redhat_packages
;;
"alpine")
install_alpine_packages
;;
esac

install_debian_packages() {

install_redhat_packages() {

install_alpine_packages() {

Refactor package installation for different Linux distributions and clean up the script. Added support for Alpine and RedHat package managers.
@faangbait
faangbait requested a review from a team as a code owner July 22, 2026 02:13
@faangbait

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@Kaniska244 Kaniska244 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @faangbait

The tests are failing as VERSION variable got overwritten because of sourcing of /etc/os-release file here. Would you kindly look into it.

@faangbait
faangbait requested a review from Kaniska244 July 22, 2026 15:58

@Kaniska244 Kaniska244 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @faangbait

Thank you for the correction. Could you please also bump the feature version.

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

Successfully merging this pull request may close these issues.

2 participants