]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix: skip empty modalias files in drm module setup
authorEvgeni Golov <evgeni@golov.de>
Sat, 13 Feb 2021 20:40:47 +0000 (21:40 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 22 Feb 2021 13:55:44 +0000 (14:55 +0100)
on my system (ThinkPad X201s) I have several modalias entries that are
empty:

    /sys/bus/platform/devices/dock.0/modalias
    /sys/bus/platform/devices/dock.1/modalias
    /sys/bus/platform/devices/dock.2/modalias

executing the drm module setup thus results in the following errors

    dracut-install: No SOURCE argument given

when calling dracut_instmods and hostonly mode is enabled.

Skip those entries, as there are no modules to load in this case
anyways.

Note: it is not sufficient to use [['s -s test (file size is greater
than zero), as all those files are 4096B if you stat them.

modules.d/50drm/module-setup.sh

index ddc1223d764595edd9a93e4c03d9890b940e2e90..7b5f836ea81ccf52e92567c4e4c529c5a7794b13 100755 (executable)
@@ -33,6 +33,7 @@ installkernel() {
     if [[ $hostonly ]]; then
         for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
             [[ -e $i ]] || continue
+            [[ -n $(<"$i") ]] || continue
             if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" $(<"$i"); then
                 if strstr "$(modinfo -F filename $(<"$i") 2>/dev/null)" radeon.ko; then
                     hostonly='' instmods amdkfd