X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=utils%2Fpb-udhcpc;h=7ed9035d5e9dad89f7880a0815e645320b8939d4;hp=4ff0dcf2dc9328d71cd8deaff2b69e4120a2dc58;hb=0611a74491328d9ce346957c2320310a21caa8a9;hpb=08e967ee301b502b2114e3855210a0b2600d095c diff --git a/utils/pb-udhcpc b/utils/pb-udhcpc index 4ff0dcf..7ed9035 100644 --- a/utils/pb-udhcpc +++ b/utils/pb-udhcpc @@ -14,11 +14,12 @@ pb_add () { # parameter was in the header, or specified by options [ -z "$bootfile" ] && bootfile=${boot_file} - mac=$(< /sys/class/net/$interface/address) + mac=$(cat /sys/class/net/$interface/address) paramstr='' # Collect relevant DHCP response parameters into $paramstr - for name in pxeconffile bootfile mac ip siaddr serverid tftp + for name in pxeconffile pxepathprefix bootfile mac ip siaddr \ + serverid tftp do value=$(eval "echo \${$name}") [ -n "$value" ] || continue; @@ -26,19 +27,20 @@ pb_add () { paramstr="$paramstr $name=$value" done - 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}" ] then return; fi - # Finally, add an option for the boot_file parameter - paramstr='name=netboot' + paramstr="" - # 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; @@ -46,11 +48,12 @@ pb_add () { paramstr="$paramstr $name=$value" done - pb-event add@{interface} $paramstr + pb-event add@${interface} name="netboot $interface ($bootfile)" \ + $paramstr } pb_remove () { - pb-event remove@${interface} name=netboot + pb-event remove@${interface} } case "$1" in