summaryrefslogtreecommitdiff
path: root/src/dissect/dissect.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-23 17:10:42 +0100
committerLennart Poettering <lennart@poettering.net>2017-02-07 12:21:28 +0100
commit78ebe98061eb527f17691929f470f262a7ab2c8f (patch)
tree59683606cfb85012fb77d4416a95ffa4144c0acd /src/dissect/dissect.c
parent915e6d1676cf73c4f927f3bbfa21ee82640b1832 (diff)
core,nspawn,dissect: make nspawn's .roothash file search reusable
This makes nspawn's logic of automatically discovering the root hash of an image file generic, and then reuses it in systemd-dissect and in PID1's RootImage= logic, so that verity is automatically set up whenever we can.
Diffstat (limited to 'src/dissect/dissect.c')
-rw-r--r--src/dissect/dissect.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
index fd9db5ba87..59bd7d9e84 100644
--- a/src/dissect/dissect.c
+++ b/src/dissect/dissect.c
@@ -191,6 +191,14 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ if (!arg_root_hash) {
+ r = root_hash_load(arg_image, &arg_root_hash, &arg_root_hash_size);
+ if (r < 0) {
+ log_error_errno(r, "Failed to read root hash file for %s: %m", arg_image);
+ goto finish;
+ }
+ }
+
r = dissect_image(d->fd, arg_root_hash, arg_root_hash_size, arg_flags, &m);
if (r == -ENOPKG) {
log_error_errno(r, "Couldn't identify a suitable partition table or file system in %s.", arg_image);