-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkmodtool-kmodtool
More file actions
552 lines (477 loc) · 18.2 KB
/
kmodtool-kmodtool
File metadata and controls
552 lines (477 loc) · 18.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
#!/bin/bash
# kmodtool - Helper script for building kernel module RPMs
# Copyright (c) 2003-2012 Ville Skyttä <ville.skytta@iki.fi>,
# Thorsten Leemhuis <fedora@leemhuis.info>
# Copyright (c) 2012-2019 Nicolas Chauvet <kwizart@gmail.com>
# Copyright (c) 2017-2018 Nicolas Viéville <nicolas.vieville@uphf.fr>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
shopt -s extglob
myprog="kmodtool-${repo}"
myver="0.12.1"
kmodname=
build_kernels="current"
kernels_known_variants=
kernel_versions=
kernel_versions_to_build_for=
prefix=
filterfile=
target=
error_out()
{
local errorlevel=${1}
shift
echo "Error: $@" >&2
# the next line is not multi-line safe -- not needed *yet*
echo "%global kmodtool_check echo \"kmodtool error: $@\"; exit ${errorlevel};"
exit ${errorlevel}
}
print_rpmtemplate_header()
{
echo
echo '%global kmodinstdir_prefix '${usr_lib_modules}/
echo '%global kmodinstdir_postfix '/extra/${kmodname}/
echo '%global kernel_versions '${kernel_versions}
echo '%global debug_package %{nil}'
echo
}
print_akmodtemplate ()
{
echo
cat <<EOF
%global akmod_install mkdir -p \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/; \\\
rpmbuild --define "_sourcedir %{_sourcedir}" \\\
--define "_srcrpmdir \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/" \\\
%{?dist:--define 'dist %{dist}}' \\\
-bs --nodeps %{_specdir}/%{name}.spec ; \\\
ln -s \$(ls \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/) \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/${kmodname}-kmod.latest
%package -n akmod-${kmodname}
Summary: Akmod package for ${kmodname} kernel module(s)
Requires: kmodtool
Requires: akmods
%{?AkmodsBuildRequires:Requires: %{AkmodsBuildRequires}}
# same requires and provides as a kmods package would have
Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version}
Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
EOF
if [[ ${obsolete_name} ]] ; then
echo "Provides: akmod-${obsolete_name} = ${obsolete_version}"
echo "Obsoletes: akmod-${obsolete_name} < ${obsolete_version}"
fi
cat <<EOF
%description -n akmod-${kmodname}
This package provides the akmod package for the ${kmodname} kernel modules.
%posttrans -n akmod-${kmodname}
nohup /usr/sbin/akmods --from-akmod-posttrans --akmod ${kmodname} &> /dev/null &
%post -n akmod-${kmodname}
[ -x /usr/sbin/akmods-ostree-post ] && /usr/sbin/akmods-ostree-post ${kmodname} %{_usrsrc}/akmods/${kmodname}-kmod-%{version}-%{release}.src.rpm
%files -n akmod-${kmodname}
%defattr(-,root,root,-)
%{_usrsrc}/akmods/*
EOF
}
print_akmodmeta ()
{
cat <<EOF
%package -n kmod-${kmodname}
Summary: Metapackage which tracks in ${kmodname} kernel module for newest kernel${dashvariant}
Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: kmod-${kmodname}-xen = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: kmod-${kmodname}-smp = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: kmod-${kmodname}-PAE = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: akmod-${kmodname} = %{?epoch:%{epoch}:}%{version}-%{release}
EOF
if [[ ${obsolete_name} ]] ; then
echo "Provides: kmod-${obsolete_name} = ${obsolete_version}"
echo "Obsoletes: kmod-${obsolete_name} < ${obsolete_version}"
fi
cat <<EOF
%description -n kmod-${kmodname}${dashvariant}
This is a meta-package without payload which sole purpose is to require the
${kmodname} kernel module(s) for the newest kernel${dashvariant},
to make sure you get it together with a new kernel.
%files -n kmod-${kmodname}${dashvariant}
%defattr(644,root,root,755)
EOF
}
print_rpmtemplate_per_kmodpkg ()
{
if [[ "${1}" == "--custom" ]] ; then
shift
local customkernel=true
elif [[ "${1}" == "--redhat" ]] ; then
# this is needed for akmods
shift
local redhatkernel=true
fi
## Build some interesting strings with kernel uname -r
## Examples:
## kernel_uname_r 3.10.0-693.2.2.el7.x86_64
## kernel_uname_r_short 3.10.0-693.el7
local kernel_uname_r=${1}
local kernel_uname_r_short=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\1-\2\4/")
if [[ -h /sbin ]] ; then
echo '%global _prefix_usr '/usr
fi
# first part
cat <<EOF
%if 0%{?rhel}
%package -n kmod-${kmodname}
Summary: ${kmodname} kernel module(s) for ${kernel_uname_r_short}
Provides: kernel-modules = ${kernel_uname_r}
Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version}
Requires(post): %{?_prefix_usr}/sbin/weak-modules
Requires(post): %{?_prefix_usr}/sbin/depmod
Requires(postun): %{?_prefix_usr}/sbin/weak-modules
Requires(postun): %{?_prefix_usr}/sbin/depmod
%else
%package -n kmod-${kmodname}-${kernel_uname_r}
Summary: ${kmodname} kernel module(s) for ${kernel_uname_r}
Provides: kernel-modules-for-kernel = ${kernel_uname_r}
Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version}
Requires(post): %{?_prefix_usr}/sbin/depmod
Requires(postun): %{?_prefix_usr}/sbin/depmod
%endif
EOF
if [[ ${obsolete_name} ]] ; then
echo
echo "Provides: kmod-${obsolete_name}-${kernel_uname_r} = ${obsolete_version}"
echo "Obsoletes: kmod-${obsolete_name}-${kernel_uname_r} < ${obsolete_version}"
fi
# second part
if [[ ! "${customkernel}" ]] ; then
## Build some interesting strings with kernel uname -r
## Examples:
## kernel_uname_r_wo_arch 3.10.0-693.2.2.el7
## kernel_uname_r_dist el7
## kernel_uname_r_rel 693
## kernel_uname_r_rel_plus_one 694
## kernel_uname_r_short_plus_one 3.10.0-694.el7
## kernel_uname_r_rel_minor 2.2
local kernel_uname_r_wo_arch=$(echo ${1} | sed -e "s/\.${target}//")
local kernel_uname_r_dist=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\4/" -e "s/^\.//")
local kernel_uname_r_rel=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\2/" -e "s/^\.//")
local kernel_uname_r_rel_plus_one=$(( kernel_uname_r_rel+1 ))
local kernel_uname_r_short_plus_one=$(echo ${kernel_uname_r_short} | sed -e "s/(//" -e "s/-${kernel_uname_r_rel}\./-${kernel_uname_r_rel_plus_one}\./")
local kernel_uname_r_rel_minor=$(echo ${1} | sed -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\3/" -e "s/^\.//")
cat <<EOF
%global _kmodtool_depmod_post \\\
if [ -f /boot/System.map-${kernel_uname_r} ] ; then \\\
%{?_prefix_usr}/sbin/depmod -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} >/dev/null ; \\\
elif [ -f /lib/modules/${kernel_uname_r}/System.map ] ; then \\\
%{?_prefix_usr}/sbin/depmod -aeF /lib/modules/${kernel_uname_r}/System.map ${kernel_uname_r} >/dev/null ; \\\
else \\\
%{?_prefix_usr}/sbin/depmod -a >/dev/null ; \\\
fi || :
%if 0%{?rhel}
Requires: kernel >= ${kernel_uname_r_short}
Requires: kernel < ${kernel_uname_r_short_plus_one}
BuildRequires: kernel-devel = ${kernel_uname_r_wo_arch} redhat-rpm-config kernel-abi-whitelists
%post -n kmod-${kmodname}
%{_kmodtool_depmod_post}
modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ | grep -e '\.ko$') )
printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules
%preun -n kmod-${kmodname}
rpm -ql kmod-${kmodname}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules
%postun -n kmod-${kmodname}
%{_kmodtool_depmod_post}
modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) )
rm /var/run/rpm-kmod-${kmodname}-modules
printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules
%else
Requires: kernel-uname-r = ${kernel_uname_r}
BuildRequires: kernel-devel-uname-r = ${kernel_uname_r}
BuildRequires: gcc
%post -n kmod-${kmodname}-${kernel_uname_r}
%{_kmodtool_depmod_post}
%postun -n kmod-${kmodname}-${kernel_uname_r}
%{_kmodtool_depmod_post}
%endif
EOF
else
cat <<EOF
%if 0%{?rhel}
%post -n kmod-${kmodname}
[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || :
if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then
modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ | grep -e '\.ko$') )
printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules
fi
%preun -n kmod-${kmodname}
if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then
rpm -ql kmod-${kmodname}-%{version}-%{release}.$(arch) | grep -e '\.ko$' > /var/run/rpm-kmod-${kmodname}-modules
fi
%postun -n kmod-${kmodname}
[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || :
if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then
modules=( \$(cat /var/run/rpm-kmod-${kmodname}-modules) )
rm /var/run/rpm-kmod-${kmodname}-modules
printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules
fi
%else
%post -n kmod-${kmodname}-${kernel_uname_r}
[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || :
%postun -n kmod-${kmodname}-${kernel_uname_r}
[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || :
%endif
EOF
fi
# third part
cat <<EOF
%if 0%{?rhel}
%description -n kmod-${kmodname}
This package provides the ${kmodname} kernel modules built for the Linux
kernel ${kernel_uname_r_short} for the %{_target_cpu} family of processors.
%files -n kmod-${kmodname}
%defattr(644,root,root,755)
%dir ${usr_lib_modules}/${kernel_uname_r}/extra
${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/
%else
%description -n kmod-${kmodname}-${kernel_uname_r}
This package provides the ${kmodname} kernel modules built for the Linux
kernel ${kernel_uname_r} for the %{_target_cpu} family of processors.
%files -n kmod-${kmodname}-${kernel_uname_r}
%defattr(644,root,root,755)
%dir ${usr_lib_modules}/${kernel_uname_r}/extra
${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/
%endif
EOF
}
print_rpmtemplate_kmodmetapkg ()
{
local kernel_uname_r=${1}
local kernel_variant="${2:+-${2}}"
cat <<EOF
%package -n kmod-${kmodname}${kernel_variant}
Summary: Metapackage which tracks in ${kmodname} kernel module for newest kernel${kernel_variant}
Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: kmod-${kmodname}-${kernel_uname_r} >= %{?epoch:%{epoch}:}%{version}-%{release}
EOF
if [[ ${obsolete_name} ]] ; then
echo "Provides: kmod-${obsolete_name}${kernel_variant} = ${obsolete_version}"
echo "Obsoletes: kmod-${obsolete_name}${kernel_variant} < ${obsolete_version}"
fi
cat <<EOF
%description -n kmod-${kmodname}${kernel_variant}
This is a meta-package without payload which sole purpose is to require the
${kmodname} kernel module(s) for the newest kernel${kernel_variant}.
to make sure you get it together with a new kernel.
%files -n kmod-${kmodname}${kernel_variant}
%defattr(644,root,root,755)
EOF
}
print_customrpmtemplate ()
{
for kernel in ${1}
do
if [[ -e "/usr/src/kernels/${kernel}" ]] ; then
# this looks like a Fedora/RH kernel -- print a normal template (which includes the proper BR) and be happy :)
kernel_versions="${kernel_versions}${kernel}___%{_usrsrc}/kernels/${kernel} "
# parse kernel versions string and print template
local kernel_verrelarch=${kernel%%${kernels_known_variants}}
print_rpmtemplate_per_kmodpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
elif [[ -e "${usr_lib_modules}"/"${kernel}"/build/Makefile ]] ; then
# likely a user-build-kernel with available buildfiles
# fixme: we should check if uname from Makefile is the same as ${kernel}
kernel_versions="${kernel_versions}${kernel}___${usr_lib_modules}/${kernel}/build/ "
print_rpmtemplate_per_kmodpkg --custom "${kernel}"
else
error_out 2 "Don't know how to handle ${kernel} -- ${usr_lib_modules}/${kernel}/build/Makefile not found"
fi
done
# well, it's no header anymore, but who cares ;-)
print_rpmtemplate_header
}
print_rpmtemplate ()
{
# create kernel_versions var
for kernel_version in ${kernel_versions_to_build_for}
do
kernel_versions="${kernel_versions}${kernel_version}___%{_usrsrc}/kernels/${kernel_version} "
done
# and print it and some other required stuff as macro
print_rpmtemplate_header
# now print the packages itselfs
for kernel in ${kernel_versions_to_build_for} ; do
local kernel_verrelarch=${kernel%%${kernels_known_variants}}
# create metapackage
print_rpmtemplate_kmodmetapkg ${kernel} ${kernel##${kernel_verrelarch}}
# create package
print_rpmtemplate_per_kmodpkg ${kernel} ${kernel##${kernel_verrelarch}}
done
}
myprog_help ()
{
echo "Usage: $(basename ${0}) [OPTIONS]"
echo $'\n'"Creates a template to be used during kmod building"
echo $'\n'"Available options:"
# FIXME echo " --datadir <dir> -- look for our shared files in <dir>"
echo " --filterfile <file> -- filter the results with grep --file <file>"
echo " --for-kernels <list> -- created templates only for these kernels"
echo " --kmodname <file> -- name of the kmod (required)"
echo " --noakmod -- no akmod package"
echo " --repo <name> -- use buildsys-build-<name>-kerneldevpkgs"
echo " --target <arch> -- target-arch (required)"
}
while [ "${1}" ] ; do
case "${1}" in
--filterfile)
shift
if [[ ! "${1}" ]] ; then
error_out 2 "Please provide path to a filter-file together with --filterfile" >&2
elif [[ ! -e "${1}" ]] ; then
error_out 2 "Filterfile ${1} not found" >&2
fi
filterfile="${1}"
shift
;;
--kmodname)
shift
if [[ ! "${1}" ]] ; then
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
fi
# strip pending -kmod
kmodname="${1%%-kmod}"
shift
;;
--repo)
shift
if [[ ! "${1}" ]] ; then
error_out 2 "Please provide the name of the repo together with --repo" >&2
fi
repo=${1}
shift
;;
--for-kernels)
shift
if [[ ! "${1}" ]] ; then
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
fi
for_kernels="${1}"
shift
;;
--noakmod)
shift
noakmod="true"
;;
--obsolete-name)
shift
if [[ ! "${1}" ]] ; then
error_out 2 "Please provide the name of the kmod to obsolte together with --obsolete-name" >&2
fi
obsolete_name="${1}"
shift
;;
--obsolete-version)
shift
if [[ ! "${1}" ]] ; then
error_out 2 "Please provide the version of the kmod to obsolte together with --obsolete-version" >&2
fi
obsolete_version="${1}"
shift
;;
--target)
shift
target="${1}"
shift
;;
--akmod)
shift
build_kernels="akmod"
;;
--newest)
shift
build_kernels="newest"
;;
--current)
shift
build_kernels="current"
;;
--help)
myprog_help
exit 0
;;
--version)
echo "${myprog} ${myver}"
exit 0
;;
*)
echo "Error: Unknown option '${1}'." >&2
usage >&2
exit 2
;;
esac
done
if [[ -h /lib ]] ; then
usr_lib_modules=/usr/lib/modules
else
usr_lib_modules=/lib/modules
fi
if [[ -e ./kmodtool-kernel-variants ]] ; then
kernels_known_variants="$(cat ./kmodtool-kernel-variants)"
elif [[ -e /usr/share/kmodtool/kernel-variants ]] ; then
kernels_known_variants="$(cat /usr/share/kmodtool/kernel-variants)"
else
error_out 2 "Could not find /usr/share/kmodtool/kernel-variants"
fi
# general sanity checks
if [[ ! "${target}" ]] ; then
error_out 2 "please pass target arch with --target"
elif [[ ! "${kmodname}" ]] ; then
error_out 2 "please pass kmodname with --kmodname"
elif [[ ! "${kernels_known_variants}" ]] ; then
error_out 2 "could not determine known variants"
elif ( [[ "${obsolete_name}" ]] && [[ ! "${obsolete_version}" ]] ) || ( [[ ! "${obsolete_name}" ]] && [[ "${obsolete_version}" ]] ) ; then
error_out 2 "you need to provide both --obsolete-name and --obsolete-version"
fi
# go
if [[ "${for_kernels}" ]] ; then
# this is easy:
print_customrpmtemplate "${for_kernels}"
elif [[ "${build_kernels}" == "akmod" ]] ; then
# do only a akmod package
print_akmodtemplate
print_akmodmeta
else
# seems we are on out own to decide for which kernels to build
# we need more sanity checks in this case
if [[ ! "${repo}" ]] ; then
error_out 2 "please provide repo name with --repo"
elif ! $(which buildsys-build-${repo}-kerneldevpkgs &> /dev/null) ; then
error_out 2 "buildsys-build-${repo}-kerneldevpkgs not found"
fi
# call buildsys-build-${repo}-kerneldevpkgs to get the list of kernels
cmdoptions="--target ${target}"
# filterfile to filter list of kernels?
if [[ "${filterfile}" ]] ; then
cmdoptions="${cmdoptions} --filterfile ${filterfile}"
fi
kernel_versions_to_build_for="$(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})"
returncode=$?
if (( ${returncode} != 0 )) ; then
error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: $(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})"
fi
if [[ "${build_kernels}" == "current" ]] && [[ ! "${noakmod}" ]] ; then
print_akmodtemplate
fi
print_rpmtemplate
fi