fix(scripts): force falco-driver-loader script to try to compile the driver anyway even on unsupported platforms.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro 2022-09-22 11:18:08 +02:00 committed by poiana
parent acf5c4ce5f
commit c0c0246927

View File

@ -114,8 +114,7 @@ get_target_id() {
# Older CentOS distros # Older CentOS distros
OS_ID=centos OS_ID=centos
else else
>&2 echo "Detected an unsupported target system, please get in touch with the Falco community" return 1
exit 1
fi fi
# Overwrite the OS_ID if /etc/VERSION file is present. # Overwrite the OS_ID if /etc/VERSION file is present.
@ -164,6 +163,7 @@ get_target_id() {
TARGET_ID=$(echo "${OS_ID}" | tr '[:upper:]' '[:lower:]') TARGET_ID=$(echo "${OS_ID}" | tr '[:upper:]' '[:lower:]')
;; ;;
esac esac
return 0
} }
flatcar_relocate_tools() { flatcar_relocate_tools() {
@ -253,8 +253,6 @@ load_kernel_module_compile() {
} }
load_kernel_module_download() { load_kernel_module_download() {
get_target_id
local FALCO_KERNEL_MODULE_FILENAME="${DRIVER_NAME}_${TARGET_ID}_${KERNEL_RELEASE}_${KERNEL_VERSION}.ko" local FALCO_KERNEL_MODULE_FILENAME="${DRIVER_NAME}_${TARGET_ID}_${KERNEL_RELEASE}_${KERNEL_VERSION}.ko"
local URL=$(echo "${1}/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME}" | sed s/+/%2B/g) local URL=$(echo "${1}/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME}" | sed s/+/%2B/g)
@ -374,8 +372,6 @@ load_kernel_module() {
echo "* Looking for a ${DRIVER_NAME} module locally (kernel ${KERNEL_RELEASE})" echo "* Looking for a ${DRIVER_NAME} module locally (kernel ${KERNEL_RELEASE})"
get_target_id
local FALCO_KERNEL_MODULE_FILENAME="${DRIVER_NAME}_${TARGET_ID}_${KERNEL_RELEASE}_${KERNEL_VERSION}.ko" local FALCO_KERNEL_MODULE_FILENAME="${DRIVER_NAME}_${TARGET_ID}_${KERNEL_RELEASE}_${KERNEL_VERSION}.ko"
echo "* Filename '${FALCO_KERNEL_MODULE_FILENAME}' is composed of:" echo "* Filename '${FALCO_KERNEL_MODULE_FILENAME}' is composed of:"
print_filename_components print_filename_components
@ -544,8 +540,6 @@ load_bpf_probe() {
mount -t debugfs nodev /sys/kernel/debug mount -t debugfs nodev /sys/kernel/debug
fi fi
get_target_id
BPF_PROBE_FILENAME="${DRIVER_NAME}_${TARGET_ID}_${KERNEL_RELEASE}_${KERNEL_VERSION}.o" BPF_PROBE_FILENAME="${DRIVER_NAME}_${TARGET_ID}_${KERNEL_RELEASE}_${KERNEL_VERSION}.o"
echo "* Filename '${BPF_PROBE_FILENAME}' is composed of:" echo "* Filename '${BPF_PROBE_FILENAME}' is composed of:"
print_filename_components print_filename_components
@ -638,6 +632,8 @@ DRIVER_VERSION=${DRIVER_VERSION:-"@DRIVER_VERSION@"}
DRIVER_NAME=${DRIVER_NAME:-"@DRIVER_NAME@"} DRIVER_NAME=${DRIVER_NAME:-"@DRIVER_NAME@"}
FALCO_VERSION="@FALCO_VERSION@" FALCO_VERSION="@FALCO_VERSION@"
TARGET_ID="placeholder" # when no target id can be fetched, we try to build the driver from source anyway, using a placeholder name
DRIVER="module" DRIVER="module"
if [ -v FALCO_BPF_PROBE ]; then if [ -v FALCO_BPF_PROBE ]; then
DRIVER="bpf" DRIVER="bpf"
@ -711,6 +707,13 @@ if [ -z "$source_only" ]; then
exit 1 exit 1
fi fi
get_target_id
res=$?
if [ $res != 0 ]; then
>&2 echo "Detected an unsupported target system, please get in touch with the Falco community. Trying to compile anyway."
ENABLE_DOWNLOAD=
fi
if [ -n "$clean" ]; then if [ -n "$clean" ]; then
if [ -n "$has_opts" ]; then if [ -n "$has_opts" ]; then
>&2 echo "Cannot use --clean with other options" >&2 echo "Cannot use --clean with other options"