|
|
@ -4,10 +4,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
# NFS root might have reached here before /tmp/net.ifaces was written |
|
|
|
# NFS root might have reached here before /tmp/net.ifaces was written |
|
|
|
udevadm settle --timeout=30 |
|
|
|
udevadm settle --timeout=30 |
|
|
|
# Don't write anything if we don't know our bootdev |
|
|
|
|
|
|
|
[ -f /tmp/net.ifaces ] || return 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
read IFACES < /tmp/net.ifaces |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -e /tmp/bridge.info ]; then |
|
|
|
if [ -e /tmp/bridge.info ]; then |
|
|
|
. /tmp/bridge.info |
|
|
|
. /tmp/bridge.info |
|
|
@ -79,15 +75,25 @@ print_s390() { |
|
|
|
echo "OPTIONS=\"${OPTIONS}\"" |
|
|
|
echo "OPTIONS=\"${OPTIONS}\"" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for netup in /tmp/net.*.did-setup ; do |
|
|
|
|
|
|
|
[ -f $netup ] || continue |
|
|
|
|
|
|
|
|
|
|
|
for netif in $IFACES ; do |
|
|
|
netif=${netup%%.did-setup} |
|
|
|
|
|
|
|
netif=${netif##*/net.} |
|
|
|
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue |
|
|
|
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue |
|
|
|
# bridge? |
|
|
|
|
|
|
|
unset bridge |
|
|
|
unset bridge |
|
|
|
unset bond |
|
|
|
unset bond |
|
|
|
unset bondslaves |
|
|
|
unset bondslaves |
|
|
|
unset bondname |
|
|
|
unset bondname |
|
|
|
unset bondoptions |
|
|
|
unset bondoptions |
|
|
|
|
|
|
|
unset uuid |
|
|
|
|
|
|
|
unset ip |
|
|
|
|
|
|
|
unset gw |
|
|
|
|
|
|
|
unset mtu |
|
|
|
|
|
|
|
unset mask |
|
|
|
|
|
|
|
unset macaddr |
|
|
|
|
|
|
|
unset slave |
|
|
|
|
|
|
|
unset ethname |
|
|
|
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info |
|
|
|
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info |
|
|
|
|
|
|
|
|
|
|
|
uuid=$(cat /proc/sys/kernel/random/uuid) |
|
|
|
uuid=$(cat /proc/sys/kernel/random/uuid) |
|
|
@ -100,45 +106,46 @@ for netif in $IFACES ; do |
|
|
|
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr |
|
|
|
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr |
|
|
|
{ |
|
|
|
{ |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "DEVICE=$netif" |
|
|
|
echo "DEVICE=\"$netif\"" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
echo "UUID=$uuid" |
|
|
|
echo "UUID=\"$uuid\"" |
|
|
|
[ -n "$mtu" ] && echo "MTU=$mtu" |
|
|
|
if [ -f /tmp/dhclient.$netif.lease ]; then |
|
|
|
if [ -f /tmp/net.$netif.lease ]; then |
|
|
|
[ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts |
|
|
|
strstr "$ip" '*:*:*' && echo "IPV6INIT=yes" |
|
|
|
strstr "$ip" '*:*:*' && echo "IPV6INIT=yes" |
|
|
|
if [ -f /tmp/net.$netif.has_ibft_config ]; then |
|
|
|
if [ -f /tmp/net.$netif.has_ibft_config ]; then |
|
|
|
echo "BOOTPROTO=ibft" |
|
|
|
echo "BOOTPROTO=ibft" |
|
|
|
else |
|
|
|
else |
|
|
|
echo "BOOTPROTO=dhcp" |
|
|
|
echo "BOOTPROTO=dhcp" |
|
|
|
fi |
|
|
|
fi |
|
|
|
cp /tmp/net.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease |
|
|
|
cp /tmp/dhclient.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease |
|
|
|
else |
|
|
|
else |
|
|
|
# If we've booted with static ip= lines, the override file is there |
|
|
|
# If we've booted with static ip= lines, the override file is there |
|
|
|
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override |
|
|
|
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override |
|
|
|
if strstr "$ip" '*:*:*'; then |
|
|
|
if strstr "$ip" '*:*:*'; then |
|
|
|
echo "IPV6INIT=yes" |
|
|
|
echo "IPV6INIT=yes" |
|
|
|
echo "IPV6_AUTOCONF=no" |
|
|
|
echo "IPV6_AUTOCONF=no" |
|
|
|
echo "IPV6ADDR=$ip/$mask" |
|
|
|
echo "IPV6ADDR=\"$ip/$mask\"" |
|
|
|
else |
|
|
|
else |
|
|
|
if [ -f /tmp/net.$netif.has_ibft_config ]; then |
|
|
|
if [ -f /tmp/net.$netif.has_ibft_config ]; then |
|
|
|
echo "BOOTPROTO=ibft" |
|
|
|
echo "BOOTPROTO=ibft" |
|
|
|
else |
|
|
|
else |
|
|
|
echo "BOOTPROTO=none" |
|
|
|
echo "BOOTPROTO=none" |
|
|
|
echo "IPADDR=$ip" |
|
|
|
echo "IPADDR=\"$ip\"" |
|
|
|
if strstr "$mask" "."; then |
|
|
|
if strstr "$mask" "."; then |
|
|
|
echo "NETMASK=$mask" |
|
|
|
echo "NETMASK=\"$mask\"" |
|
|
|
else |
|
|
|
else |
|
|
|
echo "PREFIX=$mask" |
|
|
|
echo "PREFIX=\"$mask\"" |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
if strstr "$gw" '*:*:*'; then |
|
|
|
if strstr "$gw" '*:*:*'; then |
|
|
|
echo "IPV6_DEFAULTGW=$gw" |
|
|
|
echo "IPV6_DEFAULTGW=\"$gw\"" |
|
|
|
elif [ -n "$gw" ]; then |
|
|
|
elif [ -n "$gw" ]; then |
|
|
|
echo "GATEWAY=$gw" |
|
|
|
echo "GATEWAY=\"$gw\"" |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
[ -n "$mtu" ] && echo "MTU=\"$mtu\"" |
|
|
|
} > /tmp/ifcfg/ifcfg-$netif |
|
|
|
} > /tmp/ifcfg/ifcfg-$netif |
|
|
|
|
|
|
|
|
|
|
|
# bridge needs different things written to ifcfg |
|
|
|
# bridge needs different things written to ifcfg |
|
|
@ -146,14 +153,14 @@ for netif in $IFACES ; do |
|
|
|
# standard interface |
|
|
|
# standard interface |
|
|
|
{ |
|
|
|
{ |
|
|
|
if [ -n "$macaddr" ]; then |
|
|
|
if [ -n "$macaddr" ]; then |
|
|
|
echo "MACADDR=$macaddr" |
|
|
|
echo "MACADDR=\"$macaddr\"" |
|
|
|
else |
|
|
|
else |
|
|
|
echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\"" |
|
|
|
echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\"" |
|
|
|
fi |
|
|
|
fi |
|
|
|
print_s390 $netif |
|
|
|
print_s390 $netif |
|
|
|
echo "TYPE=Ethernet" |
|
|
|
echo "TYPE=Ethernet" |
|
|
|
echo "NAME=\"$netif\"" |
|
|
|
echo "NAME=\"$netif\"" |
|
|
|
[ -n "$mtu" ] && echo "MTU=$mtu" |
|
|
|
[ -n "$mtu" ] && echo "MTU=\"$mtu\"" |
|
|
|
} >> /tmp/ifcfg/ifcfg-$netif |
|
|
|
} >> /tmp/ifcfg/ifcfg-$netif |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
@ -170,14 +177,14 @@ for netif in $IFACES ; do |
|
|
|
# write separate ifcfg file for the raw eth interface |
|
|
|
# write separate ifcfg file for the raw eth interface |
|
|
|
{ |
|
|
|
{ |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "DEVICE=$slave" |
|
|
|
echo "DEVICE=\"$slave\"" |
|
|
|
echo "TYPE=Ethernet" |
|
|
|
echo "TYPE=Ethernet" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
echo "HWADDR=$(cat /sys/class/net/$slave/address)" |
|
|
|
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\"" |
|
|
|
echo "SLAVE=yes" |
|
|
|
echo "SLAVE=yes" |
|
|
|
echo "MASTER=$netif" |
|
|
|
echo "MASTER=\"$netif\"" |
|
|
|
echo "NAME=$slave" |
|
|
|
echo "NAME=\"$slave\"" |
|
|
|
} >> /tmp/ifcfg/ifcfg-$slave |
|
|
|
} >> /tmp/ifcfg/ifcfg-$slave |
|
|
|
done |
|
|
|
done |
|
|
|
fi |
|
|
|
fi |
|
|
@ -191,45 +198,45 @@ for netif in $IFACES ; do |
|
|
|
if [ "$ethname" = "$bondname" ] ; then |
|
|
|
if [ "$ethname" = "$bondname" ] ; then |
|
|
|
{ |
|
|
|
{ |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "DEVICE=$bondname" |
|
|
|
echo "DEVICE=\"$bondname\"" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
# This variable is an indicator of a bond interface for initscripts |
|
|
|
# This variable is an indicator of a bond interface for initscripts |
|
|
|
echo "BONDING_OPTS=\"$bondoptions\"" |
|
|
|
echo "BONDING_OPTS=\"$bondoptions\"" |
|
|
|
echo "BRIDGE=$netif" |
|
|
|
echo "BRIDGE=\"$netif\"" |
|
|
|
echo "NAME=\"$bondname\"" |
|
|
|
echo "NAME=\"$bondname\"" |
|
|
|
} >> /tmp/ifcfg/ifcfg-$bondname |
|
|
|
} >> /tmp/ifcfg/ifcfg-$bondname |
|
|
|
for slave in $bondslaves ; do |
|
|
|
for slave in $bondslaves ; do |
|
|
|
# write separate ifcfg file for the raw eth interface |
|
|
|
# write separate ifcfg file for the raw eth interface |
|
|
|
{ |
|
|
|
{ |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "DEVICE=$slave" |
|
|
|
echo "DEVICE=\"$slave\"" |
|
|
|
echo "TYPE=Ethernet" |
|
|
|
echo "TYPE=Ethernet" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
echo "HWADDR=$(cat /sys/class/net/$slave/address)" |
|
|
|
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\"" |
|
|
|
echo "SLAVE=yes" |
|
|
|
echo "SLAVE=yes" |
|
|
|
echo "MASTER=$bondname" |
|
|
|
echo "MASTER=\"$bondname\"" |
|
|
|
echo "NAME=$slave" |
|
|
|
echo "NAME=\"$slave\"" |
|
|
|
} >> /tmp/ifcfg/ifcfg-$slave |
|
|
|
} >> /tmp/ifcfg/ifcfg-$slave |
|
|
|
done |
|
|
|
done |
|
|
|
else |
|
|
|
else |
|
|
|
# write separate ifcfg file for the raw eth interface |
|
|
|
# write separate ifcfg file for the raw eth interface |
|
|
|
{ |
|
|
|
{ |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "# Generated by dracut initrd" |
|
|
|
echo "DEVICE=$ethname" |
|
|
|
echo "DEVICE=\"$ethname\"" |
|
|
|
echo "TYPE=Ethernet" |
|
|
|
echo "TYPE=Ethernet" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "ONBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
echo "NETBOOT=yes" |
|
|
|
echo "HWADDR=$(cat /sys/class/net/$ethname/address)" |
|
|
|
echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\"" |
|
|
|
echo "BRIDGE=$netif" |
|
|
|
echo "BRIDGE=\"$netif\"" |
|
|
|
echo "NAME=$ethname" |
|
|
|
echo "NAME=\"$ethname\"" |
|
|
|
} >> /tmp/ifcfg/ifcfg-$ethname |
|
|
|
} >> /tmp/ifcfg/ifcfg-$ethname |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
i=1 |
|
|
|
i=1 |
|
|
|
for ns in $(getargs nameserver); do |
|
|
|
for ns in $(getargs nameserver); do |
|
|
|
echo "DNS${i}=${ns}" >> /tmp/ifcfg/ifcfg-$netif |
|
|
|
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif |
|
|
|
i=$((i+1)) |
|
|
|
i=$((i+1)) |
|
|
|
done |
|
|
|
done |
|
|
|
done |
|
|
|
done |
|
|
|