Skip to content

Commit

Permalink
Merge pull request #2 from solarwinds/rocky-linux-support
Browse files Browse the repository at this point in the history
NH-89198 Rocky linux support
  • Loading branch information
jaroslav-fedor-swi authored Oct 11, 2024
2 parents 2ad593b + fb56c91 commit 667f63a
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 22 deletions.
7 changes: 5 additions & 2 deletions collector/kernel/kernel_headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function detect_distro {
if [[ -e "${os_release_file}" ]]; then
os_id="$(grep '^ID=' "${os_release_file}" 2> /dev/null | sed -e 's/ID=\(.*\)/\1/g' -e 's/"//g')"
case "${os_id}" in
debian | ubuntu | centos | amazon | rhel)
debian | ubuntu | centos | amazon | rhel | rocky)
echo "${os_id}"
return
;;
Expand All @@ -79,6 +79,9 @@ function detect_distro {
elif grep 'RHEL' "${system_release_file}" > /dev/null 2> /dev/null; then
echo "rhel"
return
elif grep 'Rocky Linux' "${system_release_file}" > /dev/null 2> /dev/null; then
echo "rocky"
return
elif grep 'Amazon Linux' "${system_release_file}" > /dev/null 2> /dev/null; then
echo "amazon"
return
Expand Down Expand Up @@ -391,7 +394,7 @@ function install_kernel_headers {
debian | ubuntu)
install_apt_kernel_headers
;;
centos | rhel | amazon)
centos | rhel | amazon | rocky)
install_yum_kernel_headers
;;
gcp_cos)
Expand Down
3 changes: 2 additions & 1 deletion common/linux_distro.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
X(rhel, 3, "") \
X(centos, 4, "") \
X(amazon, 5, "") \
X(gcp_cos, 6, "")
X(gcp_cos, 6, "") \
X(rocky, 7, "")
#define ENUM_DEFAULT unknown
#include <util/enum_operators.inl>
7 changes: 1 addition & 6 deletions test/kernel/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ fi
mkdir -p "${distro_path}"
pushd "${distro_path}"

if [[ "${distro_name}" == "bento" && "${distro_version}" == "amazonlinux-2" ]]
then
script_distro_name="centos"
else
script_distro_name="${distro_name}"
fi
script_distro_name="${distro_name}"

sed_args=( \
-e "s/PLACEHOLDER_BOX_DISTRO_NAME/${distro_name}/g"
Expand Down
1 change: 1 addition & 0 deletions test/kernel/distros-and-kernels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0

distros_and_kernels=(
"bento rockylinux-8"
"debian bullseye64"
"bento amazonlinux-2"
"ubuntu bionic64"
Expand Down
21 changes: 21 additions & 0 deletions test/kernel/source/data/bento-install-kernel-headers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

set -xe

uname -a

export RUNNING_KERNEL_VERSION="`uname -r`"


if ! grep 'ID="amzn"' /etc/os-release
then
# rocky linux
sudo yum install -y dnf-utils
sudo yum config-manager --set-enabled devel
sudo yum install -y kernel-devel-"${RUNNING_KERNEL_VERSION}"
else
sudo yum install -y kernel-devel "${RUNNING_KERNEL_VERSION}"
fi

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ yum install -y \

if ! grep 'ID="amzn"' /etc/os-release
then
curl -fsSL https://get.docker.com/ | sh
# rocky linux
yum config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl start docker
systemctl status docker
systemctl enable docker
else
# get.docker.com does not currently support amazon linux
yum install -y docker
fi

Expand Down
11 changes: 0 additions & 11 deletions test/kernel/source/data/centos-install-kernel-headers.sh

This file was deleted.

0 comments on commit 667f63a

Please sign in to comment.