925
924
run_build_script() {
926
925
# $1 = script type
927
926
# $2 = script to run
928
[[ $2 && -x $dkms_tree/$module/$module_version/source/${2%% *} ]] || return 0
930
echo $"Running the $1 script:"
931
$dkms_tree/$module/$module_version/source/$2
927
local script_type run
930
pre_build|post_build) script_type='build';;
931
*) script_type='source'
933
run="$dkms_tree/$module/$module_version/$script_type/$2"
934
if [[ -x ${run%% *} ]]; then
936
echo $"Running the $1 script:"
938
cd "$dkms_tree/$module/$module_version/$script_type/"
943
warn $"The $1 script is not executable."
934
947
# Register a DKMS-ified source tree with DKMS.
1164
1177
rm -rf "$dkms_tree/$module/$module_version/build"
1165
1178
cp -rf "$dkms_tree/$module/$module_version/source/" "$dkms_tree/$module/$module_version/build"
1167
# Run the pre_build script
1168
run_build_script pre_build "$pre_build"
1170
1180
cd "$dkms_tree/$module/$module_version/build"
1172
1182
# Apply any patches
1179
1189
report_build_problem 6 $"Application of patch $p failed." \
1180
1190
$"Check $dkms_tree/$module/$module_version/build/ for more information."
1193
# Run the pre_build script
1194
run_build_script pre_build "$pre_build"
1184
1197
# Build our previously prepared source tree. prepare_build must be called
3128
3141
# Walk through our list of installed and built modules, and create
3129
3142
# a list of modules that need to be reinstalled.
3130
3143
while read status mvka; do
3131
# if it has not been built, do not try and build it now.
3132
[[ $status = added ]] && continue
3133
IFS='/' read m v k a <<< "$mvka"
3134
[[ ! $last_m ]] && last_m="$m"
3135
# If the module is already installed or weak-installed, skip it.
3136
_is_module_installed "$m" "$v" "$kernelver" "$arch" && continue
3137
module_status_weak "$m" "$v" "$kernelver" "$arch" >/dev/null && continue
3138
# if the module does not want to be autoinstalled, skip it.
3139
read_conf_or_die "$k" "$a" "$dkms_tree/$m/$v/source/dkms.conf"
3140
if [[ ! $AUTOINSTALL ]]; then
3142
# otherwise, only autoinstall the latest version we have hanging around.
3143
elif [[ $last_m != $m ]]; then
3146
[[ $tenative ]] && to_install[${#to_install[@]}]="$tenative"
3148
elif [[ $last_m = $m && ($(VER $v) > $(VER $last_v)) ]]; then
3144
# if it has not been built, do not try and build it now.
3145
[[ $status = added ]] && continue
3146
IFS='/' read m v k a <<< "$mvka"
3147
[[ ! $last_m ]] && last_m="$m"
3148
# If the module is already installed or weak-installed, skip it.
3149
_is_module_installed "$m" "$v" "$kernelver" "$arch" && continue
3150
module_status_weak "$m" "$v" "$kernelver" "$arch" >/dev/null && continue
3151
# if the module does not want to be autoinstalled, skip it.
3152
read_conf_or_die "$k" "$a" "$dkms_tree/$m/$v/source/dkms.conf"
3153
if [[ ! $AUTOINSTALL ]]; then
3155
# otherwise, only autoinstall the latest version we have hanging around.
3156
elif [[ $last_m != $m ]]; then
3159
[[ $tenative ]] && to_install[${#to_install[@]}]="$tenative"
3162
if [[ ($(VER $v) > $(VER $last_v)) ]]; then
3152
3166
done < <(module_status)
3153
3167
# We may have exited the loop with $tenative set. If it is,
3154
3168
# it contains something that should be updated.
3156
3170
[[ $to_install ]] || return 0
3157
3171
# Install modules that need to be updated in parallel.
3158
3172
for mv in "${to_install[@]}"; do
3159
IFS=/ read m v <<< "$mv"
3160
(module="$m"; module_version="$v"; install_module) &
3173
IFS=/ read m v <<< "$mv"
3174
(module="$m"; module_version="$v"; install_module) &
3410
3424
--templatekernel*) read_arg template_kernel "$1" "$2" || shift;;
3411
3425
-c) read_arg conf "$1" "$2" || shift;;
3412
3426
--quiet|-q) exec >/dev/null 2>&1;;
3413
--version|-V) echo $"dkms: 2.2.0.1"
3427
--version|-V) echo $"dkms: 2.2.0.2"
3415
3429
--no-prepare-kernel) no_prepare_kernel="no-prepare-kernel";;
3416
3430
--no-clean-kernel) no_clean_kernel="no-clean-kernel";;