From c63df4d340b0b678c55244d704b0275348777245 Mon Sep 17 00:00:00 2001 From: jbtrystram Date: Mon, 15 Apr 2024 12:14:05 +0200 Subject: [PATCH] pull firmware list from comp Also link to FQ entry. see https://github.com/coreos/fedora-coreos-docs/pull/629 --- .../coreos-check-cgroups-version.service | 1 + .../system/coreos-check-ssh-keys.service | 1 + .../coreos-check-wireless-firmwares.service | 3 +- .../libexec/coreos-check-wireless-firmwares | 54 ++++++++++++------- 4 files changed, 40 insertions(+), 19 deletions(-) diff --git a/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-cgroups-version.service b/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-cgroups-version.service index 2aff8f6cdb..101392140b 100644 --- a/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-cgroups-version.service +++ b/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-cgroups-version.service @@ -3,6 +3,7 @@ [Unit] Description=Check if cgroupsv1 Is Still Being Used ConditionControlGroupController=v1 +Before=systemd-user-sessions.service [Service] Type=oneshot ExecStart=/usr/libexec/coreos-check-cgroups-version diff --git a/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-ssh-keys.service b/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-ssh-keys.service index 0e24ae8aaa..d3c8815725 100644 --- a/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-ssh-keys.service +++ b/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-ssh-keys.service @@ -16,6 +16,7 @@ ConditionKernelCommandLine=ignition.firstboot Before=systemd-user-sessions.service [Service] +Before=systemd-user-sessions.service Type=oneshot ProtectHome=read-only ExecStart=/usr/libexec/coreos-check-ssh-keys diff --git a/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-wireless-firmwares.service b/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-wireless-firmwares.service index df2b5c7e2a..360bf2ed85 100644 --- a/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-wireless-firmwares.service +++ b/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-wireless-firmwares.service @@ -1,7 +1,8 @@ # This service is used for printing a message if # some wireless firmwares are missing [Unit] -Description=Check if all the wireless firmwares are installed +Description=Check For Wireless Firmware Packages +Before=systemd-user-sessions.service [Service] Type=oneshot ExecStart=/usr/libexec/coreos-check-wireless-firmwares diff --git a/overlay.d/15fcos/usr/libexec/coreos-check-wireless-firmwares b/overlay.d/15fcos/usr/libexec/coreos-check-wireless-firmwares index 7b6adb1557..abf2b51eed 100755 --- a/overlay.d/15fcos/usr/libexec/coreos-check-wireless-firmwares +++ b/overlay.d/15fcos/usr/libexec/coreos-check-wireless-firmwares @@ -5,18 +5,38 @@ # and provide remediation steps # See https://github.com/coreos/fedora-coreos-tracker/issues/1575 -layered_packages="$(rpm-ostree status --json -b | jq -r '.deployments[0].packages[]')" - -if echo "$layered_packages" | grep -q "NetworkManager-wifi"; then - if echo "$layered_packages" | grep -q "atheros-firmware" && \ - echo "$layered_packages" | grep -q "brcmfmac-firmware" && \ - echo "$layered_packages" | grep -q "mt7xxx-firmware" && \ - echo "$layered_packages" | grep -q "realtek-firmware" - then - return 0 - fi +set -euo pipefail + +# List of wifi-firmwares +# SOURCE: https://pagure.io/fedora-comps/blob/main/f/comps-f41.xml.in#_2700 +firmwares=( +atheros-firmware +b43-fwcutter +b43-openfwwf +brcmfmac-firmware +iwlegacy-firmware +iwlwifi-dvm-firmware +iwlwifi-mvm-firmware +libertas-firmware +mt7xxx-firmware +nxpwireless-firmware +realtek-firmware +tiwilink-firmware +atmel-firmware +bcm283x-firmware +zd1211-firmware +) +# Get firmware names into `a|b|c|d` regex string +regex=$(IFS='|'; echo "${firmwares[*]}") + +layered_packages="$(rpm-ostree status --json -b | jq -r '.deployments[0]."requested-packages"[]')" + +if grep -q "NetworkManager-wifi" <<< "$layered_packages"; then + if grep -qP $regex <<< "$layered_packages"; then + exit 0 + fi else - return 0 + exit 0 fi # Change the output color to yellow @@ -29,14 +49,12 @@ motd_path=/run/motd.d/30_wireless_firmwares_warning.motd cat << EOF > "${motd_path}" ${warn} ########################################################################## -WARNING: The NetworkManager-wifi is installed on this system. -However, some wifi-firmwares are not installed. +WARNING: The NetworkManager-wifi is a requested layered package on this +system, but no Wi-Fi drivers are requested. The Wi-Fi drivers will no +longer be included by default in the future. -To layer the missing firmwares use the following : -sudo rpm-ostree install atheros-firmware brcmfmac-firmware \ -mt7xxx-firmware realtek-firmware - -Then reboot the system. +More context and remediation steps are available in the following FAQ entry: +https://docs.fedoraproject.org/en-US/fedora-coreos/wifi/ To disable this warning, use: sudo systemctl disable coreos-check-wireless-firmwares.service