# Run the "online" hook
printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n'
+ # And make sure we run setup_net at the start of the hook
+ echo '. /lib/net-lib.sh; setup_net $netif' > \
+ $hookdir/initqueue/online/05-setup_net.sh
} > /etc/udev/rules.d/60-net.rules
ip link set $netif down
ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf
+ rm -f /tmp/net.$netif.did-setup
# TODO: send "offline" uevent?
}
setup_net() {
local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
[ -e /tmp/net.$netif.up ] || return 1
+ [ -e /tmp/net.$netif.did-setup ] && return
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
[ -z "$IFACES" ] && IFACES="$netif"
for iface in $IFACES ; do
if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
info "Resolving $dest via ARP on $netif failed"
fi
+ > /tmp/net.$netif.did-setup
}
set_ifname() {