3 # NFS root might have reached here before /tmp/net.ifaces was written
4 type is_persistent_ethernet_name
>/dev
/null
2>&1 || .
/lib
/net-lib.sh
6 udevadm settle
--timeout=30
8 if [ -e /tmp
/bridge.info
]; then
12 if [ -e /tmp
/vlan.info
]; then
16 mkdir
-m 0755 -p /tmp
/ifcfg
/
17 mkdir
-m 0755 -p /tmp
/ifcfg-leases
/
19 get_config_line_by_subchannel
()
25 while read line ||
[ -n "$line" ]; do
26 if strstr
"$line" "$CHANNELS"; then
45 # if we find ccw channel, then use those, instead of
48 for i
in /sys
/class
/net
/$_netif/device
/cdev
[0-9]*; do
50 channel
=$
(readlink
-f $i)
51 echo -n "${channel##*/},"
54 [ -n "$SUBCHANNELS" ] ||
return 1
56 SUBCHANNELS
=${SUBCHANNELS%,}
57 echo "SUBCHANNELS=\"${SUBCHANNELS}\""
59 CONFIG_LINE
=$
(get_config_line_by_subchannel
$SUBCHANNELS)
60 [ $?
-ne 0 -o -z "$CONFIG_LINE" ] && return 0
71 while [ $# -gt 0 ]; do
73 *=*) OPTIONS
="$OPTIONS $1";;
78 echo "NETTYPE=\"${NETTYPE}\""
79 echo "OPTIONS=\"${OPTIONS}\""
88 && echo "MACADDR=\"$_macaddr\""
90 print_s390
"$_netif" \
93 [ -n "$_macaddr" ] && return 0
95 is_persistent_ethernet_name
"$_netif" && return 0
97 [ -f "/sys/class/net/$_netif/addr_assign_type" ] \
98 && [ "$(cat "/sys
/class
/net
/$_netif/addr_assign_type
")" != "0" ] \
101 [ -f "/sys/class/net/$_netif/address" ] \
104 echo "HWADDR=\"$(cat /sys/class/net/$_netif/address)\""
111 # see, if we can bind it to some hw parms
112 if hw_bind
"$_netif" "$_macaddr"; then
113 # only print out DEVICE, if it's user assigned
114 is_kernel_ethernet_name
"$_netif" && return 0
117 echo "DEVICE=\"$_netif\""
120 for netup
in /tmp
/net.
*.did-setup
; do
121 [ -f $netup ] ||
continue
123 netif
=${netup%%.did-setup}
124 netif
=${netif##*/net.}
125 strglobin
"$netif" ":*:*:*:*:" && continue
126 [ -e /tmp
/ifcfg
/ifcfg-
$netif ] && continue
142 [ -e /tmp
/bond.
${netif}.info
] && .
/tmp
/bond.
${netif}.info
144 uuid
=$
(cat /proc
/sys
/kernel
/random
/uuid
)
145 if [ "$netif" = "$bridgename" ]; then
147 elif [ "$netif" = "$bondname" ]; then
148 # $netif can't be bridge and bond at the same time
151 if [ "$netif" = "$vlanname" ]; then
156 echo "# Generated by dracut initrd"
157 echo "NAME=\"$netif\""
158 interface_bind
"$netif" "$macaddr"
161 echo "UUID=\"$uuid\""
162 strstr
"$(ip -6 addr show dev $netif)" 'inet6' && echo "IPV6INIT=yes"
163 if [ -f /tmp
/dhclient.
$netif.lease
]; then
164 [ -f /tmp
/dhclient.
$netif.dhcpopts
] && .
/tmp
/dhclient.
$netif.dhcpopts
165 if [ -f /tmp
/net.
$netif.has_ibft_config
]; then
166 echo "BOOTPROTO=ibft"
168 echo "BOOTPROTO=dhcp"
170 cp /tmp
/dhclient.
$netif.lease
/tmp
/ifcfg-leases
/dhclient-
$uuid-$netif.lease
172 # If we've booted with static ip= lines, the override file is there
173 [ -e /tmp
/net.
$netif.override
] && .
/tmp
/net.
$netif.override
174 if strglobin
"$ip" '*:*:*'; then
176 echo "IPV6_AUTOCONF=no"
177 echo "IPV6ADDR=\"$ip/$mask\""
179 if [ -f /tmp
/net.
$netif.has_ibft_config
]; then
180 echo "BOOTPROTO=ibft"
182 echo "BOOTPROTO=none"
183 echo "IPADDR=\"$ip\""
184 if strstr
"$mask" "."; then
185 echo "NETMASK=\"$mask\""
187 echo "PREFIX=\"$mask\""
191 if strglobin
"$gw" '*:*:*'; then
192 echo "IPV6_DEFAULTGW=\"$gw\""
193 elif [ -n "$gw" ]; then
194 echo "GATEWAY=\"$gw\""
197 [ -n "$mtu" ] && echo "MTU=\"$mtu\""
198 } > /tmp
/ifcfg
/ifcfg-
$netif
200 # bridge needs different things written to ifcfg
201 if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
205 [ -n "$mtu" ] && echo "MTU=\"$mtu\""
206 } >> /tmp
/ifcfg
/ifcfg-
$netif
209 if [ -n "$vlan" ] ; then
212 echo "NAME=\"$netif\""
214 echo "PHYSDEV=\"$phydevice\""
215 } >> /tmp
/ifcfg
/ifcfg-
$netif
218 if [ -n "$bond" ] ; then
221 # This variable is an indicator of a bond interface for initscripts
222 echo "BONDING_OPTS=\"$bondoptions\""
223 echo "NAME=\"$netif\""
225 } >> /tmp
/ifcfg
/ifcfg-
$netif
227 for slave
in $bondslaves ; do
228 # write separate ifcfg file for the raw eth interface
230 echo "# Generated by dracut initrd"
231 echo "NAME=\"$slave\""
236 echo "MASTER=\"$netif\""
237 echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
239 [ -e /tmp
/net.
$slave.override
] && .
/tmp
/net.
$slave.override
240 interface_bind
"$slave" "$macaddr"
241 ) >> /tmp
/ifcfg
/ifcfg-
$slave
245 if [ -n "$bridge" ] ; then
249 echo "NAME=\"$netif\""
250 } >> /tmp
/ifcfg
/ifcfg-
$netif
251 for slave
in $bridgeslaves ; do
252 # write separate ifcfg file for the raw eth interface
254 echo "# Generated by dracut initrd"
255 echo "NAME=\"$slave\""
259 echo "BRIDGE=\"$bridgename\""
260 echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
262 [ -e /tmp
/net.
$slave.override
] && .
/tmp
/net.
$slave.override
263 interface_bind
"$slave" "$macaddr"
264 ) >> /tmp
/ifcfg
/ifcfg-
$slave
268 for ns
in $
(getargs nameserver
); do
269 echo "DNS${i}=\"${ns}\"" >> /tmp
/ifcfg
/ifcfg-
$netif
273 [ -f /tmp
/net.route6.
"$netif" ] && cp /tmp
/net.route6.
"$netif" /tmp
/ifcfg
/route6-
"$netif"
274 [ -f /tmp
/net.route.
"$netif" ] && cp /tmp
/net.route.
"$netif" /tmp
/ifcfg
/route-
"$netif"
278 mkdir
-m 0755 -p /run
/initramfs
/state
/etc
/sysconfig
/network-scripts
279 mkdir
-m 0755 -p /run
/initramfs
/state
/var
/lib
/dhclient
280 echo "files /etc/sysconfig/network-scripts" >> /run
/initramfs
/rwtab
281 echo "files /var/lib/dhclient" >> /run
/initramfs
/rwtab
283 cp /tmp
/net.
* /run
/initramfs
/
284 cp /tmp
/net.
$netif.resolv.conf
/run
/initramfs
/state
/etc
/resolv.conf
285 copytree
/tmp
/ifcfg
/run
/initramfs
/state
/etc
/sysconfig
/network-scripts
286 cp /tmp
/ifcfg-leases
/* /run
/initramfs
/state
/var
/lib
/dhclient