-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[ABLD-18] Update macOS installation script for AArch64/ARM64 #38498
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
|
|
||
| # Datadog Agent install script for macOS. | ||
| set -e | ||
| install_script_version=1.4.0 | ||
| install_script_version=1.5.0 | ||
| dmg_file=/tmp/datadog-agent.dmg | ||
| dmg_base_url="https://s3.amazonaws.com/dd-agent" | ||
| etc_dir=/opt/datadog-agent/etc | ||
|
|
@@ -63,19 +63,13 @@ if [ -n "$DD_AGENT_MINOR_VERSION" ]; then | |
| fi | ||
|
|
||
| arch=$(/usr/bin/arch) | ||
| if [ "$arch" == "arm64" ]; then | ||
| if ! /usr/bin/pgrep oahd >/dev/null 2>&1; then | ||
| printf "\033[31mRosetta is needed to run datadog-agent on $arch.\nYou can install it by running the following command :\n/usr/sbin/softwareupdate --install-rosetta --agree-to-license\033[0m\n" | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| # Cleanup tmp files used for installation | ||
| rm -f /tmp/install-ddagent/system-wide | ||
|
|
||
| function find_latest_patch_version_for() { | ||
| major_minor="$1" | ||
| patch_versions=$(curl "https://s3.amazonaws.com/dd-agent?prefix=datadog-agent-${major_minor}." 2>/dev/null | grep -o "datadog-agent-${major_minor}.[0-9]*-1.dmg") | ||
| patch_versions=$(curl "$dmg_base_url?prefix=datadog-agent-${major_minor}." 2>/dev/null | grep -Eo "datadog-agent-${major_minor}.[0-9]*-1(.$arch)?.dmg") | ||
| if [ -z "$patch_versions" ]; then | ||
| echo "-1" | ||
| fi | ||
|
|
@@ -218,12 +212,6 @@ if [ -z "$dmg_version" ]; then | |
| fi | ||
| fi | ||
|
|
||
| if [ -z "$agent_dist_channel" ]; then | ||
| dmg_url="$dmg_base_url/datadog-agent-${dmg_version}.dmg" | ||
| else | ||
| dmg_url="$dmg_base_url/$agent_dist_channel/datadog-agent-${dmg_version}.dmg" | ||
| fi | ||
|
|
||
| if [ "$upgrade" ]; then | ||
| if [ ! -f $etc_dir/datadog.conf ]; then | ||
| printf "\033[31mDD_UPGRADE set but no config was found at $etc_dir/datadog.conf.\033[0m\n" | ||
|
|
@@ -365,6 +353,22 @@ function plist_modify_user_group() { | |
| $sudo_cmd sh -c "sed $i_cmd -e \"${closing_dict_line},${closing_dict_line}s|</dict>|<key>$user_parameter</key><string>$user_value</string>\n</dict>|\" -e \"${closing_dict_line},${closing_dict_line}s|</dict>|<key>$group_parameter</key><string>$group_value</string>\n</dict>|\" \"$plist_file\"" | ||
| } | ||
|
|
||
| # Determine agent flavor to install | ||
| if [ -z "$agent_dist_channel" ]; then | ||
| dmg_url_prefix="$dmg_base_url/datadog-agent-${dmg_version}" | ||
| else | ||
| dmg_url_prefix="$dmg_base_url/$agent_dist_channel/datadog-agent-${dmg_version}" | ||
| fi | ||
|
Comment on lines
+357
to
+361
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to reviewers: moved from somewhere above because determining |
||
|
|
||
| dmg_url="$dmg_url_prefix.$arch.dmg" # favor architecture-specific DMG, if available | ||
| if [ "$(curl --head --location --output /dev/null --silent --write-out '%{http_code}' "$dmg_url")" != 200 ]; then | ||
| dmg_url="$dmg_url_prefix.dmg" # fallback to "universal" DMG | ||
| if [ "$arch" = arm64 ] && ! /usr/bin/pgrep oahd >/dev/null 2>&1; then | ||
| printf "\033[31mRosetta is needed to run datadog-agent on $arch.\nYou can install it by running the following command :\n/usr/sbin/softwareupdate --install-rosetta --agree-to-license\033[0m\n" | ||
| exit 1 | ||
| fi | ||
|
Comment on lines
+366
to
+369
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to reviewers: snippet moved from somewhere above so that it's executed only when applicable. |
||
| fi | ||
|
|
||
| # # Install the agent | ||
| printf "\033[34m\n* Downloading datadog-agent\n\033[0m" | ||
| prepare_dmg_file $dmg_file | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes to reviewers:
dmg_base_urldefined somewhere above (and set tohttps://s3.amazonaws.com/dd-agent)grep -E: so as to avoid escaping parenthesis in the regexp (-Eis portable, contrarily to-P)(.$arch)?: retained DMGs will be either "universal" (well, let's call it that way) or match the current$arch(important is to discard other archs)