[hooks/archiso_pxe_nbd] Remove grep usage

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
This commit is contained in:
Gerardo Exequiel Pozzi 2011-11-15 19:37:10 -03:00
parent 469b5b2c58
commit 7ab83b8571

View File

@ -1,6 +1,6 @@
# vim: set ft=sh: # vim: set ft=sh:
run_hook () { run_hook () {
local line i address netmask gateway dns0 dns1 rootserver rootpath filename local line i net_mac bootif_mac bootif_dev address netmask gateway dns0 dns1 rootserver rootpath filename
: > /ip_opts : > /ip_opts
@ -8,9 +8,14 @@ run_hook () {
if [ -n "${BOOTIF}" ]; then if [ -n "${BOOTIF}" ]; then
bootif_mac=${BOOTIF#01-} bootif_mac=${BOOTIF#01-}
bootif_mac=${bootif_mac//-/:} bootif_mac=${bootif_mac//-/:}
bootif_dev=$(grep -l ${bootif_mac} /sys/class/net/*/address) for i in /sys/class/net/*/address; do
bootif_dev=${bootif_dev#/sys/class/net/} read net_mac < ${i}
if [ "${bootif_mac}" == "${net_mac}" ]; then
bootif_dev=${i#/sys/class/net/}
bootif_dev=${bootif_dev%/address} bootif_dev=${bootif_dev%/address}
break
fi
done
ip="${ip}::${bootif_dev}" ip="${ip}::${bootif_dev}"
fi fi