#include <assert.h>
+#include <inttypes.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
unit++;
}
update = talloc_asprintf(handler,
- _("%u %s downloading: %.0f%% - %lu%cB"),
+ _("%u %s downloading: %.0f%% - %" PRIu64 "%cB"),
handler->n_progress,
ngettext("item", "items", handler->n_progress),
(current / total) * 100, current_converted,
int boot_match = autoboot_option_priority(config, opt);
if (boot_match > 0)
return boot_match;
+ } else {
+ /* If there is no specific boot order, boot any device */
+ return DEFAULT_PRIORITY_LOCAL_FIRST;
}
/* If the option didn't match any entry in the array, it is disabled */
mac = event_get_param(event, "mac");
char *url = talloc_asprintf(event, "file://%s", result->local);
- event_set_param(event, "pxeconffile", url);
+ event_set_param(event, "pxeconffile-local", url);
dev = discover_device_create(handler, mac, event->device);
ctx = device_handler_discover_context_create(handler, dev);
tmp = handler->plugins[i];
/* If both id and version match, ignore */
if (strncmp(opt->id, tmp->id, strlen(opt->id)) == 0 &&
- strncmp(opt->version, tmp->version,
- strlen(opt->version) == 0)) {
+ strcmp(opt->version, tmp->version) == 0) {
pb_log("discover: Plugin '%s' already exists, ignoring\n",
opt->id);
return;
rc = try_mount(device_path, dev->mount_path, fstype,
MS_RDONLY | MS_SILENT, dev->ramdisk);
+ /* If mount fails clean up any snapshot and try again */
+ if (rc && dev->ramdisk) {
+ pb_log("couldn't mount snapshot for %s: mount failed: %s\n",
+ device_path, strerror(errno));
+ pb_log("falling back to actual device\n");
+
+ devmapper_destroy_snapshot(dev);
+
+ device_path = get_device_path(dev);
+ pb_log("mounting device %s read-only\n", dev->device_path);
+ rc = try_mount(device_path, dev->mount_path, fstype,
+ MS_RDONLY | MS_SILENT, dev->ramdisk);
+ }
+
if (!rc) {
dev->mounted = true;
dev->mounted_rw = false;
pb_log("couldn't mount device %s: mount failed: %s\n",
device_path, strerror(errno));
- /* If mount fails clean up any snapshot */
- devmapper_destroy_snapshot(dev);
-
pb_rmdir_recursive(mount_base(), dev->mount_path);
err_free:
talloc_free(dev->mount_path);