The partition enumeration only runs on the main system, and we test that
early, hence no point in repeating this in functions further down the
call chain. But let's keep it in place as assert()s, just in case.
Also, move the top-level in_initrd() into add_mounts(), so that the
tests are nicely encapsulated in the code they protect.
int r;
assert(p);
-
- if (in_initrd()) {
- log_debug("In initrd, ignoring the XBOOTLDR partition.");
- return 0;
- }
+ assert(!in_initrd());
r = path_is_busy("/boot");
if (r < 0)
int r;
assert(p);
-
- if (in_initrd()) {
- log_debug("In initrd, ignoring the ESP.");
- return 0;
- }
+ assert(!in_initrd());
/* Check if there's an existing fstab entry for ESP. If so, we just skip the gpt-auto logic. */
r = fstab_has_node(p->node);
dev_t devno;
int r;
+ if (in_initrd())
+ return 0;
+
r = blockdev_get_root(LOG_ERR, &devno);
if (r < 0)
return r;
return 0;
}
- r = add_root_mount();
-
- if (!in_initrd())
- RET_GATHER(r, add_mounts());
+ r = 0;
+ RET_GATHER(r, add_root_mount());
+ RET_GATHER(r, add_mounts());
return r;
}