From 7ab83b857125c46a1a891ea62c9610345ff77e2a Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Tue, 15 Nov 2011 19:37:10 -0300 Subject: [hooks/archiso_pxe_nbd] Remove grep usage Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso_pxe_nbd | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'archiso/hooks/archiso_pxe_nbd') diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd index cc21c2b..cdf4392 100644 --- a/archiso/hooks/archiso_pxe_nbd +++ b/archiso/hooks/archiso_pxe_nbd @@ -1,6 +1,6 @@ # vim: set ft=sh: 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 @@ -8,9 +8,14 @@ run_hook () { if [ -n "${BOOTIF}" ]; then bootif_mac=${BOOTIF#01-} bootif_mac=${bootif_mac//-/:} - bootif_dev=$(grep -l ${bootif_mac} /sys/class/net/*/address) - bootif_dev=${bootif_dev#/sys/class/net/} - bootif_dev=${bootif_dev%/address} + for i in /sys/class/net/*/address; do + read net_mac < ${i} + if [ "${bootif_mac}" == "${net_mac}" ]; then + bootif_dev=${i#/sys/class/net/} + bootif_dev=${bootif_dev%/address} + break + fi + done ip="${ip}::${bootif_dev}" fi -- cgit v1.2.3-70-g09d2