mirror of
https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
synced 2024-11-14 22:43:44 +08:00
cb233f4357
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Link: https://github.com/kmod-project/kmod/pull/132 Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
18 lines
432 B
Bash
Executable File
18 lines
432 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
for moddir in /usr/lib/modules /lib/modules; do
|
|
if [[ -e "$moddir" ]]; then
|
|
kernel=$(find "$moddir" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)
|
|
break
|
|
fi
|
|
done
|
|
|
|
# There should be one entry - the kernel we installed
|
|
if (( $(echo "$kernel" | wc -l) != 1 )); then
|
|
echo >&2 "Error: exactly one kernel must be installed"
|
|
exit 1
|
|
fi
|
|
echo "KDIR=$moddir/$kernel/build"
|