From b8a8b20588e4cff6c5ca64034ddf7d8ee103c7aa Mon Sep 17 00:00:00 2001 From: Marcel Hetzendorfer Date: Wed, 10 Apr 2024 09:57:11 +0200 Subject: [PATCH 01/29] Show building and installing on plymouth boot screen --- akmods | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/akmods b/akmods index 758fdf9..a5787b4 100644 --- a/akmods +++ b/akmods @@ -47,6 +47,39 @@ verboselevel=2 # So we always retry anyway alwaystry=1 +# Check Running plymouth +no_plymouth=1 +last_message="" + +function check_plymouth() { + which plymouth > /dev/null 2> /dev/null + if [[ $? -eq 1 ]] + then + no_plymouth=1 + return 0 + fi + + plymouth --ping + no_plymouth=$? +} + +# new or del, msg +akmods_echo_plymouth(){ + if [[ $no_plymouth -eq 0 ]] + then + if [[ $1 -eq 1 ]] + then + plymouth display-message --text="$2" + last_message=$2 + else + if [ -z "${last_message}" ]; then + plymouth hide-message --text="$last_message" & + last_message="" + fi + fi + fi +} + akmods_echo() { # where to output @@ -327,6 +360,7 @@ buildinstall_kmod() unset TMPDIR # build module using akmod + akmods_echo_plymouth 1 "akmod: Building ${this_kmodsrpm}..." akmods_echo 1 4 "Building RPM using the command '/usr/sbin/akmodsbuild --kernels ${this_kernelver} ${this_kmodsrpm}'" /sbin/runuser -s /bin/bash -c "/usr/sbin/akmodsbuild --quiet --kernels ${this_kernelver} --outputdir ${tmpdir}results --logfile ${tmpdir}/akmodsbuild.log ${this_kmodsrpm}" akmods >> "${kmodlogfile}" 2>&1 local returncode=$? @@ -341,6 +375,10 @@ buildinstall_kmod() if [[ -n "${continue_line}" ]] ; then akmods_echo 1 2 --failure fi + + akmods_echo_plymouth 0 "" + akmods_echo_plymouth 1 "akmod: Building ${this_kmodsrpm} failed!" + sleep 5 akmods_echo 2 1 "Building rpms failed; see /var/cache/akmods/${this_kmodname}/${this_kmodverrel}-for-${this_kernelver}.failed.log for details" cp -fl "${kmodlogfile}" "/var/cache/akmods/${this_kmodname}/${this_kmodverrel}-for-${this_kernelver}.failed.log" kmodlogfile="" @@ -349,6 +387,9 @@ buildinstall_kmod() fi # dnf/yum install - repository disabled on purpose see rfbz#3350 + + akmods_echo_plymouth 0 "" + akmods_echo_plymouth 1 "akmod: Installing ${this_kmodsrpm}..." akmods_echo 1 4 "Installing newly built rpms" if [[ -f /usr/bin/dnf ]] ; then akmods_echo 1 4 "DNF detected" @@ -367,6 +408,10 @@ buildinstall_kmod() if [[ -n "${continue_line}" ]] ; then akmods_echo 1 2 --failure fi + + akmods_echo_plymouth 0 "" + akmods_echo_plymouth 1 "akmod: Installing ${this_kmodsrpm} failed!" + sleep 5 akmods_echo 2 1 "Could not install newly built RPMs. You can find them and the logfile in:" akmods_echo 2 1 "/var/cache/akmods/${this_kmodname}/${this_kmodverrel}-for-${this_kernelver}.failed.log" cp -fl "${kmodlogfile}" "/var/cache/akmods/${this_kmodname}/${this_kmodverrel}-for-${this_kernelver}.failed.log" @@ -381,6 +426,8 @@ buildinstall_kmod() kmodlogfile="" remove_tmpdir + akmods_echo_plymouth 0 "" + return 0 } @@ -625,6 +672,7 @@ while [ "${1}" ] ; do esac done +check_plymouth # sanity checks init From 917aa4c5507043de97d3fcd28d43a852c5538833 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 10:46:20 +0000 Subject: [PATCH 02/29] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From e4a63b2938ebb529b56d9be3a2f24df21a3d1412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 11 Feb 2025 14:36:17 +0100 Subject: [PATCH 03/29] Add sysusers.d config file to allow rpm to create users/groups automatically See https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers. --- akmods.spec | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/akmods.spec b/akmods.spec index e3de822..6ed6a9a 100644 --- a/akmods.spec +++ b/akmods.spec @@ -68,7 +68,6 @@ Suggests: (kernel-devel if kernel-core) Suggests: (kernel-rt-devel if kernel-rt) # we create a special user that used by akmods to build kmod packages -Requires(pre): shadow-utils # systemd unit requirements. BuildRequires: systemd @@ -94,6 +93,11 @@ after they were installed. %setup -q -c -T cp -p %{SOURCE9} %{SOURCE10} %{SOURCE15} . +# Create a sysusers.d config file +cat >akmods.sysusers.conf </dev/null || groupadd -r akmods -getent passwd akmods >/dev/null || \ -useradd -r -g akmods -d /var/cache/akmods/ -s /sbin/nologin \ - -c "User is used by akmods to build akmod packages" akmods %post %systemd_post akmods.service @@ -197,6 +197,7 @@ useradd -r -g akmods -d /var/cache/akmods/ -s /sbin/nologin \ %dir %attr(-,akmods,akmods) %{_localstatedir}/cache/akmods %dir %attr(0775,root,akmods) %{_localstatedir}/log/%{name} %{_mandir}/man1/* +%{_sysusersdir}/akmods.conf %changelog From b33fbe9087a7fadee214814e43fa9b8e9251eb32 Mon Sep 17 00:00:00 2001 From: Leigh Scott Date: Sat, 3 May 2025 20:07:50 +0100 Subject: [PATCH 04/29] Fix changelog --- changelog | 376 ++++++++++++++++++++++++------------------------------ 1 file changed, 169 insertions(+), 207 deletions(-) diff --git a/changelog b/changelog index 5a64c5b..6bcb2f2 100644 --- a/changelog +++ b/changelog @@ -1,216 +1,178 @@ +* Fri May 02 2025 Marcel Hetzendorfer - 0.6.0-11 +- Show building and installing on plymouth boot screen + +* Tue Feb 11 2025 Zbigniew Jędrzejewski-Szmek - 0.6.0-10 +- Add sysusers.d config file to allow rpm to create users/groups + automatically + +* Thu Jan 16 2025 Fedora Release Engineering - 0.6.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Wed Dec 11 2024 Nicolas Chauvet - 0.6.0-8 +- Update others hostname occurences + +* Tue Dec 10 2024 Nicolas Chauvet - 0.6.0-7 +- Drop hostname deps - rhbz#2330137 + +* Thu Nov 28 2024 Nicolas Chauvet - 0.6.0-6 +- Validate or discard default_kernel - rhbz#2270414 + +* Fri Nov 08 2024 Nicolas Chauvet - 0.6.0-5 +- Fix KEYNAME lengh - rhbz#2323702 + +* Wed Oct 02 2024 Rohan Barar - 0.6.0-4 +- Add robust missing key pair logic + +* Wed Oct 02 2024 Rohan Barar - 0.6.0-3 +- Improved error handling + Bug fixes + +* Tue Oct 01 2024 Rohan Barar - 0.6.0-2 +- Add check for elevated privileges + +* Tue Oct 01 2024 Nicolas Chauvet - 0.6.0-1 +- Bump akmods version + +* Tue Oct 01 2024 Nicolas Chauvet - 0.5.10-30 +- Remove duplicate akmodsposttrans call - rhbz#2011120 + +* Thu Sep 26 2024 Rohan Barar - 0.5.10-29 +- Avoid double error on empty user-provided key pair name. + +* Thu Sep 26 2024 Rohan Barar - 0.5.10-28 +- Corrected erroneous code introduced in previous commits. + +* Thu Sep 26 2024 Rohan Barar - 0.5.10-27 +- Fixed typo 'if' to 'fi'. + +* Thu Sep 26 2024 Rohan Barar - 0.5.10-26 +- Added check for existing key pair with same name as user-specified new + key pair name. + +* Thu Sep 26 2024 Rohan Barar - 0.5.10-25 +- Added ability for user to name key pair. + +* Sun Sep 22 2024 Rohan Barar - 0.5.10-24 +- Introduced loop to gracefully handle extremely rare key pair name + collision events. + +* Sat Sep 21 2024 Rohan Barar - 0.5.10-23 +- Refactor key pair naming scheme to enhance robustness + Removed collision + check and key pair backup function due to bug with ':' in file names + alongside superfluous nature of function given improved naming scheme. + +* Sat Sep 21 2024 Rohan Barar - 0.5.10-22 +- Removed 'sudo' prefixes as per request in PR #23. + +* Sat Sep 21 2024 Rohan Barar - 0.5.10-21 +- Further improvements to argument parsing logic. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-20 +- Improved clarity of exit status code comments. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-19 +- Revert "Utilise robust shebang." as per request on PR #23. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-18 +- Added support for combined single-letter arguments + Chowned symlinks. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-17 +- Improved mokutil error handling + Added sudo prefixes. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-16 +- Added error handling for failed cacert modification. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-15 +- Whitespace changes for consistency. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-14 +- Extract functions to enhance readability + Set 'commonName' to match + 'KEYNAME'. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-13 +- Added logic to detect broken existing key pairs. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-12 +- Improved user feedback in event of existing key pair. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-11 +- Updated copyright information. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-10 +- Various changes to avoid ShellCheck warnings. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-9 +- Align license to 80 character width. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-8 +- Utilise robust shebang. + +* Fri Sep 20 2024 Rohan Barar - 0.5.10-7 +- Removed hard-coded paths. + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.10-6 +- Fix parsing multiple kernel + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.10-5 +- Use check_kernel_devel return code as appropriate + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.10-4 +- Change check_kernel_devel() to return instead of exit + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.10-3 +- akmods --from-init only operates on current kernel + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.10-2 +- Deprecate akmods-shutdown script + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.10-1 +- Bump to akmods 0.5.10 + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.9-8 +- Only check for default_kernel is no value - rhbz#2293047 + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.9-7 +- Revert "Call Init before the argument parser" + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.9-6 +- Switch to use sdubby alternatives to grubby + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.9-5 +- Drop older rhel and use -core + +* Fri Aug 23 2024 Nicolas Chauvet - 0.5.9-4 +- Drop older rhel cases + +* Mon Aug 19 2024 Jonathan Wakely - 0.5.9-3 +- Fix bug URLs in man page + +* Wed Jul 17 2024 Fedora Release Engineering - 0.5.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Thu Jul 04 2024 Nicolas Chauvet - 0.5.9-1 +- akmods release 0.5.9 + +* Thu Jul 04 2024 Hans de Goede - 0.5.8-10 +- Fix intel-ipu6-kmod installation with kernel >= 6.10 + +* Thu Jul 04 2024 Marius Schwarz - 0.5.8-9 +- Call Init before the argument parser + +* Mon Jan 22 2024 Fedora Release Engineering - 0.5.8-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering - 0.5.8-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Tue Dec 05 2023 Nicolas Chauvet - 0.5.8-6 +- Workaround for rhbz#1889136 when localpkg_gpgcheck=True + * Wed Jul 19 2023 Fedora Release Engineering - 0.5.8-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild -* Fri May 5 2023 Nicolas Chauvet - 0.5.8-1 +* Fri May 05 2023 Nicolas Chauvet - 0.5.8-1 - Don't emit weak-deps from deprecated arches on all - Allow akmods --rebuild to force rebuild+reinstall - rhbz#2140012 - ensure to build for grub or systemd-boot default kernel - rhbz#2124086 - Drop "which" as akmods dependency -* Wed Jan 18 2023 Fedora Release Engineering - 0.5.7-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild -* Wed Jul 20 2022 Fedora Release Engineering - 0.5.7-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Wed May 04 2022 Nicolas Chauvet - 0.5.7-8 -- Fix logrotate permission access to /var/log/akmods directory - rhbz#2078490 -- Rename logrotate config file - -* Wed Mar 09 2022 Timothée Ravier - 0.5.7-7 -- Use 'Require' instead of 'Suggest' for kernel*-devel packages. - -* Thu Jan 27 2022 Nicolas Viéville - 0.5.7-6 -- Adapt usage of lockfile to systemd-tmpfiles -- Re-locate akmods logs in /var/log - -* Wed Jan 26 2022 Timothée Ravier - 0.5.7-5 -- Use kernel*-core variants in conditional Suggests - -* Wed Jan 19 2022 Fedora Release Engineering - 0.5.7-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Mon Dec 20 2021 Nicolas Chauvet - 0.5.7-3 -- Drop perl-interpeter -- Drop akmodsinit -- Only use preset on rhel -- kernel-devel-matched support - see also https://src.fedoraproject.org/rpms/akmods/pull-request/7 - -* Fri Dec 10 2021 Nicolas Chauvet - 0.5.7-2 -- Bump kmodtool requirement -- Rename kABI list -- Drop EL6 support -- Switch to distro agnostic deps - -* Fri Oct 22 2021 Nicolas Viéville - 0.5.7-1 -- Add local akmods CA signing keys and support tools to sign modules for - Secure boot thanks to Stanislas Leduc -- Add akmods-keygen service to generate MOK key pair on first run - -* Fri Oct 22 2021 Nicolas Viéville - 0.5.6-29 -- Remove trailing spaces and clean-up -- Use %%{name} when possible -- Convert if statement from "[!] $variable" to "[!] -n $variable" -- Fix kernel list build when parsing command line options -- Ensure to build for grub default kernel -- Improve detection of already installed (weak-)modules in akmods (RHEL) -- akmods uses logrotate and clean-up /var/cache/akmods sub-directories of - old logs and rpm files from no more installed kmod packages - (rhbz #1542658). - -* Wed Jul 21 2021 Fedora Release Engineering - 0.5.6-28 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Mon Jan 25 2021 Fedora Release Engineering - 0.5.6-27 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Mon Jul 27 2020 Fedora Release Engineering - 0.5.6-26 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Tue Jan 28 2020 Fedora Release Engineering - 0.5.6-25 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Wed Nov 20 2019 Nicolas Viéville - 0.5.6-24 -- Check kernel presence differently for systemd-boot machines - rhbz#1769144 - -* Wed Oct 16 2019 Leigh Scott - 0.5.6-23 -- Add requires kernel-abi-whitelists for RHEL - -* Wed Jul 24 2019 Fedora Release Engineering - 0.5.6-22 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Mon May 20 2019 Nicolas Chauvet - 0.5.6-21 -- Add check for rhel8 - -* Wed May 15 2019 Nicolas Viéville - 0.5.6-20 -- Fix akmodsposttrans after kernel update/install on Fedora >= 28 and - RHEL >= 7 - rhbz#1709055 - -* Thu Feb 28 2019 Alexander Larsson - 0.5.6-19 -- Support ostree/silverblue builds - rhbz#1667014 - -* Thu Feb 28 2019 Hans de Goede -- Do not fail when the old initscripts pkg is not installed - rhbz#1680121 - -* Thu Jan 31 2019 Fedora Release Engineering - 0.5.6-18 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Mon Nov 05 2018 Nicolas Chauvet - 0.5.6-17 -- Don't enforce target arch - rhbz#1644430 -- Rework log file path -- Avoid using /usr/lib/modules for el6 compat - -* Thu Jul 12 2018 Fedora Release Engineering - 0.5.6-16 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Mon Mar 26 2018 Nicolas Chauvet - 0.5.6-15 -- Add inihibitor for akmods@.service -- Use restart on akmodsposttrans - -* Mon Mar 26 2018 Nicolas Chauvet - 0.5.6-14 -- Switch to always retry by default -- Drop akmods preset by f28 -- Don't enable service on ah -- Test a rw directory - -* Wed Feb 07 2018 Fedora Release Engineering - 0.5.6-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Wed Dec 13 2017 Nicolas Chauvet - 0.5.6-12 -- Update kernel posttrans method - rhbz#1518401 - -* Thu Aug 03 2017 Nicolas Chauvet - 0.5.6-11 -- Rework kernel-devel requires on el - -* Thu Aug 03 2017 Nicolas Chauvet - 0.5.6-10 -- Enable suggests on fedora -- Add back el6 support in spec -- Add Requires elfutils-libelf-devel - -* Wed Jul 26 2017 Fedora Release Engineering - 0.5.6-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Thu Jul 13 2017 Petr Pisar - 0.5.6-8 -- perl dependency renamed to perl-interpreter - - -* Thu May 4 2017 Hans de Goede - 0.5.6-7 -- "udevadm trigger" may have bad side-effects (rhbz#454407) instead - look for modalias files under /sys/devices and call modprobe directly -- Fix exit status when no akmod packages are installed, so that systemd - does not consider the akmods.service as having failed to start - -* Wed May 3 2017 Hans de Goede - 0.5.6-6 -- Run "udevadm trigger" and "systemctl restart systemd-modules-load.service" - when new kmod packages have been build and installed so that the new - modules may be used immediately without requiring a reboot - -* Mon Mar 6 2017 Hans de Goede - 0.5.6-5 -- Add LICENSE file (rhbz#1422918) - -* Fri Feb 24 2017 Hans de Goede - 0.5.6-4 -- Replace %%{_prefix}/lib/systemd/system-preset with %%{_presetdir} - -* Thu Feb 16 2017 Hans de Goede - 0.5.6-3 -- Submit to Fedora for package review - -* Mon Nov 28 2016 Nicolas Chauvet - 0.5.6-2 -- Use Suggests kernel-devel weak-dependency - see rfbz#3386 - -* Fri Oct 14 2016 Richard Shaw - 0.5.6-1 -- Disable shutdown systemd service file by default. -- Remove modprobe line from main service file. - -* Wed Aug 17 2016 Sérgio Basto - 0.5.4-3 -- New release - -* Sun Jan 03 2016 Nicolas Chauvet - 0.5.4-2 -- Revert conflicts kernel-debug-devel - -* Thu Jul 23 2015 Richard Shaw - 0.5.4-1 -- Do not mark a build as failed when only installing the RPM fails. -- Run akmods-shutdown script instead of akmods on shutdown. -- Add systemd preset file to enable services by default. - -* Wed Jul 15 2015 Richard Shaw - 0.5.3-2 -- Add package conflicts to stop pulling in kernel-debug-devel, fixes BZ#3386. -- Add description for the formatting of the parameter, BZ#3580. -- Update static man pages and clean them up. -- Fixed another instance of TMPDIR causing issues. -- Added detection of dnf vs yum to akmods, fixed BZ#3481. - -* Wed Apr 1 2015 Richard Shaw - 0.5.2-1 -- Fix temporary directory creation when TMPDIR environment variable is set, - fixes BZ#2596. -- Update systemd scripts to use macros. -- Fix akmods run on shutdown systemd unit file, fixes BZ#3503. - -* Sun Nov 16 2014 Nicolas Chauvet - 0.5.1-4 -- Fix akmods on armhfp - rfbz#3117 -- Use yum instead of rpm to install packages - rfbz#3350 - Switch to a better date format - -* Fri Jan 11 2013 Richard Shaw - 0.5.1-3 -- Really fix akmods.service.in. - -* Fri Jun 01 2012 Richard Shaw - 0.5.1-2 -- Add service file to run again on shutdown. -- Add conditional for Fedora 18 to specify correct systemd graphical service. - -* Thu Apr 12 2012 Nicolas Chauvet - 0.4.0-4 -- Rebuilt - -* Tue Mar 20 2012 Richard Shaw - 0.4.0-3 -- Add additional error output if the needed kernel development files are not - installed. (Fixes #561) - -* Mon Mar 05 2012 Richard Shaw - 0.4.0-2 -- Remove remaining references to previous Fedora releases -- Remove legacy SysV init script from CVS. -- Added man page for akmods and cleaned up man page for akmodsbuild. - -* Tue Feb 07 2012 Nicolas Chauvet - 0.4.0-1 -- Update for UsrMove support -- Remove unused references to older fedora -- Change Requires from kernel-devel to kernel-devel-uname-r From c2d86c5f1c8e33a8e792b8b4431b511cbc102ca4 Mon Sep 17 00:00:00 2001 From: Leigh Scott Date: Sat, 3 May 2025 20:22:50 +0100 Subject: [PATCH 05/29] Fix changelog From f3b30d28b67cd9ac2da54bbe92e724b65d889e2a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 16:51:16 +0000 Subject: [PATCH 06/29] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 9b91b410e792a804c65b197cdf82b94df229f7ff Mon Sep 17 00:00:00 2001 From: Daniel Hast Date: Tue, 2 Sep 2025 20:03:29 -0400 Subject: [PATCH 07/29] fix: apply shellcheck recommendations Ran ShellCheck against the akmods shell scripts and applied most of the recommendations, which addresses a number of subtle issues with shell script functionality. These changes shouldn't have any impact on script behavior, but improve clarity or avoid potential unexpected behavior (such as quoting variable expansions to avoid unintended shell splitting/globbing). Signed-off-by: Daniel Hast --- 95-akmodsposttrans.install | 6 +-- akmods | 81 ++++++++++++++++++++++---------------- akmods-ostree-post | 14 +++---- akmodsbuild | 64 +++++++++++++++--------------- 4 files changed, 89 insertions(+), 76 deletions(-) diff --git a/95-akmodsposttrans.install b/95-akmodsposttrans.install index b66551c..93e6b42 100755 --- a/95-akmodsposttrans.install +++ b/95-akmodsposttrans.install @@ -47,11 +47,11 @@ case "${COMMAND}" in /bin/systemctl is-active system-update.target &>/dev/null RET=$? - [ $RET == 0 ] && exit 0 + [[ $RET == 0 ]] && exit 0 - /bin/systemctl restart akmods@${KERNEL_VERSION}.service --no-block >/dev/null 2>&1 + /bin/systemctl restart "akmods@${KERNEL_VERSION}.service" --no-block >/dev/null 2>&1 else - nohup /usr/sbin/akmods --from-kernel-posttrans --kernels ${KERNEL_VERSION} > /dev/null 2>&1 & + nohup /usr/sbin/akmods --from-kernel-posttrans --kernels "${KERNEL_VERSION}" > /dev/null 2>&1 & fi exit 0 ;; diff --git a/akmods b/akmods index ff62faa..f796b14 100644 --- a/akmods +++ b/akmods @@ -53,7 +53,7 @@ last_message="" function check_plymouth() { which plymouth > /dev/null 2> /dev/null - if [[ $? -eq 1 ]] + if [[ "$?" -eq 1 ]] then no_plymouth=1 return 0 @@ -65,9 +65,9 @@ function check_plymouth() { # new or del, msg akmods_echo_plymouth(){ - if [[ $no_plymouth -eq 0 ]] + if [[ "$no_plymouth" -eq 0 ]] then - if [[ $1 -eq 1 ]] + if [[ "$1" -eq 1 ]] then plymouth display-message --text="$2" last_message=$2 @@ -91,7 +91,7 @@ akmods_echo() shift # output to console - if (( ${verboselevel} >= ${this_verbose} )) ; then + if (( verboselevel >= this_verbose )) ; then if [[ "${1}" == "--success" ]] ; then echo_success continue_line="" @@ -110,7 +110,7 @@ akmods_echo() elif [[ "${1}" == "-n" ]] ; then continue_line="true" fi - echo "$@" >&${this_fd} + echo "$@" >&"${this_fd}" fi # no need to print the status flags in the logs @@ -124,11 +124,11 @@ akmods_echo() fi # global logfile - echo "$(date +%Y/%m/%d\ %H:%M:%S) akmods: $@" >> "/var/log/akmods/akmods.log" + echo "$(date +%Y/%m/%d\ %H:%M:%S) akmods: $*" >> "/var/log/akmods/akmods.log" # the kmods logfile as well, if we work on a kmod if [[ -n "${kmodlogfile}" ]] ; then - echo "$(date +%Y/%m/%d\ %H:%M:%S) akmods: $@" >> "${kmodlogfile}" + echo "$(date +%Y/%m/%d\ %H:%M:%S) akmods: $*" >> "${kmodlogfile}" fi } @@ -140,7 +140,7 @@ finally() # remove lockfile rm -f /var/cache/akmods/.lockfile - exit ${1:-128} + exit "${1:-128}" } # Make sure finally() is run regardless of reason for exiting. @@ -148,7 +148,7 @@ trap "finally" ABRT HUP INT QUIT create_tmpdir() { - if ! tmpdir="$(mktemp -d -p /tmp ${myprog}.XXXXXXXX)/" ; then + if ! tmpdir="$(mktemp -d -p /tmp "${myprog}.XXXXXXXX")/" ; then akmods_echo 2 1 "ERROR: failed to create tmpdir." akmods_echo 2 1 --failure ; return 1 fi @@ -169,11 +169,13 @@ remove_tmpdir() cleanup_cachedir () { - for one_file in $(ls /var/cache/akmods/*/* 2>/dev/null | \ - grep -v "$(ls -I "*rescue*" /boot/vmlinuz-* | \ - sed 's%.*vmlinuz-%%g')") ; do - if $(grep -qE ".*\.rpm$" <<< "${one_file}") ; then - if ! $(rpm -q "$(basename ${one_file%.rpm})" >/dev/null) ; then + local excluded + excluded=$(find /boot -name 'vmlinuz-*' '!' -name '*rescue*' 2>/dev/null | sed 's/.*vmlinuz-//') + local -a file_list + mapfile -t file_list < <(find /var/cache/akmods -mindepth 3 2>/dev/null | grep -Fv -f <(echo "${excluded}")) + for one_file in "${file_list[@]}"; do + if grep -q ".*\.rpm$" <<< "${one_file}" ; then + if ! rpm -q "$(basename "${one_file%.rpm}")" >/dev/null ; then rm -f "${one_file}" fi else @@ -305,10 +307,11 @@ check_default_kernel() default_kernel="" fi - if [[ x${default_kernel} == x"$(uname -r)" ]] ; then - local _kernels="${default_kernel}" + local _kernels + if [[ "${default_kernel}" == "$(uname -r)" ]] ; then + _kernels="${default_kernel}" else - local _kernels="${default_kernel} $(uname -r)" + _kernels="${default_kernel} $(uname -r)" fi for _kernel in ${_kernels} ; do @@ -375,7 +378,7 @@ buildinstall_kmod() fi # result - if (( ! ${returncode} == 0 )) ; then + if (( returncode != 0 )) ; then if [[ -n "${continue_line}" ]] ; then akmods_echo 1 2 --failure fi @@ -395,12 +398,14 @@ buildinstall_kmod() akmods_echo_plymouth 0 "" akmods_echo_plymouth 1 "akmod: Installing ${this_kmodsrpm}..." akmods_echo 1 4 "Installing newly built rpms" + local -a rpm_paths + mapfile -t rpm_paths < <(find "${tmpdir}results" -type f -name '*.rpm' | grep -v debuginfo) if [[ -f /usr/bin/dnf ]] ; then akmods_echo 1 4 "DNF detected" - dnf -y ${pkg_install:-install} --nogpgcheck --disablerepo='*' $(find "${tmpdir}results" -type f -name '*.rpm' | grep -v debuginfo) >> "${kmodlogfile}" 2>&1 + dnf -y "${pkg_install:-install}" --nogpgcheck --disablerepo='*' "${rpm_paths[@]}" >> "${kmodlogfile}" 2>&1 else akmods_echo 1 4 "DNF not found, using YUM instead." - yum -y ${pkg_install:-install} --nogpgcheck --disablerepo='*' $(find "${tmpdir}results" -type f -name '*.rpm' | grep -v debuginfo) >> "${kmodlogfile}" 2>&1 + yum -y "${pkg_install:-install}" --nogpgcheck --disablerepo='*' "${rpm_paths[@]}" >> "${kmodlogfile}" 2>&1 fi local returncode=$? @@ -408,7 +413,7 @@ buildinstall_kmod() cp "${tmpdir}results/"* "/var/cache/akmods/${this_kmodname}/" # everything fine? - if (( ${returncode} != 0 )) ; then + if (( returncode != 0 )) ; then if [[ -n "${continue_line}" ]] ; then akmods_echo 1 2 --failure fi @@ -445,7 +450,8 @@ check_kmod_up2date() return 1 fi - local kmodpackage_file="$(modinfo ${this_kmodname} -k ${this_kernelver} -n 2>/dev/null)" + local kmodpackage_file + kmodpackage_file="$(modinfo "${this_kmodname}" -k "${this_kernelver}" -n 2>/dev/null)" # kmod present, even with weak-modules? if [[ ! -n "${kmodpackage_file}" ]] && [[ ! -d /lib/modules/${this_kernelver}/extra/${this_kmodname}/ ]] ; then @@ -462,12 +468,13 @@ check_kmod_up2date() fi # kmod up2date? + local kmodpackage # Weak module symlink case - if [ -n "${kmodpackage_file}" ] && [ -h "${kmodpackage_file}" ] && $(echo "${kmodpackage_file}" | grep -q "weak-updates") ; then - local kmodpackage="$(rpm -qf $(readlink -e ${kmodpackage_file}) 2> /dev/null)" + if [ -n "${kmodpackage_file}" ] && [ -h "${kmodpackage_file}" ] && echo "${kmodpackage_file}" | grep -q "weak-updates" ; then + kmodpackage="$(rpm -qf "$(readlink -e "${kmodpackage_file}")" 2> /dev/null)" # Regular module file case else - local kmodpackage="$(rpm -qf /lib/modules/${this_kernelver}/extra/${this_kmodname}/ 2> /dev/null)" + kmodpackage="$(rpm -qf "/lib/modules/${this_kernelver}/extra/${this_kmodname}/" 2> /dev/null)" fi if [[ ! -n "${kmodpackage}" ]] ; then # seems we didn't get what we wanted @@ -475,8 +482,10 @@ check_kmod_up2date() akmods_echo 1 2 -n "Warning: Could not determine what package owns /lib/modules/${this_kernelver}/extra/${this_kmodname}/" return 0 fi - local kmodver=$(rpm -q --qf '%{EPOCH}:%{VERSION}-%{RELEASE}\n' "${kmodpackage}" | sed 's|(none)|0|; s!\.\(fc\|el\|lvn\)[0-9]*!!g') - local akmodver=$(rpm -qp --qf '%{EPOCH}:%{VERSION}-%{RELEASE}\n' /usr/src/akmods/"${this_kmodname}"-kmod.latest | sed 's|(none)|0|; s!\.\(fc\|el\|lvn\)[0-9]*!!g') + local kmodver + kmodver=$(rpm -q --qf '%{EPOCH}:%{VERSION}-%{RELEASE}\n' "${kmodpackage}" | sed 's|(none)|0|; s!\.\(fc\|el\|lvn\)[0-9]*!!g') + local akmodver + akmodver=$(rpm -qp --qf '%{EPOCH}:%{VERSION}-%{RELEASE}\n' /usr/src/akmods/"${this_kmodname}"-kmod.latest | sed 's|(none)|0|; s!\.\(fc\|el\|lvn\)[0-9]*!!g') rpmdev-vercmp "${kmodver}" "${akmodver}" &>/dev/null local retvalue=$? @@ -503,7 +512,8 @@ check_kmods() akmods_echo 1 2 -n "Checking kmods exist for ${this_kernelver}" for akmods_kmodfile in /usr/src/akmods/*-kmod.latest ; do - local this_kmodname="$(basename ${akmods_kmodfile%%-kmod.latest})" + local this_kmodname + this_kmodname="$(basename "${akmods_kmodfile%%-kmod.latest}")" # actually check this akmod? if [[ -n "${akmods}" ]] ; then @@ -516,7 +526,7 @@ check_kmods() fi # go - if ! check_kmod_up2date ${this_kernelver} ${this_kmodname} ; then + if ! check_kmod_up2date "${this_kernelver}" "${this_kmodname}" ; then # okay, kmod wasn't found or is not up2date if [[ -n "${continue_line}" ]] ; then akmods_echo 1 2 --success @@ -534,14 +544,15 @@ check_kmods() fi fi - local this_kmodverrel="$(rpm -qp --qf '%{VERSION}-%{RELEASE}' "${akmods_kmodfile}" | sed 's!\.\(fc\|el\|lvn\)[0-9]*!!g' )" + local this_kmodverrel + this_kmodverrel="$(rpm -qp --qf '%{VERSION}-%{RELEASE}' "${akmods_kmodfile}" | sed 's!\.\(fc\|el\|lvn\)[0-9]*!!g' )" if [[ ! -n "${alwaystry}" ]] && [[ -e "/var/cache/akmods/${this_kmodname}/${this_kmodverrel}-for-${this_kernelver}".failed.log ]] ; then akmods_echo 1 2 -n "Ignoring ${this_kmodname}-kmod as it failed earlier" akmods_echo 1 2 --warning local someignored="true" else akmods_echo 1 2 -n "Building and installing ${this_kmodname}-kmod" - buildinstall_kmod ${this_kernelver} ${this_kmodname} ${akmods_kmodfile} ${this_kmodverrel} + buildinstall_kmod "${this_kernelver}" "${this_kmodname}" "${akmods_kmodfile}" "${this_kmodverrel}" local returncode=$? if [[ "$returncode" == "0" ]] ; then akmods_echo 1 2 --success @@ -568,7 +579,7 @@ check_kmods() # akmods for newly installed akmod rpms as wells as akmods.service run # after udev and systemd-modules-load.service have tried to load modules - if [[ -n "${somesucceeded}" ]] && [[ ${this_kernelver} = "$(uname -r)" ]] ; then + if [[ -n "${somesucceeded}" ]] && [[ "${this_kernelver}" == "$(uname -r)" ]] ; then find /sys/devices -name modalias -print0 | xargs -0 cat | xargs modprobe -a -b -q if [ -f /usr/bin/systemctl ] ; then systemctl restart systemd-modules-load.service @@ -653,11 +664,11 @@ while [ "${1}" ] ; do shift ;; --verbose) - let verboselevel++ + (( verboselevel++ )) shift ;; --quiet) - let verboselevel-- + (( verboselevel-- )) shift ;; --help) @@ -687,7 +698,7 @@ fi # go for kernel in ${kernels} ; do - check_kmods ${kernel} + check_kmods "${kernel}" done # finished :) diff --git a/akmods-ostree-post b/akmods-ostree-post index 517e1b3..747d0ed 100644 --- a/akmods-ostree-post +++ b/akmods-ostree-post @@ -43,7 +43,7 @@ finally() # remove tmpfiles remove_tmpdir - exit ${1:-128} + exit "${1:-128}" } # Make sure finally() is run regardless of reason for exiting. @@ -51,7 +51,7 @@ trap "finally" ABRT HUP INT QUIT create_tmpdir() { - if ! tmpdir="$(mktemp -d -p /tmp ${myprog}.XXXXXXXX)/" ; then + if ! tmpdir="$(mktemp -d -p /tmp "${myprog}.XXXXXXXX")/" ; then echo "ERROR: failed to create tmpdir." >&2 finally 1 fi @@ -79,24 +79,24 @@ for kernel in ${kernels} ; do echo "Building ${srpm} for kernel ${kernel}" # Note: This builds as root, but this is pretty safe because its happening in the ostree %post sandbox. # In fact, given that /usr is a rofiles-fuse mount no other user can access /usr in this sandbox anyway. - akmodsbuild --quiet --kernels ${kernel} --outputdir ${tmpdir}results --logfile "${tmpdir}/akmodsbuild.log" "${srpm}" 2>&1 + akmodsbuild --quiet --kernels "${kernel}" --outputdir "${tmpdir}results" --logfile "${tmpdir}/akmodsbuild.log" "${srpm}" 2>&1 returncode=$? - if (( ! ${returncode} == 0 )); then + if (( returncode != 0 )); then finally 1 fi done for f in $(find "${tmpdir}results" -type f -name '*.rpm' | grep -v debuginfo) ; do - rpm2cpio $f | cpio --quiet -D / -id + rpm2cpio "${f}" | cpio --quiet -D / -id returncode=$? - if (( ! ${returncode} == 0 )); then + if (( returncode != 0 )); then echo "Extracting $f failed:" 2>&1 finally 1 fi done for kernel in ${kernels} ; do - depmod -v ${kernel} 2>&1 + depmod -v "${kernel}" 2>&1 done finally 0 diff --git a/akmodsbuild b/akmodsbuild index 848c392..08a4cf4 100644 --- a/akmodsbuild +++ b/akmodsbuild @@ -64,7 +64,7 @@ init () # SRPMS available? for srpm in ${srpms}; do - if [[ ! -r ${srpm} ]] ; then + if [[ ! -r "${srpm}" ]] ; then echo "ERROR: Can't find SRPM ${srpm}" exit 1 fi @@ -81,19 +81,19 @@ init () # make sure this is a number - if ! (( ${numberofjobs} > 0 )) ; then + if ! (( numberofjobs > 0 )) ; then echo "Warning: using hardcoded defaut value for number of jobs" numberofjobs=2 fi ## preparations # tmpdir - if ! tmpdir="$(mktemp -d -p /tmp ${myprog}.XXXXXXXX)" ; then + if ! tmpdir="$(mktemp -d -p /tmp "${myprog}.XXXXXXXX")" ; then echo "ERROR: Could create tempdir." exit 1 fi - # buildtreee + # buildtree mkdir "${tmpdir}"/{BUILD,SOURCES,SPECS,SRPMS,RPMS,RPMS/"${target}"} # logfile @@ -101,7 +101,7 @@ init () logfile="${tmpdir}/logfile" fi - if ( [[ -e "${logfile}" ]] && [[ ! -w "${logfile}" ]] ) || ! touch "${logfile}" ; then + if { [[ -e "${logfile}" ]] && [[ ! -w "${logfile}" ]] ; } || ! touch "${logfile}" ; then echo "ERROR: Could not write logfile." finally exit 1 @@ -143,12 +143,12 @@ akmods_echo() fi # output to console - if (( ${verboselevel} >= ${this_verbose} )) ; then - echo "$@" >&${this_fd} + if (( verboselevel >= this_verbose )) ; then + echo "$@" >&"${this_fd}" fi # global logfile - if [[ ! -n ${notlogfile} ]] ; then + if [[ ! -n "${notlogfile}" ]] ; then echo "$@" >> "${logfile}" fi } @@ -159,8 +159,8 @@ watch_rpmbuild() # background function to show rpmbuild progress # does't use akmods_echo here; this stage handles the output on its own # (seperate process and there is no need to log this) - if (( ${verboselevel} == 2 )) ; then - tail --pid ${1} -n +1 -s 0.1 -f ${2} 2>/dev/null | grep --line-buffered -e '%prep' -e '%build' -e '%install' -e '%clean' | while read line ; do + if (( verboselevel == 2 )) ; then + tail --pid "${1}" -n +1 -s 0.1 -f "${2}" 2>/dev/null | grep --line-buffered -e '%prep' -e '%build' -e '%install' -e '%clean' | while read -r line ; do if [[ "${line}" != "${line##*prep}" ]] ; then echo -n "prep " elif [[ "${line}" != "${line##*build}" ]] ; then @@ -172,8 +172,8 @@ watch_rpmbuild() # last linefeed is done by the caller fi done - elif (( ${verboselevel} > 2 )) ; then - tail --pid ${1} -n +1 -s 0.1 -f ${2} + elif (( verboselevel > 2 )) ; then + tail --pid "${1}" -n +1 -s 0.1 -f "${2}" fi } @@ -194,31 +194,32 @@ process_srpm() --define "_rpmdir ${tmpdir}/RPMS" \ --define "_smp_mflags -j${numberofjobs}" \ --define "kernels ${kernels}" \ - --target ${target} \ + --target "${target}" \ --rebuild "${source_rpm}" 2>&1 | tee -a "${logfile}" > "${tmpdir}/.joblog" & local rpmbuild_jobid=$! # show progress - if (( ${verboselevel} >= 2 )) ; then - watch_rpmbuild ${rpmbuild_jobid} "${tmpdir}/.joblog" 2> /dev/null & + if (( verboselevel >= 2 )) ; then + watch_rpmbuild "${rpmbuild_jobid}" "${tmpdir}/.joblog" 2> /dev/null & local watch_jobid=$! fi # wait for rpmbuild - wait ${rpmbuild_jobid} - local rpmbuild_returncode=$(tail -n 1 "${tmpdir}/.jobexit") + wait "${rpmbuild_jobid}" + local rpmbuild_returncode + rpmbuild_returncode=$(tail -n 1 "${tmpdir}/.jobexit") unset rpmbuild_jobid # give watch_rpmbuild a moment to catch up; kill it if it does not - if (( ${verboselevel} >= 2 )) ; then + if (( verboselevel >= 2 )) ; then sleep 0.5 - kill ${watch_jobid} &> /dev/null + kill "${watch_jobid}" &> /dev/null unset watch_jobid fi # did rpmbuild succeed? - if (( ${rpmbuild_returncode} != 0 )) ; then + if (( rpmbuild_returncode != 0 )) ; then # linefeed: akmods_echo 1 2 "" @@ -226,15 +227,16 @@ process_srpm() akmods_echo 2 2 --not-logfile "--- " tail -n 35 "${tmpdir}/.joblog" >&2 akmods_echo 2 2 --not-logfile "---" - return ${rpmbuild_returncode} + return "${rpmbuild_returncode}" fi # finish status for watch_rpmbuild - if (( ${verboselevel} >= 2 )) ; then - akmods_echo 1 2 -n "Successfull; " + if (( verboselevel >= 2 )) ; then + akmods_echo 1 2 -n "Successful; " fi - local rpms_built="$(cd "${tmpdir}"/RPMS/"${target}" ; echo *)" + local rpms_built + rpms_built="$(cd "${tmpdir}"/RPMS/"${target}" || exit ; echo *)" if ! mv "${tmpdir}/RPMS/${target}/"* "${outputdir}" ; then # linefeed: @@ -244,11 +246,11 @@ process_srpm() return 128 fi - if (( ${verboselevel} == 1 )) ; then + if (( verboselevel == 1 )) ; then for rpm in ${rpms_built}; do echo "${outputdir%%/}/${rpm}" done - elif (( ${verboselevel} >= 2 )) ; then + elif (( verboselevel >= 2 )) ; then akmods_echo 1 2 "Saved ${rpms_built} in ${outputdir%%/}/" fi @@ -311,11 +313,11 @@ while [ "${1}" ] ; do shift ;; -v|--verbose) - let verboselevel++ + (( verboselevel++ )) shift ;; -q|--quiet) - let verboselevel-- + (( verboselevel-- )) shift ;; -h|--help) @@ -343,12 +345,12 @@ init # go for srpm in ${srpms}; do - process_srpm ${srpm} + process_srpm "${srpm}" returncode=$? - if (( ${returncode} != 0 )) ; then + if (( returncode != 0 )) ; then finally - exit ${returncode} + exit "${returncode}" fi done From df1211cf1ec34fa3b9ceda9ec98a74860f64f8cb Mon Sep 17 00:00:00 2001 From: Leigh Scott Date: Sat, 3 May 2025 20:22:50 +0100 Subject: [PATCH 08/29] Fix changelog From bc81288496d7de511f4462552c84fc7c192352d3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 16:51:16 +0000 Subject: [PATCH 09/29] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From eb27fa99182887d5af14b82f56bc43e60829e5b3 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Tue, 16 Sep 2025 20:24:05 +0200 Subject: [PATCH 10/29] Drop nohup usage --- 95-akmodsposttrans.install | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/95-akmodsposttrans.install b/95-akmodsposttrans.install index 93e6b42..e4912a5 100755 --- a/95-akmodsposttrans.install +++ b/95-akmodsposttrans.install @@ -41,19 +41,13 @@ fi case "${COMMAND}" in add) - # needs to run in background as rpmdb might be locked otherwise - if [ -e /bin/systemctl ] ; then - # Exit early if system-update.target is active - rhbz#1518401 - /bin/systemctl is-active system-update.target &>/dev/null - RET=$? + # Exit early if system-update.target is active - rhbz#1518401 + /bin/systemctl is-active system-update.target &>/dev/null + RET=$? - [[ $RET == 0 ]] && exit 0 + [[ $RET == 0 ]] && exit 0 - /bin/systemctl restart "akmods@${KERNEL_VERSION}.service" --no-block >/dev/null 2>&1 - else - nohup /usr/sbin/akmods --from-kernel-posttrans --kernels "${KERNEL_VERSION}" > /dev/null 2>&1 & - fi - exit 0 + /bin/systemctl restart "akmods@${KERNEL_VERSION}.service" --no-block >/dev/null 2>&1 ;; remove) # Nothing to do From c387dbb719f9dfaa4e9995ca2678d117001f09f7 Mon Sep 17 00:00:00 2001 From: Francis Montagnac Date: Tue, 16 Sep 2025 21:56:37 +0200 Subject: [PATCH 11/29] akmods: check_default_kernel is never called - rhbz#2376351 Signed-off-by: Nicolas Chauvet --- akmods | 5 ----- 1 file changed, 5 deletions(-) diff --git a/akmods b/akmods index f796b14..a01e5af 100644 --- a/akmods +++ b/akmods @@ -196,11 +196,6 @@ init () UMASK=022 umask ${UMASK} - # fall back to current kernel if user didn't provide one - if [[ ! -n "${kernels}" ]] ; then - kernels="$(uname -r)" - fi - # we get the echo_{success,failure} stuff from there if [[ -r /etc/rc.d/init.d/functions ]] ; then source /etc/rc.d/init.d/functions From e1da058ed2f430897e68482a9ed85fe9e1bfad01 Mon Sep 17 00:00:00 2001 From: Francis Montagnac Date: Tue, 16 Sep 2025 22:03:49 +0200 Subject: [PATCH 12/29] akmods: wrong calls to check_kernel_devel - rhbz#2376351 Signed-off-by: Nicolas Chauvet --- akmods | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/akmods b/akmods index a01e5af..6bcb082 100644 --- a/akmods +++ b/akmods @@ -310,7 +310,7 @@ check_default_kernel() fi for _kernel in ${_kernels} ; do - if [[ $(check_kernel_devel "${_kernel}" == 0) ]] ; then + if check_kernel_devel "${_kernel}" ; then kernels="${kernels} ${_kernel}" fi done @@ -605,7 +605,7 @@ while [ "${1}" ] ; do exit 1 fi - if [[ $(check_kernel_devel "${1}" != 0) ]] ; then + if ! check_kernel_devel "${1}" ; then echo "ERROR: kernel or kernel-devel required for ${1}" >&2 exit 1 fi From 4882031c241459d7750902598a8db4c74918963f Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Tue, 16 Sep 2025 22:47:01 +0200 Subject: [PATCH 13/29] akmods: drop grubby symlink test --- akmods | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/akmods b/akmods index 6bcb082..d8ddff5 100644 --- a/akmods +++ b/akmods @@ -285,7 +285,7 @@ check_default_kernel() # IMPORTANT: "bootctl is-installed" check that systemd-boot is installed only. # It doesn't check if systemd-boot is the default loader. # So we assume grubby results if available - if [ ! -h /usr/sbin/grubby ] && command -v grubby >/dev/null 2>&1 ; then + if command -v grubby >/dev/null 2>&1 ; then default_kernel=$(grubby --default-kernel | sed -e 's/^.*vmlinuz-//') elif bootctl is-installed >/dev/null 2>&1 ; then # Leave jq as optional - isDefault requires systemd 253 From b2e2537720f1617e68cd1a88025bb019d3b5bfba Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 22 Sep 2025 12:49:51 +0200 Subject: [PATCH 14/29] Drop global armv7hl target override and default --- akmodsbuild | 4 ---- 1 file changed, 4 deletions(-) diff --git a/akmodsbuild b/akmodsbuild index 08a4cf4..b8fc706 100644 --- a/akmodsbuild +++ b/akmodsbuild @@ -27,10 +27,6 @@ myver="0.5.6" # defaults that might get overwritten by user: kernels="$(uname -r)" -target="$(uname -m)" -if [[ "${target}" == "armv7l" ]] ; then - target="armv7hl" -fi numberofjobs=$(grep -c processor /proc/cpuinfo 2> /dev/null) verboselevel=2 outputdir="${PWD}" From ae0d4e1c76c8b91259d152a6eca9256b9692196b Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 22 Sep 2025 13:47:22 +0200 Subject: [PATCH 15/29] Case for unspecified target - rhbz#2394562 --- akmodsbuild | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/akmodsbuild b/akmodsbuild index b8fc706..1069388 100644 --- a/akmodsbuild +++ b/akmodsbuild @@ -89,6 +89,15 @@ init () exit 1 fi + if [ -z "${target}" ] ; then + case "${kernels}" in + *x86_64_v4) target=x86_64_v4;; + *x86_64_v3) target=x86_64_v3;; + *x86_64_v2) target=x86_64_v2;; + *armv7hl) target=armv7hl;; + *) target="$(uname -m)" ;; + esac + fi # buildtree mkdir "${tmpdir}"/{BUILD,SOURCES,SPECS,SRPMS,RPMS,RPMS/"${target}"} From f85811c72d5715c527ab01a95ee4ee70d6f14164 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 22 Sep 2025 14:18:21 +0200 Subject: [PATCH 16/29] Rework sysusers --- akmods.spec | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/akmods.spec b/akmods.spec index 6ed6a9a..3d89659 100644 --- a/akmods.spec +++ b/akmods.spec @@ -26,6 +26,7 @@ Source17: akmods-kmodgenca Source18: akmods-keygen.target Source19: akmods-keygen@.service Source20: %{name}-tmpfiles.conf +Source21: akmods.sysusers.conf BuildArch: noarch @@ -93,11 +94,6 @@ after they were installed. %setup -q -c -T cp -p %{SOURCE9} %{SOURCE10} %{SOURCE15} . -# Create a sysusers.d config file -cat >akmods.sysusers.conf < Date: Mon, 22 Sep 2025 14:18:46 +0200 Subject: [PATCH 17/29] Drop nohup requires for rhel6 --- akmods.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/akmods.spec b/akmods.spec index 3d89659..10db04e 100644 --- a/akmods.spec +++ b/akmods.spec @@ -33,9 +33,6 @@ BuildArch: noarch BuildRequires: help2man # not picked up automatically -%if 0%{?rhel} == 6 -Requires: %{_bindir}/nohup -%endif Requires: %{_bindir}/flock Requires: %{_bindir}/time From 413f0417be5c181bb76878a2cca566712207917b Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 22 Sep 2025 14:19:14 +0200 Subject: [PATCH 18/29] Update to 0.6.1 --- akmods | 2 +- akmods.spec | 2 +- akmodsbuild | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/akmods b/akmods index d8ddff5..d7ed0d3 100644 --- a/akmods +++ b/akmods @@ -37,7 +37,7 @@ # global vars myprog="akmods" -myver="0.6.0" +myver="0.6.1" kmodlogfile= continue_line="" tmpdir= diff --git a/akmods.spec b/akmods.spec index 10db04e..9f349c0 100644 --- a/akmods.spec +++ b/akmods.spec @@ -1,5 +1,5 @@ Name: akmods -Version: 0.6.0 +Version: 0.6.1 Release: %autorelease Summary: Automatic kmods build and install tool diff --git a/akmodsbuild b/akmodsbuild index 1069388..67354b0 100644 --- a/akmodsbuild +++ b/akmodsbuild @@ -23,7 +23,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # myprog="akmodsbuild" -myver="0.5.6" +myver="0.6.1" # defaults that might get overwritten by user: kernels="$(uname -r)" From 91b528407487cfe49c116837d6cb888c7290e1f8 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 22 Sep 2025 15:13:45 +0200 Subject: [PATCH 19/29] Add akmods-sysusers.conf --- akmods.sysusers.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 akmods.sysusers.conf diff --git a/akmods.sysusers.conf b/akmods.sysusers.conf new file mode 100644 index 0000000..f505ad6 --- /dev/null +++ b/akmods.sysusers.conf @@ -0,0 +1 @@ +u akmods - 'User is used by akmods to build akmod packages' /var/cache/akmods/ - From 6756b5cdd7619b9e234fd1e6e5fb0e5313dfe5ee Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 22 Sep 2025 15:50:53 +0200 Subject: [PATCH 20/29] Rework akmod.service installation --- akmods.service.in => akmods.service | 2 +- akmods.spec | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename akmods.service.in => akmods.service (90%) diff --git a/akmods.service.in b/akmods.service similarity index 90% rename from akmods.service.in rename to akmods.service index 22530d3..587913d 100644 --- a/akmods.service.in +++ b/akmods.service @@ -1,7 +1,7 @@ [Unit] Description=Builds and install new kmods from akmod packages ConditionPathExists=!/run/ostree-booted -Before=@SERVICE@ +Before=display-manager.service After=akmods-keygen.target Wants=akmods-keygen.target diff --git a/akmods.spec b/akmods.spec index 9f349c0..461531a 100644 --- a/akmods.spec +++ b/akmods.spec @@ -11,7 +11,7 @@ Source0: 95-akmods.preset Source1: akmods Source2: akmodsbuild Source3: akmods.h2m -Source6: akmods.service.in +Source6: akmods.service Source7: akmods-shutdown Source8: akmods-shutdown.service Source9: README @@ -122,9 +122,9 @@ install -pm 0755 %{SOURCE13} %{buildroot}%{_prefix}/lib/kernel/install.d/ mkdir -p \ %{buildroot}%{_unitdir} \ %{buildroot}%{_presetdir} -sed "s|@SERVICE@|display-manager.service|" %{SOURCE6} >\ - %{buildroot}%{_unitdir}/akmods.service + install -pm 0644 %{SOURCE0} %{buildroot}%{_presetdir}/ +install -pm 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ install -pm 0755 %{SOURCE7} %{buildroot}%{_sbindir}/ install -pm 0644 %{SOURCE8} %{buildroot}%{_unitdir}/ install -pm 0644 %{SOURCE11} %{buildroot}%{_unitdir}/ From 9737ee61c0b2ee1f0655788dc092cee43dc2f4fe Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 22 Sep 2025 15:51:36 +0200 Subject: [PATCH 21/29] Drop akmodsinit --- akmodsinit | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 akmodsinit diff --git a/akmodsinit b/akmodsinit deleted file mode 100644 index 3f401c7..0000000 --- a/akmodsinit +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# -# akmodinit Builds and install new kmods from akmod packages -# -# Author: Thorsten Leemhuis -# -# chkconfig: 2345 5 95 -# -# description: akmodsinit calls akmod during system boot to build and install -# kmods for the currently running kernel if neccessary. -# -# processname: akmodsd -# pidfile: /var/run/akmodsd.pid -# - -### BEGIN INIT INFO -# Provides: akmodsd -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Builds and install new kmods from akmod packages -# Description: akmodsinit calls akmod during system boot to build and install -# kmods for the currently running kernel if neccessary. -### END INIT INFO - -start_akmods () -{ - # build and install all kmods if neccessary - # for the currently running kernel (default in akmods) - /usr/sbin/akmods --from-init -} - - -# See how we were called. -case "$1" in - start|restart|reload|condrestart) - start_akmods - ;; - stop|status) - exit 0 - ;; - *) - echo $"Usage: $0 start" - exit 2 - ;; -esac From b363e421582e70d27bc36998825204836c524e2b Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Wed, 1 Oct 2025 14:15:28 +0200 Subject: [PATCH 22/29] docs: drop grep Issuer from mokutil output --- README.secureboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.secureboot b/README.secureboot index 059977f..908b282 100644 --- a/README.secureboot +++ b/README.secureboot @@ -46,6 +46,6 @@ below. You can confirm the enrollment of the new keypair once the system rebooted with: - `mokutil --list-enrolled | grep Issuer` + `mokutil --list-enrolled or with: `mokutil --test-key /etc/pki/akmods/certs/public_key.der` From 602926dc32063b4fa463e1f768b37e1577e968d2 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Wed, 1 Oct 2025 16:06:24 +0200 Subject: [PATCH 23/29] akmods: add missing sysusers group --- akmods.sysusers.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/akmods.sysusers.conf b/akmods.sysusers.conf index f505ad6..6dd7280 100644 --- a/akmods.sysusers.conf +++ b/akmods.sysusers.conf @@ -1 +1,3 @@ -u akmods - 'User is used by akmods to build akmod packages' /var/cache/akmods/ - +#Type Name ID GECOS Home directory Shell +g akmods - - - - +u akmods - 'User is used by akmods to build akmod packages' /var/cache/akmods/ - From b68a5b81ce71f76ff7b1e557dfd409adbc929131 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Wed, 1 Oct 2025 16:08:56 +0200 Subject: [PATCH 24/29] Update to 0.6.2 --- akmods | 2 +- akmods.spec | 2 +- akmodsbuild | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/akmods b/akmods index d7ed0d3..cdaa39a 100644 --- a/akmods +++ b/akmods @@ -37,7 +37,7 @@ # global vars myprog="akmods" -myver="0.6.1" +myver="0.6.2" kmodlogfile= continue_line="" tmpdir= diff --git a/akmods.spec b/akmods.spec index 461531a..0450a65 100644 --- a/akmods.spec +++ b/akmods.spec @@ -1,5 +1,5 @@ Name: akmods -Version: 0.6.1 +Version: 0.6.2 Release: %autorelease Summary: Automatic kmods build and install tool diff --git a/akmodsbuild b/akmodsbuild index 67354b0..23b0783 100644 --- a/akmodsbuild +++ b/akmodsbuild @@ -23,7 +23,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # myprog="akmodsbuild" -myver="0.6.1" +myver="0.6.2" # defaults that might get overwritten by user: kernels="$(uname -r)" From edb1bd2b68b8eeec397797956785453758a31ad6 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Wed, 15 Oct 2025 16:40:00 +0200 Subject: [PATCH 25/29] Add compat for sysusers support --- akmods.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/akmods.spec b/akmods.spec index 0450a65..88d3cef 100644 --- a/akmods.spec +++ b/akmods.spec @@ -32,6 +32,9 @@ BuildArch: noarch BuildRequires: help2man +# Needed for older branches el8+, noop on f43+ +%{?sysusers_requires_compat} + # not picked up automatically Requires: %{_bindir}/flock Requires: %{_bindir}/time @@ -143,6 +146,8 @@ help2man -N -i %{SOURCE3} -s 1 \ install -m0644 -D %{SOURCE21} %{buildroot}%{_sysusersdir}/akmods.conf +%pre +%sysusers_create_compat %{SOURCE21} %post %systemd_post akmods.service From 6b27509edfcacd847fcc7a530d3ebced606f8ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luan=20Vitor=20Simi=C3=A3o=20oliveira?= Date: Wed, 5 Nov 2025 20:58:54 -0300 Subject: [PATCH 26/29] fix: prevent akmods@ on offline update on fc43+ --- 95-akmodsposttrans.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/95-akmodsposttrans.install b/95-akmodsposttrans.install index e4912a5..407e9ac 100755 --- a/95-akmodsposttrans.install +++ b/95-akmodsposttrans.install @@ -42,7 +42,7 @@ fi case "${COMMAND}" in add) # Exit early if system-update.target is active - rhbz#1518401 - /bin/systemctl is-active system-update.target &>/dev/null + /usr/bin/systemctl -q is-active system-update-pre.target system-update.target RET=$? [[ $RET == 0 ]] && exit 0 From ec65894b43a9b20f9f1fd0258af191a3486a72c8 Mon Sep 17 00:00:00 2001 From: Mark K <7grrar1r+fedora@gmail.com> Date: Thu, 8 Jan 2026 00:37:27 +0100 Subject: [PATCH 27/29] fix cleanup_cachedir function --- akmods | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/akmods b/akmods index cdaa39a..9af6046 100644 --- a/akmods +++ b/akmods @@ -172,7 +172,7 @@ cleanup_cachedir () local excluded excluded=$(find /boot -name 'vmlinuz-*' '!' -name '*rescue*' 2>/dev/null | sed 's/.*vmlinuz-//') local -a file_list - mapfile -t file_list < <(find /var/cache/akmods -mindepth 3 2>/dev/null | grep -Fv -f <(echo "${excluded}")) + mapfile -t file_list < <(find /var/cache/akmods -mindepth 2 -type f -not -name .last.log 2>/dev/null | grep -Fv -f <(echo "${excluded}")) for one_file in "${file_list[@]}"; do if grep -q ".*\.rpm$" <<< "${one_file}" ; then if ! rpm -q "$(basename "${one_file%.rpm}")" >/dev/null ; then From ebb52e0d0a35591bf591295875461ca5354fb019 Mon Sep 17 00:00:00 2001 From: Thomas Deutschmann Date: Mon, 8 Dec 2025 23:20:58 +0100 Subject: [PATCH 28/29] kmodgenca: fallback to US when locale country code is missing rhbz#2416536 Fall back to "US" when `locale country_ab2` returns empty (as seen with LANG=C), preventing an empty countryName in the generated OpenSSL config. Fixes: rhbz#2416536 --- akmods-kmodgenca | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/akmods-kmodgenca b/akmods-kmodgenca index dafe69b..eab0882 100644 --- a/akmods-kmodgenca +++ b/akmods-kmodgenca @@ -433,6 +433,12 @@ function create_cacert_config() { # Set '-batch' argument. AUTOMATIC_BUILD_OPTION="-batch" + local cert_country_code=$(locale country_ab2) + if [[ -z ${cert_country_code} ]]; then + echo -e "${BOLD_YELLOW_TEXT}WARNING:${CLEAR_TEXT} COULD NOT DETECT COUNTRY CODE FROM LOCALE; USING FALLBACK VALUE: US" >&2 + cert_country_code=US + fi + # Utilise default values if 'AUTOMATIC_BUILD' is equal to '1'. # - Set OpenSSL field values. # - Comment default and min/max values. @@ -441,7 +447,7 @@ function create_cacert_config() { -e "s#\(emailAddress *= \).*#\1akmods@${cert_hostname}#" \ -e "s#\(localityName *= \).*#\1None#" \ -e "s#\(stateOrProvinceName *= \).*#\1None#" \ - -e "s#\(countryName *= \).*#\1$(locale country_ab2)#" \ + -e "s#\(countryName *= \).*#\1${cert_country_code}#" \ -e "s#\(commonName *= \).*#\1${KEYNAME}#" \ -e "s/^[^#]*_default *= /#&/" \ -e "s/^[^#]*_min/#&/" \ From f4104cf2817bc91ac85dd815f2ad64cabf99a07e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 16 Jan 2026 03:32:40 +0000 Subject: [PATCH 29/29] Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild