[v2] Implement macOS/Linux install script#10427
Open
hssyoo wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Helper bash script to install AWS CLI v2 on macOS and Linux.
High-level overview:
--versionisn't specified, it just grabs the latest version. The script fetches https://awscli.amazonaws.com/v2/version.txt in case the user already has the latest version installed in the configured path.pkgutiltool used to verify the signature is a required dependency because it's available by default. On Linux,gpgis optional because it's not uncommon for Linux distros to not include them. A warning is emitted in this case.--versionparameter so users can pin to a specific version in automation workflows.Install layout
The main difference between the install script and official installers is that the script will not install system-wide by default (which requires
sudo). Instead, it'll default to user-local installs, respecting XDG environment variables set by the user.$HOME/.local/shareand bin directory is$HOME/.local/bin.XDG_DATA_HOMEandXDG_BIN_HOMEare set, then use those as install/bin dirs.--systemflag is passed, then install system-wide to/usr/local/and/usr/local/bin(same default behavior as installers today). Requiressudo.sudois run without the--systemflag, then the install lands in the user's root$HOME. It also ignores XDG environment variables set by the user. We emit a warning in this case so the user knows where it was installed to and why.install.jsonThis script introduces a new file called
install.jsonthat lives on disk in the install directory. It contains metadata about how the AWS CLI was installed. This needed to be distinct frommetadata.jsonbecausemetadata.jsonis created at build-time, whereas the information we need isn't known until install-time.install.jsonis used to assist the upcomingupdatecommand by preserving info on how it was originally installed.