Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing wifi firmware checks
Browse files Browse the repository at this point in the history
Some wifi-firmwares will be split into sub-packages in fedora 40
We will keep them in until fedora 41, but display a warning message
in the console if NetworkManager-wifi is layered without the most
popular the wifi firmwares.

See coreos/fedora-coreos-tracker#1575
jbtrystram committed Apr 22, 2024

Unverified

The signing certificate or its chain could not be verified.
1 parent 0566985 commit 5144dc0
Showing 3 changed files with 58 additions and 0 deletions.
3 changes: 3 additions & 0 deletions overlay.d/15fcos/usr/lib/systemd/system-preset/45-fcos.preset
Original file line number Diff line number Diff line change
@@ -3,3 +3,6 @@ enable coreos-check-ssh-keys.service
enable coreos-check-cgroups-version.service
# https://fedoraproject.org/wiki/Changes/EnableFwupdRefreshByDefault
enable fwupd-refresh.timer
# Check if wifi firmwares are missing when NetworkManager-wifi is installed
# https://github.com/coreos/fedora-coreos-tracker/issues/1575
enable coreos-check-wireless-firmwares.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This service is used for printing a message if
# some wireless firmwares are missing
[Unit]
Description=Check if all the wireless firmwares are installed
[Service]
Type=oneshot
ExecStart=/usr/libexec/coreos-check-wireless-firmwares
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
45 changes: 45 additions & 0 deletions overlay.d/15fcos/usr/libexec/coreos-check-wireless-firmwares
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/bash
# This script checks if
# and will prints a message to the serial console
# to warn the user about missing wifi firmware messages
# 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
else
return 0
fi

# Change the output color to yellow
warn=$(echo -e '\033[0;33m')
# No color
nc=$(echo -e '\033[0m')

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.
To layer the missing firmwares use the following :
sudo rpm-ostree install atheros-firmware brcmfmac-firmware \
mt7xxx-firmware realtek-firmware
Then reboot the system.
To disable this warning, use:
sudo systemctl disable coreos-check-wireless-firmwares.service
##########################################################################
${nc}
EOF

0 comments on commit 5144dc0

Please sign in to comment.