Skip to content
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

(fleet) small optmisation to the installer script #31953

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions pkg/fleet/installer/setup/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ install() {
$sudo_cmd mkdir -p "${tmp_dir}"
case "$(uname -m)" in
x86_64)
echo "${downloader_bin_linux_amd64}" | base64 -d | $sudo_cmd tee "${downloader_path}" >/dev/null
write_installer_amd64 "$sudo_cmd" "$downloader_path"
;;
aarch64)
echo "${downloader_bin_linux_arm64}" | base64 -d | $sudo_cmd tee "${downloader_path}" >/dev/null
write_installer_arm64 "$sudo_cmd" "$downloader_path"
;;
esac
$sudo_cmd chmod +x "${downloader_path}"
Expand All @@ -37,16 +37,16 @@ install() {
# Embedded binaries used to install Datadog.
# Source: https://github.com/DataDog/datadog-agent/tree/INSTALLER_COMMIT/pkg/fleet/installer
# DO NOT EDIT THIS SECTION MANUALLY.
downloader_bin_linux_amd64=$(
cat <<EOM
DOWNLOADER_BIN_LINUX_AMD64
EOM
)
downloader_bin_linux_arm64=$(
cat <<EOM
DOWNLOADER_BIN_LINUX_ARM64
EOM
)
write_installer_amd64() {
local sudo_cmd=$1
local path=$2
base64 -d <<<"DOWNLOADER_BIN_LINUX_AMD64" | $sudo_cmd tee "${path}" >/dev/null
}
write_installer_arm64() {
local sudo_cmd=$1
local path=$2
base64 -d <<<"DOWNLOADER_BIN_LINUX_ARM64" | $sudo_cmd tee "${path}" >/dev/null
}

install "$@"
exit 0
2 changes: 1 addition & 1 deletion tasks/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def build_linux_script(
build_downloader(ctx, flavor=flavor, version=version, os='linux', arch=arch)
with open(DOWNLOADER_BIN, 'rb') as f:
encoded_bin = base64.encodebytes(f.read()).decode('utf-8')
install_script = install_script.replace(f'DOWNLOADER_BIN_{arch.upper()}', encoded_bin)
install_script = install_script.replace(f'DOWNLOADER_BIN_LINUX_{arch.upper()}', encoded_bin)

commit_sha = ctx.run('git rev-parse HEAD', hide=True).stdout.strip()
install_script = install_script.replace('INSTALLER_COMMIT', commit_sha)
Expand Down
Loading