udhcpc may pass the bootfile parameter as either $bootfile or
$boot_file, depending on whether the option is present in the BOOTP
header, or as a DHCP vendor option. We have code in pb-udhcpc to unify
this to $bootfile, but we only use the unified value in one of the user
events.
This change uses the correct value of bootfile, and fixes the check to
conditionally generate the explicit add event. We also need to update
the user-event code to use the right event parameter name.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
- boot_file = event_get_param(event, "boot_file");
+ boot_file = event_get_param(event, "bootfile");
- pb_log("%s: boot_file not found\n", __func__);
+ pb_log("%s: bootfile not found\n", __func__);
pb-event dhcp@${interface} $paramstr
pb-event dhcp@${interface} $paramstr
- # Check if an explicit config file present
- if [ -n "${conffile}" ]
+ # Check if an explicit boot file present. If there is, add it as
+ # an option directly.
+ if [ -z "${bootfile}" ]
- # Finally, add an option for the boot_file parameter
- paramstr='name=netboot'
- # Collect relevant parameters to add an option to the boot_file parameter
- for name in rootpath siaddr boot_file
+ # Collect relevant parameters to add an option to the bootfile
+ # parameter
+ for name in rootpath siaddr bootfile
do
value=$(eval "echo \${$name}")
[ -n "$value" ] || continue;
do
value=$(eval "echo \${$name}")
[ -n "$value" ] || continue;
paramstr="$paramstr $name=$value"
done
paramstr="$paramstr $name=$value"
done
- pb-event add@${interface} $paramstr
+ pb-event add@${interface} name="netboot $interface ($bootfile)" \
+ $paramstr
- pb-event remove@${interface} name=netboot
+ pb-event remove@${interface}