2014-04-07 12:38:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# fetch-driver-net - fetch driver from the network.
|
|
|
|
# runs from the "initqueue/online" hook whenever a net interface comes online
|
|
|
|
|
|
|
|
# initqueue/online hook passes interface name as $1
|
|
|
|
netif="$1"
|
|
|
|
|
2016-04-10 04:00:00 +00:00
|
|
|
# No dd_net was requested - exit
|
|
|
|
[ -f /tmp/dd_net ] || return 0
|
2014-04-07 12:38:09 +00:00
|
|
|
|
|
|
|
. /lib/url-lib.sh
|
2016-04-10 04:00:00 +00:00
|
|
|
|
|
|
|
while read dd; do
|
|
|
|
# If we already fetched this URL, skip it
|
|
|
|
grep -Fqx "$dd" /tmp/dd_net.done && continue
|
|
|
|
# Otherwise try to fetch it
|
|
|
|
info "Fetching driverdisk from $dd"
|
|
|
|
if driver=$(fetch_url "$dd"); then
|
|
|
|
echo "$dd" >> /tmp/dd_net.done # mark it done so we don't fetch it again
|
|
|
|
driver-updates --net "$dd" "$driver"
|
|
|
|
else
|
|
|
|
warn "Failed to fetch driver from $dd"
|
|
|
|
fi
|
|
|
|
done < /tmp/dd_net
|