From 1b9c43334d1b8d74c0611db4fc27109d4e5948d3 Mon Sep 17 00:00:00 2001 From: Enrico Jorns Date: Fri, 22 Jan 2016 14:00:20 +0100 Subject: [PATCH] install.c: allow auto-detection of nfs boot for testing rauc from nfs If no valid boot source was found matching any of the known slot entries, add a pseudo slot entry for nfs to the list of slots and set it `booted`. Signed-off-by: Enrico Jorns --- src/install.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/install.c b/src/install.c index 8a1c450e6..2484df634 100644 --- a/src/install.c +++ b/src/install.c @@ -188,6 +188,25 @@ gboolean determine_slot_states(GError **error) { } } + /* If no known boot slot was detected, check if booted from nfs and add + * pseudo entry */ + if (!booted) { + if (g_strcmp0(bootname, "/dev/nfs") == 0) { + RaucSlot *slot = g_new0(RaucSlot, 1); + g_message("Booted from nfs, adding dummy slot entry"); + slot->name = g_strdup("slot.dummy.0"); + slot->sclass = g_strdup(""); + slot->device = g_strdup("/dev/nfs"); + slot->type = g_strdup("nfs"); + slot->bootname = g_strdup("net"); + slot->readonly = TRUE; + + g_hash_table_insert(r_context()->config->slots, (gchar*)slot->name, slot); + + booted = slot; + } + } + if (!booted) { g_set_error_literal( error,