Skip to content

Commit f9ff8ba

Browse files
committed
fix(dkms): restore BUILD_EXCLUSIVE helper in dkms.in
Author: rezky_nightky <with dot rezky at gmail dot com> Repository: dkms Branch: main Signing: GPG (4B65AAC2) HashAlgo: BLAKE3 [ Block Metadata ] BlockHash: b3d5667835adf9173292437e875967bed86a3a374726794b8d1fa274e54bb287 PrevHash: e85bd390a9c0d55961d3dd5398fcba4e320e0fc13908af12736cb434c35f5d06 PatchHash: b880aa9058b65d9705ba736b746133a4a31a4b31229b16a06fcba27f11886804 FilesChanged: 1 Lines: +49 / -5 Timestamp: 2026-01-09T09:22:43Z Signature1: 8e280478dc859a501317992636de9b6c0fe128fe5a9a5f25670dc0f7c823073f Signature2: 8e733377cc49b08df09a1892052bd6952528927772a1634ec433321eea7a1aa6 Signed-off-by: rezky_nightky <[email protected]>
1 parent 7f49f3d commit f9ff8ba

File tree

1 file changed

+49
-5
lines changed

1 file changed

+49
-5
lines changed

dkms.in

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,50 @@ read_conf() {
979979
[[ $has_per_module_max == false ]] && BUILD_EXCLUSIVE_KERNEL_MAX=$obsolete_by
980980
fi
981981

982+
check_build_exclusive_for_module() {
983+
local module_index="$1"
984+
local kernel_version="$2"
985+
local arch="$3"
986+
987+
if [[ $BUILD_EXCLUSIVE_KERNEL || $BUILD_EXCLUSIVE_KERNEL_MIN || $BUILD_EXCLUSIVE_KERNEL_MAX || $BUILD_EXCLUSIVE_ARCH || $BUILD_EXCLUSIVE_CONFIG ]]; then
988+
has_build_exclusive_directives=true
989+
elif [[ ${BUILD_EXCLUSIVE_KERNEL[$module_index]} || ${BUILD_EXCLUSIVE_KERNEL_MIN[$module_index]} || ${BUILD_EXCLUSIVE_KERNEL_MAX[$module_index]} || ${BUILD_EXCLUSIVE_ARCH[$module_index]} || ${BUILD_EXCLUSIVE_CONFIG[$module_index]} ]]; then
990+
has_build_exclusive_directives=true
991+
fi
992+
993+
[[ $BUILD_EXCLUSIVE_KERNEL && ! $kernel_version =~ $BUILD_EXCLUSIVE_KERNEL ]] && return 1
994+
[[ $BUILD_EXCLUSIVE_KERNEL_MIN && "$(VER "$kernel_version")" < "$(VER "$BUILD_EXCLUSIVE_KERNEL_MIN")" ]] && return 1
995+
[[ $BUILD_EXCLUSIVE_KERNEL_MAX && "$(VER "$kernel_version")" > "$(VER "$BUILD_EXCLUSIVE_KERNEL_MAX")" ]] && return 1
996+
[[ $BUILD_EXCLUSIVE_ARCH && ! $arch =~ $BUILD_EXCLUSIVE_ARCH ]] && return 1
997+
998+
[[ ${BUILD_EXCLUSIVE_KERNEL[$module_index]} && ! $kernel_version =~ ${BUILD_EXCLUSIVE_KERNEL[$module_index]} ]] && return 1
999+
[[ ${BUILD_EXCLUSIVE_KERNEL_MIN[$module_index]} && "$(VER "$kernel_version")" < "$(VER "${BUILD_EXCLUSIVE_KERNEL_MIN[$module_index]}")" ]] && return 1
1000+
[[ ${BUILD_EXCLUSIVE_KERNEL_MAX[$module_index]} && "$(VER "$kernel_version")" > "$(VER "${BUILD_EXCLUSIVE_KERNEL_MAX[$module_index]}")" ]] && return 1
1001+
[[ ${BUILD_EXCLUSIVE_ARCH[$module_index]} && ! $arch =~ ${BUILD_EXCLUSIVE_ARCH[$module_index]} ]] && return 1
1002+
1003+
if [[ $BUILD_EXCLUSIVE_CONFIG && -e "${kernel_config}" ]]; then
1004+
local kconf
1005+
for kconf in $BUILD_EXCLUSIVE_CONFIG ; do
1006+
case "$kconf" in
1007+
!*) grep -q "^${kconf#!}=[ym]" "${kernel_config}" && return 1 ;;
1008+
*) grep -q "^${kconf}=[ym]" "${kernel_config}" || return 1 ;;
1009+
esac
1010+
done
1011+
fi
1012+
1013+
if [[ ${BUILD_EXCLUSIVE_CONFIG[$module_index]} && -e "${kernel_config}" ]]; then
1014+
local kconf
1015+
for kconf in ${BUILD_EXCLUSIVE_CONFIG[$module_index]} ; do
1016+
case "$kconf" in
1017+
!*) grep -q "^${kconf#!}=[ym]" "${kernel_config}" && return 1 ;;
1018+
*) grep -q "^${kconf}=[ym]" "${kernel_config}" || return 1 ;;
1019+
esac
1020+
done
1021+
fi
1022+
1023+
return 0
1024+
}
1025+
9821026
# Check if any module should be excluded from build
9831027
build_exclude=""
9841028
buildable_modules=0
@@ -1368,7 +1412,7 @@ do_build()
13681412
# Error out if source_tree is basically empty (binary-only dkms tarball w/ --force check)
13691413
# shellcheck disable=SC1083,SC2012
13701414
# TODO: use find instead of ls
1371-
(($(ls "$source_dir" | wc -l | awk {'print $1'}) < 2)) && die 8 \
1415+
(($(ls "$source_dir" | wc -l | awk '{print $1}') < 2)) && die 8 \
13721416
"The directory $source_dir does not appear to have module source located within it."\
13731417
"Build halted."
13741418

@@ -2226,7 +2270,7 @@ remove_module()
22262270
# Get rid of any remnant directories if necessary
22272271
# shellcheck disable=SC2012
22282272
# TODO: use find instead
2229-
if (($(ls "$dkms_tree/$module" | wc -w | awk {'print $1}') == 0)); then
2273+
if (($(ls "$dkms_tree/$module" | wc -w | awk '{print $1}') == 0)); then
22302274
rm -rf "${dkms_tree:?}/$module" 2>/dev/null
22312275
fi
22322276
}
@@ -2523,7 +2567,7 @@ make_tarball()
25232567
fi
25242568

25252569
# shellcheck disable=SC1083
2526-
if (( $(echo "$kernel_version_list" | wc -m | awk {'print $1'}) > 200 )); then
2570+
if (( $(echo "$kernel_version_list" | wc -m | awk '{print $1}') > 200 )); then
25272571
kernel_version_list="manykernels"
25282572
fi
25292573

@@ -2718,9 +2762,9 @@ run_match()
27182762
# Iterate over the kernel_status and match kernel to the template_kernel
27192763
while read -r template_line; do
27202764
# shellcheck disable=SC1083
2721-
template_module=$(echo "$template_line" | awk {'print $1'} | sed 's/,$//')
2765+
template_module=$(echo "$template_line" | awk '{print $1}' | sed 's/,$//')
27222766
# shellcheck disable=SC1083
2723-
template_version=$(echo "$template_line" | awk {'print $2'} | sed 's/,$//')
2767+
template_version=$(echo "$template_line" | awk '{print $2}' | sed 's/,$//')
27242768

27252769
# Print out a match header
27262770
echo "Module: $template_module"

0 commit comments

Comments
 (0)