diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-10-10 23:09:45 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-10-11 15:56:08 +0200 |
commit | b2466e05c79e2d1b9c7e42f52574cb299bd77575 (patch) | |
tree | 6208cfd28e9705a113f62cdb0c67fdd84b3aee2c /src/dissect | |
parent | dissect: allow confext/sysext to be in the same image (diff) | |
download | systemd-b2466e05c79e2d1b9c7e42f52574cb299bd77575.tar.xz systemd-b2466e05c79e2d1b9c7e42f52574cb299bd77575.zip |
dissect: move helpers for categorizing DDIs into generic code
These tests are already done at two places, let's unify them in one
place, and tweak them slightly (specifically: require for considering a
DDI bootable in UEFI we also need need an init system inside).
Diffstat (limited to 'src/dissect')
-rw-r--r-- | src/dissect/dissect.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c index a03f9a64db..e232e4f7e5 100644 --- a/src/dissect/dissect.c +++ b/src/dissect/dissect.c @@ -889,15 +889,14 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) { !strv_isempty(m->confext_release)) putc('\n', stdout); - printf(" Use As: %s bootable system for UEFI\n", COLOR_MARK_BOOL(m->partitions[PARTITION_ESP].found)); - - if (m->has_init_system >= 0) - printf(" %s bootable system for container\n", COLOR_MARK_BOOL(m->has_init_system)); - + printf(" Use As: %s bootable system for UEFI\n", + COLOR_MARK_BOOL(dissected_image_is_bootable_uefi(m))); + printf(" %s bootable system for container\n", + COLOR_MARK_BOOL(dissected_image_is_bootable_os(m))); printf(" %s portable service\n", - COLOR_MARK_BOOL(strv_env_pairs_get(m->os_release, "PORTABLE_PREFIXES"))); + COLOR_MARK_BOOL(dissected_image_is_portable(m))); printf(" %s initrd\n", - COLOR_MARK_BOOL(!strv_isempty(m->initrd_release))); + COLOR_MARK_BOOL(dissected_image_is_initrd(m))); for (ImageClass c = _IMAGE_CLASS_EXTENSION_FIRST; c <= _IMAGE_CLASS_EXTENSION_LAST; c++) { const char *string_class = image_class_to_string(c); @@ -942,10 +941,10 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) { JSON_BUILD_PAIR_CONDITION(!strv_isempty(m->initrd_release), "initrdRelease", JSON_BUILD_STRV_ENV_PAIR(m->initrd_release)), JSON_BUILD_PAIR_CONDITION(!strv_isempty(m->sysext_release), "sysextRelease", JSON_BUILD_STRV_ENV_PAIR(m->sysext_release)), JSON_BUILD_PAIR_CONDITION(!strv_isempty(m->confext_release), "confextRelease", JSON_BUILD_STRV_ENV_PAIR(m->confext_release)), - JSON_BUILD_PAIR("useBootableUefi", JSON_BUILD_BOOLEAN(m->partitions[PARTITION_ESP].found)), - JSON_BUILD_PAIR_CONDITION(m->has_init_system >= 0, "useBootableContainer", JSON_BUILD_BOOLEAN(m->has_init_system)), - JSON_BUILD_PAIR("useInitrd", JSON_BUILD_BOOLEAN(!strv_isempty(m->initrd_release))), - JSON_BUILD_PAIR("usePortableService", JSON_BUILD_BOOLEAN(strv_env_pairs_get(m->os_release, "PORTABLE_MATCHES"))), + JSON_BUILD_PAIR("useBootableUefi", JSON_BUILD_BOOLEAN(dissected_image_is_bootable_uefi(m))), + JSON_BUILD_PAIR("useBootableContainer", JSON_BUILD_BOOLEAN(dissected_image_is_bootable_os(m))), + JSON_BUILD_PAIR("useInitrd", JSON_BUILD_BOOLEAN(dissected_image_is_initrd(m))), + JSON_BUILD_PAIR("usePortableService", JSON_BUILD_BOOLEAN(dissected_image_is_portable(m))), JSON_BUILD_PAIR("useSystemExtension", JSON_BUILD_BOOLEAN(strv_contains(sysext_scopes, "system"))), JSON_BUILD_PAIR("useInitRDSystemExtension", JSON_BUILD_BOOLEAN(strv_contains(sysext_scopes, "initrd"))), JSON_BUILD_PAIR("usePortableSystemExtension", JSON_BUILD_BOOLEAN(strv_contains(sysext_scopes, "portable"))), |