]> git.ozlabs.org Git - petitboot/commitdiff
utils/pb-udhcpc: Unify references to DHCP bootfile parameter
authorJeremy Kerr <jk@ozlabs.org>
Mon, 20 Jan 2014 00:58:49 +0000 (08:58 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 21 Jan 2014 05:36:01 +0000 (13:36 +0800)
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>
discover/user-event.c
utils/pb-udhcpc

index 7acd237234848d453740592cc0d16c2cad09a78d..dc671d948fb04aa28c80c56caabebda01da3d0f4 100644 (file)
@@ -89,9 +89,9 @@ static struct resource *user_event_resource(struct discover_boot_option *opt,
                return NULL;
        }
 
                return NULL;
        }
 
-       boot_file = event_get_param(event, "boot_file");
+       boot_file = event_get_param(event, "bootfile");
        if (!boot_file) {
        if (!boot_file) {
-               pb_log("%s: boot_file not found\n", __func__);
+               pb_log("%s: bootfile not found\n", __func__);
                return NULL;
        }
 
                return NULL;
        }
 
index f0703ae6df75ff55ba1ac3b9bd897a92afb956ac..7ed9035d5e9dad89f7880a0815e645320b8939d4 100644 (file)
@@ -29,17 +29,18 @@ pb_add () {
 
        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
 
        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;
         do
                 value=$(eval "echo \${$name}")
                 [ -n "$value" ] || continue;
@@ -47,11 +48,12 @@ pb_add () {
                 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_remove () {
 }
 
 pb_remove () {
-       pb-event remove@${interface} name=netboot
+       pb-event remove@${interface}
 }
 
 case "$1" in
 }
 
 case "$1" in