]> git.ozlabs.org Git - petitboot/blobdiff - discover/user-event.c
discover/pxe: Fix prefix autodetection when bootfile is in the root dir
[petitboot] / discover / user-event.c
index 7acd237234848d453740592cc0d16c2cad09a78d..cf7f20c599bbefdac3c004834dc75966500a7a4b 100644 (file)
@@ -89,9 +89,9 @@ static struct resource *user_event_resource(struct discover_boot_option *opt,
                return NULL;
        }
 
-       boot_file = event_get_param(event, "boot_file");
+       boot_file = event_get_param(event, "bootfile");
        if (!boot_file) {
-               pb_log("%s: boot_file not found\n", __func__);
+               pb_log("%s: bootfile not found\n", __func__);
                return NULL;
        }
 
@@ -208,7 +208,7 @@ static char *parse_mac_addr(struct discover_context *ctx, const char *mac)
                        mac_addr_arr + 2, mac_addr_arr + 3, mac_addr_arr + 4,
                        mac_addr_arr + 5);
 
-       mac_addr = talloc_asprintf(ctx, "01-%02X-%02X-%02X-%02X-%02X-%02X",
+       mac_addr = talloc_asprintf(ctx, "01-%02x-%02x-%02x-%02x-%02x-%02x",
                        mac_addr_arr[0], mac_addr_arr[1], mac_addr_arr[2],
                        mac_addr_arr[3], mac_addr_arr[4], mac_addr_arr[5]);
 
@@ -290,8 +290,9 @@ struct pb_url *user_event_parse_conf_url(struct discover_context *ctx,
                /* strip filename from the bootfile path, leaving only a
                 * directory */
                p = strrchr(basedir, '/');
-               if (p)
-                       *p = '\0';
+               if (!p)
+                       p = basedir;
+               *p = '\0';
 
                if (strlen(basedir))
                        url_str = talloc_asprintf_append(url_str, "%s/",