ifup='/sbin/ifup $env{INTERFACE}'
[ -z "$netroot" ] && ifup="$ifup -m"
- # BOOTIF says everything, use only that one
- BOOTIF=$(getarg 'BOOTIF=')
- if [ -n "$BOOTIF" ] ; then
- BOOTIF=$(fix_bootif "$BOOTIF")
- printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
- echo "[ -f /tmp/setup_net_${BOOTIF}.ok ]" >$hookdir/initqueue/finished/wait-${BOOTIF}.sh
+ runcmd="RUN+=\"/sbin/initqueue --onetime $ifup\""
- # If we have to handle multiple interfaces, handle only them.
- elif [ -n "$IFACES" ] ; then
- for iface in $IFACES ; do
- printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
- if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
- echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
- fi
+ # We have some specific interfaces to handle
+ if [ -n "$IFACES" ]; then
+ echo 'SUBSYSTEM!="net", GOTO="net_end"'
+ echo 'ACTION=="remove", GOTO="net_end"'
+ for iface in $IFACES; do
+ case "$iface" in
+ ??:??:??:??:??:??) # MAC address
+ cond="ATTR{address}==\"$iface\"" ;;
+ ??-??-??-??-??-??) # MAC address in BOOTIF form
+ cond="ATTR{address}==\"$(fix_bootif $iface)\"" ;;
+ *) # an interface name
+ cond="ENV{INTERFACE}==\"$iface\"" ;;
+ esac
+ # The GOTO prevents us from trying to ifup the same device twice
+ echo "$cond, $runcmd, GOTO=\"net_end\""
done
+ echo 'LABEL="net_end"'
for iface in $MASTER_IFACES; do
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
# Default: We don't know the interface to use, handle all
# Fixme: waiting for the interface as well.
else
+ cond='ACTION=="add|change", SUBSYSTEM=="net"'
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
- printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
+ echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
fi
# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh