]> git.ipfire.org Git - thirdparty/dracut.git/blame - modules.d/90kernel-network-modules/module-setup.sh
Add a --hostonly-nics option
[thirdparty/dracut.git] / modules.d / 90kernel-network-modules / module-setup.sh
CommitLineData
ae43adb7
HH
1#!/bin/bash
2
3# called by dracut
4check() {
5 return 255
6}
7
8# called by dracut
9depends() {
10 return 0
11}
12
13# called by dracut
14installkernel() {
15 # Include wired net drivers, excluding wireless
a0120420 16 local _arch=${DRACUT_ARCH:-$(uname -m)}
1e92f728 17 local _net_symbols='eth_type_trans|register_virtio_device|usbnet_open'
794b2d2c 18 local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
1e92f728 19 local _net_drivers
ae43adb7 20
794b2d2c 21 if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then
1e92f728 22 dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/s390/net"
794b2d2c 23 fi
ae43adb7 24
1e92f728
KS
25 if [[ $hostonly_mode == 'strict' ]] && [[ $hostonly_nics ]]; then
26 for _nic in $hostonly_nics; do
27 _net_drivers=$(get_dev_module /sys/class/net/$_nic)
28 if ! [[ $_net_drivers ]]; then
29 derror "--hostonly-nics contains invalid NIC '$_nic'"
30 continue
31 fi
32 hostonly="" instmods $_net_drivers
33 done
34 return 0
35 fi
ae43adb7 36
1e92f728 37 dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/net"
ae43adb7
HH
38 #instmods() will take care of hostonly
39 instmods \
40 =drivers/net/phy \
41 =drivers/net/team \
42 =drivers/net/ethernet \
bb75d165 43 ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet
73833796 44 hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
ae43adb7
HH
45}
46
47# called by dracut
48install() {
49 return 0
50}
51