2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
5 # pxelinux provides macaddr '-' separated, but we need ':'
9 macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
11 # strip hardware type field from pxelinux
12 [ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
16 # Don't continue if we don't need network
17 [ -z "$netroot" ] && ! getargbool 0 rd.neednet && return;
21 # bridge: attempt only the defined interface
22 if [ -e /tmp/bridge.info ]; then
27 # bond: attempt only the defined interface (override bridge defines)
28 if [ -e /tmp/bond.info ]; then
30 # It is enough to fire up only one
31 IFACES=${bondslaves%% *}
34 ifup='/sbin/ifup $env{INTERFACE}'
35 [ -z "$netroot" ] && ifup="$ifup -m"
37 # BOOTIF says everything, use only that one
38 BOOTIF=$(getarg 'BOOTIF=')
39 if [ -n "$BOOTIF" ] ; then
40 BOOTIF=$(fix_bootif "$BOOTIF")
41 printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
43 # If we have to handle multiple interfaces, handle only them.
44 elif [ -n "$IFACES" ] ; then
45 for iface in $IFACES ; do
46 printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
49 # Default: We don't know the interface to use, handle all
51 printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup"
54 } > /etc/udev/rules.d/60-net.rules