diff --git a/collector/kernel/kernel_headers.sh b/collector/kernel/kernel_headers.sh index e8509061..189b0046 100755 --- a/collector/kernel/kernel_headers.sh +++ b/collector/kernel/kernel_headers.sh @@ -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 ;; @@ -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 @@ -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) diff --git a/common/linux_distro.h b/common/linux_distro.h index b9df96f0..fd6eb352 100644 --- a/common/linux_distro.h +++ b/common/linux_distro.h @@ -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 diff --git a/test/kernel/bootstrap.sh b/test/kernel/bootstrap.sh index eb840b7f..4c2e3b09 100755 --- a/test/kernel/bootstrap.sh +++ b/test/kernel/bootstrap.sh @@ -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" diff --git a/test/kernel/distros-and-kernels.sh b/test/kernel/distros-and-kernels.sh index f93a52fa..663ac63d 100644 --- a/test/kernel/distros-and-kernels.sh +++ b/test/kernel/distros-and-kernels.sh @@ -3,6 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 distros_and_kernels=( +"bento rockylinux-8" "debian bullseye64" "bento amazonlinux-2" "ubuntu bionic64" diff --git a/test/kernel/source/data/bento-install-kernel-headers.sh b/test/kernel/source/data/bento-install-kernel-headers.sh new file mode 100755 index 00000000..8ec1326b --- /dev/null +++ b/test/kernel/source/data/bento-install-kernel-headers.sh @@ -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 + diff --git a/test/kernel/source/data/centos-provision.sh b/test/kernel/source/data/bento-provision.sh similarity index 74% rename from test/kernel/source/data/centos-provision.sh rename to test/kernel/source/data/bento-provision.sh index 279455fc..6b9c9ce4 100755 --- a/test/kernel/source/data/centos-provision.sh +++ b/test/kernel/source/data/bento-provision.sh @@ -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 diff --git a/test/kernel/source/data/centos-uninstall-kernel-headers.sh b/test/kernel/source/data/bento-uninstall-kernel-headers.sh similarity index 100% rename from test/kernel/source/data/centos-uninstall-kernel-headers.sh rename to test/kernel/source/data/bento-uninstall-kernel-headers.sh diff --git a/test/kernel/source/data/centos-install-kernel-headers.sh b/test/kernel/source/data/centos-install-kernel-headers.sh deleted file mode 100755 index d6470f5f..00000000 --- a/test/kernel/source/data/centos-install-kernel-headers.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -set -xe - -uname -a - -export RUNNING_KERNEL_VERSION="`uname -r`" - -sudo yum install -y kernel-devel "${RUNNING_KERNEL_VERSION}"