network/net-genrules.sh: react also on NAME

Recent systemd-udevd network renaming rules work on NAME.
Also enqueue only one unique initqueue job.
master
Harald Hoyer 2013-09-10 10:48:18 +02:00
parent 540a5169b9
commit d681df8e5f
1 changed files with 13 additions and 6 deletions

View File

@ -54,23 +54,30 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
ifup='/sbin/ifup $env{INTERFACE}'
[ -z "$netroot" ] && ifup="$ifup -m"

runcmd="RUN+=\"/sbin/initqueue --onetime $ifup\""
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""

# We have some specific interfaces to handle
if [ -n "$IFACES" ]; then
echo 'SUBSYSTEM!="net", GOTO="net_end"'
echo 'ACTION=="remove", GOTO="net_end"'
echo 'ACTION!="add|change|move", GOTO="net_end"'
for iface in $IFACES; do
case "$iface" in
??:??:??:??:??:??) # MAC address
cond="ATTR{address}==\"$iface\"" ;;
cond="ATTR{address}==\"$iface\""
echo "$cond, $runcmd, GOTO=\"net_end\""
;;
??-??-??-??-??-??) # MAC address in BOOTIF form
cond="ATTR{address}==\"$(fix_bootif $iface)\"" ;;
cond="ATTR{address}==\"$(fix_bootif $iface)\""
echo "$cond, $runcmd, GOTO=\"net_end\""
;;
*) # an interface name
cond="ENV{INTERFACE}==\"$iface\"" ;;
cond="ENV{INTERFACE}==\"$iface\""
echo "$cond, $runcmd, GOTO=\"net_end\""
cond="NAME==\"$iface\""
echo "$cond, $runcmd, GOTO=\"net_end\""
;;
esac
# The GOTO prevents us from trying to ifup the same device twice
echo "$cond, $runcmd, GOTO=\"net_end\""
done
echo 'LABEL="net_end"'