Bug#535008: configure_networking: support BOOTIF variable set by pxelinux
Package: initramfs-tools
Version: 0.85i
Followup-For: Bug #535008
Hi,
you may use the following script as a temporary fix.
Depending on your initrd, you have to put the script (which I call
"pxedev") into one of the following places (putting it in both does not
seem to hurt):
* /etc/initramfs-tools/scripts/nfs-top/pxedev
* /etc/initramfs-tools/scripts/live-premount/pxedev
and then re-generate the initrd.
(Excuse the anachronistic shell-scripting style; this has to work with
minimal Bourne shell clones.)
Regards,
Christoph
#!/bin/sh
case $1 in
prereqs) exit 0;;
esac
. /conf/initramfs.conf
echo '*******************************************************************'
echo '* pxedev auto-detection: *'
echo "* DEVICE is ${DEVICE:-not set}."
# The BOOTIF parameter will be set by pxelinux if the line "ipappend 2"
# is in pxelinux.cfg
BOOTIF=
for bootparam in $(cat /proc/cmdline); do
case $bootparam in
BOOTIF=*)
BOOTIF=${bootparam#BOOTIF=}
BOOTIF=${BOOTIF#01-}
BOOTIF=$(echo "$BOOTIF" | tr '.-' '.:')
echo "* pxelinux tells us, BOOTIF=$BOOTIF"
;;
esac
done
if [ -z "$BOOTIF" ]; then
echo '* pxelinux did not give us a mac address'
else
bootdevname=
for devpath in /sys/class/net/*; do
dev=${devpath##*/}
addr=$(cat "$devpath/address")
echo -n "* $dev has address $addr"
if [ "x$BOOTIF" = "x$addr" ]; then
echo -n ' [AHA!]'
bootdevname=$dev
fi
echo
done
if [ "x$bootdevname" = x ]; then
echo '* No matching device found :('
elif [ "x$DEVICE" = "x$bootdevname" ]; then
echo '* DEVICE already matches BOOTIF, leaving it as it is'
else
echo "* Setting DEVICE to $bootdevname"
echo "DEVICE=$bootdevname" >> /conf/param.conf
fi
fi
echo '*******************************************************************'
Reply to: