-
Notifications
You must be signed in to change notification settings - Fork 996
new(scrips): improve systemd units for rpm and debian. #2242
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
Changes from all commits
f22a8e9
47ebaf6
cff9740
f30dd5e
25eb4fb
f612c13
db1d3fe
06368d6
cef8325
3e017cb
bf3d2c5
3769c20
984c815
c9ba730
e8055de
a419eff
3087362
1896644
c43672f
6ad4bac
d43879c
b97f08d
1e45e4c
2cd951b
ab8460b
42bbc2b
aa357ea
2f21814
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,7 +211,13 @@ load_kernel_module_compile() { | |
| fi | ||
|
|
||
| # Try to compile using all the available gcc versions | ||
| for CURRENT_GCC in $(which gcc) $(ls "$(dirname "$(which gcc)")"/gcc-* | grep 'gcc-[0-9]\+' | sort -n -r -k 2 -t -); do | ||
| for CURRENT_GCC in $(ls "$(dirname "$(which gcc)")"/gcc*); do | ||
| # Filter away gcc-{ar,nm,...} | ||
| # Only gcc compiler has `-print-search-dirs` option. | ||
| ${CURRENT_GCC} -print-search-dirs 2>&1 | grep "install:" | ||
| if [ "$?" -ne "0" ]; then | ||
| continue | ||
| fi | ||
| echo "* Trying to dkms install ${DRIVER_NAME} module with GCC ${CURRENT_GCC}" | ||
| echo "#!/usr/bin/env bash" > /tmp/falco-dkms-make | ||
| echo "make CC=${CURRENT_GCC} \$@" >> /tmp/falco-dkms-make | ||
|
|
@@ -232,14 +238,19 @@ load_kernel_module_compile() { | |
| return | ||
| fi | ||
| echo "* ${DRIVER_NAME} module found: ${KO_FILE}" | ||
| echo "* Trying insmod" | ||
| echo "* Trying to modprobe" | ||
| chcon -t modules_object_t "$KO_FILE" > /dev/null 2>&1 || true | ||
| if modprobe "${DRIVER_NAME}" > /dev/null 2>&1; then | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we reached this point, we were able to build through |
||
| echo "* Success: ${DRIVER_NAME} module found in dkms and loaded" | ||
| exit 0 | ||
| fi | ||
| echo "* Unable to load ${DRIVER_NAME} module" | ||
| echo "* Trying insmod" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
| if insmod "$KO_FILE" > /dev/null 2>&1; then | ||
| echo "* Success: ${DRIVER_NAME} module found and loaded in dkms" | ||
| echo "* Success: ${DRIVER_NAME} module found in dkms and inserted" | ||
| exit 0 | ||
| else | ||
| echo "* Unable to insmod ${DRIVER_NAME} module" | ||
| fi | ||
| echo "* Unable to insmod ${DRIVER_NAME} module" | ||
| else | ||
| DKMS_LOG="/var/lib/dkms/${DRIVER_NAME}/${DRIVER_VERSION}/build/make.log" | ||
| if [ -f "${DKMS_LOG}" ]; then | ||
|
|
@@ -260,12 +271,19 @@ load_kernel_module_download() { | |
| if curl -L --create-dirs "${FALCO_DRIVER_CURL_OPTIONS}" -o "${HOME}/.falco/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME}" "${URL}"; then | ||
| echo "* Download succeeded" | ||
| chcon -t modules_object_t "${HOME}/.falco/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME}" > /dev/null 2>&1 || true | ||
| mkdir -p /lib/modules/${KERNEL_RELEASE}/kernel/drivers/falco/ || true | ||
| cp ${HOME}/.falco/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME} /lib/modules/${KERNEL_RELEASE}/kernel/drivers/falco/falco.ko || true | ||
| depmod ${KERNEL_RELEASE} || true | ||
| if modprobe "${DRIVER_NAME}" > /dev/null 2>&1; then | ||
| echo "* Success: ${DRIVER_NAME} module found and loaded" | ||
| exit 0 | ||
| fi | ||
| >&2 echo "Unable to load the prebuilt ${DRIVER_NAME} module" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, fallback at
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modprobe can fail if either |
||
| if insmod "${HOME}/.falco/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME}"; then | ||
| echo "* Success: ${DRIVER_NAME} module found and inserted" | ||
| exit 0 | ||
| else | ||
| >&2 echo "Unable to insmod the prebuilt ${DRIVER_NAME} module" | ||
| fi | ||
| fi | ||
| >&2 echo "Unable to insmod the prebuilt ${DRIVER_NAME} module" | ||
| else | ||
| >&2 echo "Unable to find a prebuilt ${DRIVER_NAME} module" | ||
| return | ||
|
|
@@ -379,6 +397,13 @@ load_kernel_module() { | |
| if [ -f "${HOME}/.falco/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME}" ]; then | ||
| echo "* Found a prebuilt ${DRIVER_NAME} module at ${HOME}/.falco/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME}, loading it" | ||
| chcon -t modules_object_t "${HOME}/.falco/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME}" > /dev/null 2>&1 || true | ||
| mkdir -p /lib/modules/${KERNEL_RELEASE}/kernel/drivers/falco/ || true | ||
| cp ${HOME}/.falco/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME} /lib/modules/${KERNEL_RELEASE}/kernel/drivers/falco/falco.ko || true | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even if the module was already present under |
||
| depmod ${KERNEL_RELEASE} || true | ||
| if modprobe "${DRIVER_NAME}" > /dev/null 2>&1; then | ||
| echo "* Success: ${DRIVER_NAME} module found and loaded" | ||
| exit 0 | ||
| fi | ||
| insmod "${HOME}/.falco/${DRIVER_VERSION}/${ARCH}/${FALCO_KERNEL_MODULE_FILENAME}" && echo "* Success: ${DRIVER_NAME} module found and inserted" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modprobe can fail if either mkdir or cp fail (perhaps they are not writable?), therefore we force-try to insmod the file too! |
||
| exit $? | ||
| fi | ||
|
|
@@ -397,7 +422,7 @@ load_kernel_module() { | |
| # Last try (might load a previous driver version) | ||
| echo "* Trying to load a system ${DRIVER_NAME} module, if present" | ||
| if modprobe "${DRIVER_NAME}" > /dev/null 2>&1; then | ||
| echo "* Success: ${DRIVER_NAME} module found and loaded with modprobe" | ||
| echo "* Success: ${DRIVER_NAME} module found and loaded" | ||
| exit 0 | ||
| fi | ||
|
|
||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having issues on amazonlinux2 instance, because gcc is not called
gcc-XbutgccX.