On Sun, 2009-06-28 at 14:50 -0700, Vagrant Cascadian wrote: > Package: initramfs-tools > Version: 0.93.3 > Severity: wishlist > Tags: patch > > when booting thin clients with multiple network cards, > initramfs-tools/ipconfig > have a hard time figuring out which interface to use. attached is a patch > which > sets DEVICE to the interface matching the mac address that pxelinux passes > when > using the IPAPPEND 2 or 3 options.
This sounds reasonable, but your patch makes unnecessary use of several commands. > diff --git a/scripts/functions b/scripts/functions > index 77de8f3..ec0ffd2 100644 > --- a/scripts/functions > +++ b/scripts/functions > @@ -258,6 +258,19 @@ parse_numeric() { > > configure_networking() > { > + > + # pxelinux sets BOOTIF to a value based on the mac address of the > network > + # card used to PXE boot, so use this value for DEVICE rather than a > + # hard-coded device name from initramfs.conf. this facilitates network > + # booting when machines may have multiple network cards. > + if [ -n "${BOOTIF}" ]; then > + normal_mac=$(echo $BOOTIF | sed -e 's,^01-,,g' -e 's,-,:,g' | > tr [a-z] [A-Z]) You can use sed's y/// command instead of piping to tr. > + new_device=$(ifconfig -a | awk "/$normal_mac/"'{print $1}') [...] You can use the files /sys/class/net/*/address instead of ifconfig. Ben. -- Ben Hutchings When you say `I wrote a program that crashed Windows', people just stare ... and say `Hey, I got those with the system, *for free*'. - Linus Torvalds
signature.asc
Description: This is a digitally signed message part