Skip to content

Commit

Permalink
fix(scripts): fix falco-driver-loader for some debian kernels.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
  • Loading branch information
FedeDP committed Jan 25, 2023
1 parent 77686cb commit c67884d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/falco-driver-loader
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ get_target_id() {
TARGET_ID="amazonlinux"
fi
;;
("debian")
# Workaround: debian kernelreleases might now be actual kernel running;
# instead, they might be the Debian kernel package
# providing the compatible kernel ABI
# See https://lists.debian.org/debian-user/2017/03/msg00485.html
# Real kernel release is embedded inside the kernel version.
# Extract it.
TARGET_ID=$(echo "${OS_ID}" | tr '[:upper:]' '[:lower:]')
if [[ $KERNEL_VERSION =~ ([0-9]+\.[0-9]+\.[0-9]+\-[0-9]+) ]];
then
KERNEL_RELEASE="${BASH_REMATCH[1]}"
fi
;;
("ubuntu")
# Extract the flavor from the kernelrelease
# Examples:
Expand All @@ -151,7 +164,7 @@ get_target_id() {
TARGET_ID=$(echo "${OS_ID}" | tr '[:upper:]' '[:lower:]')
;;
("minikube")
TARGET_ID="${OS_ID}"
TARGET_ID=$(echo "${OS_ID}" | tr '[:upper:]' '[:lower:]')
# Extract the minikube version. Ex. With minikube version equal to "v1.26.0-1655407986-14197" the extracted version
# will be "1.26.0"
if [[ $(cat ${HOST_ROOT}/etc/VERSION) =~ ([0-9]+(\.[0-9]+){2}) ]]; then
Expand All @@ -163,7 +176,7 @@ get_target_id() {
fi
;;
("bottlerocket")
TARGET_ID="${OS_ID}"
TARGET_ID=$(echo "${OS_ID}" | tr '[:upper:]' '[:lower:]')
# variant_id has been sourced from os-release. Get only the first variant part
if [[ -n ${VARIANT_ID} ]]; then
# take just first part (eg: VARIANT_ID=aws-k8s-1.15 -> aws)
Expand Down

0 comments on commit c67884d

Please sign in to comment.