]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix: shellcheck for modules.d/90kernel-network-modules/module-setup.sh
authorHarald Hoyer <harald@redhat.com>
Fri, 12 Feb 2021 12:26:12 +0000 (13:26 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 15 Feb 2021 10:00:37 +0000 (11:00 +0100)
modules.d/90kernel-network-modules/module-setup.sh

index 3a0d4e7e213a9327ae43f61a5495d92672f87301..c6c8992b659266bcd8cab91fea2e938304a7639c 100755 (executable)
@@ -18,18 +18,18 @@ installkernel() {
     local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
     local _net_drivers
 
-    if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then
+    if [[ "$_arch" = "s390" ]] || [[ "$_arch" = "s390x" ]]; then
         dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/s390/net"
     fi
 
     if [[ $hostonly_mode == 'strict' ]] && [[ $hostonly_nics ]]; then
         for _nic in $hostonly_nics; do
-            _net_drivers=$(get_dev_module /sys/class/net/$_nic)
-            if ! [[ $_net_drivers ]]; then
+            mapfile -t _net_drivers <<< "$(get_dev_module /sys/class/net/"$_nic")"
+            if (( ${#_net_drivers[@]} == 0 )); then
                 derror "--hostonly-nics contains invalid NIC '$_nic'"
                 continue
             fi
-            hostonly="" instmods $_net_drivers
+            hostonly="" instmods "${_net_drivers[@]}"
         done
         return 0
     fi
@@ -37,10 +37,10 @@ installkernel() {
     dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/net"
     #instmods() will take care of hostonly
     instmods \
-        =drivers/net/mdio \
-        =drivers/net/phy \
-        =drivers/net/team \
-        =drivers/net/ethernet \
+        '=drivers/net/mdio' \
+        '=drivers/net/phy' \
+        '=drivers/net/team' \
+        '=drivers/net/ethernet' \
         ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet
 }