Fall back to checking sysext backing device
Add a unit test for gpt-auto-generator, that mimics a sysext setup.
This commit is contained in:
committed by
Kai Wohlfahrt
parent
31584c62d3
commit
e8807add48
@@ -17,9 +17,12 @@
|
||||
#include "devnum-util.h"
|
||||
#include "dirent-util.h"
|
||||
#include "errno-util.h"
|
||||
#include "extension-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
#include "macro.h"
|
||||
#include "os-util.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "string-util.h"
|
||||
@@ -875,6 +878,13 @@ int blockdev_get_root(int level, dev_t *ret) {
|
||||
return btrfs_log_dev_root(level, r, "/usr");
|
||||
if (r < 0)
|
||||
return log_full_errno(level, r, "Failed to determine block device of /usr/ file system: %m");
|
||||
if (r == 0) { /* Not backed by a single block device, we might be looking at a sysext overlay */
|
||||
r = extension_overlay_block("/usr", IMAGE_SYSEXT, &devno);
|
||||
if (IN_SET(r, -ENOENT, -ENOTTY))
|
||||
r = 0; /* no sysext overlay metadata */
|
||||
else if (r < 0)
|
||||
return log_full_errno(level, r, "Failed to determine backing device of /usr/ extension overlay: %m");
|
||||
}
|
||||
if (r == 0) { /* /usr/ not backed by single block device, either. */
|
||||
log_debug("Neither root nor /usr/ file system are on a (single) block device.");
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "log.h"
|
||||
#include "macro.h"
|
||||
#include "os-util.h"
|
||||
#include "path-util.h"
|
||||
#include "stat-util.h"
|
||||
@@ -192,6 +193,7 @@ int extension_overlay_block(const char *p, ImageClass image_class, dev_t *ret) {
|
||||
|
||||
assert(p);
|
||||
assert(ret);
|
||||
assert(IN_SET(image_class, IMAGE_SYSEXT, IMAGE_CONFEXT));
|
||||
|
||||
/* Tries to read the backing device information systemd-sysext puts in
|
||||
* the virtual file .systemd-sysext/.systemd-confext */
|
||||
|
||||
Reference in New Issue
Block a user