summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-11-12 12:48:39 +0100
committerLennart Poettering <lennart@poettering.net>2025-01-03 10:12:23 +0100
commit41c2a5b0b9f6f719c9bd3269b08b8832ce74a60b (patch)
tree44993a5ed251de8d9af599313f5e827079fa64d8
parentdebug-generator: rework from post-merge review #35410 (#35696) (diff)
downloadsystemd-41c2a5b0b9f6f719c9bd3269b08b8832ce74a60b.tar.xz
systemd-41c2a5b0b9f6f719c9bd3269b08b8832ce74a60b.zip
dissect: show all kinds of images in --discover
Given that systemd-dissect can nowadays operate on plain directories, let's include directory images in the --discover output too. Replace the filter with a filter for hidden images instead, as suddenly the root fs image (which is a directory image ".host") otherwise shows up.
-rw-r--r--man/systemd-dissect.xml9
-rw-r--r--src/dissect/dissect.c10
2 files changed, 18 insertions, 1 deletions
diff --git a/man/systemd-dissect.xml b/man/systemd-dissect.xml
index fccc61c6d8..3aaa1744f3 100644
--- a/man/systemd-dissect.xml
+++ b/man/systemd-dissect.xml
@@ -514,6 +514,15 @@
<xi:include href="version-info.xml" xpointer="v258"/></listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--all</option></term>
+
+ <listitem><para>If combined with <option>--discover</option>, also shows images that start with a
+ dot, i.e. hidden images.</para>
+
+ <xi:include href="version-info.xml" xpointer="v258"/></listitem>
+ </varlistentry>
+
<xi:include href="standard-options.xml" xpointer="image-policy-open" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
<xi:include href="standard-options.xml" xpointer="no-legend" />
diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
index 8739e130c3..cdc4f77015 100644
--- a/src/dissect/dissect.c
+++ b/src/dissect/dissect.c
@@ -96,6 +96,7 @@ static ImagePolicy *arg_image_policy = NULL;
static bool arg_mtree_hash = true;
static bool arg_via_service = false;
static RuntimeScope arg_runtime_scope = _RUNTIME_SCOPE_INVALID;
+static bool arg_all = false;
STATIC_DESTRUCTOR_REGISTER(arg_image, freep);
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
@@ -154,6 +155,7 @@ static int help(void) {
" --mtree-hash=BOOL Whether to include SHA256 hash in the mtree output\n"
" --user Discover user images\n"
" --system Discover system images\n"
+ " --all Show hidden images too\n"
"\n%3$sCommands:%4$s\n"
" -h --help Show this help\n"
" --version Show package version\n"
@@ -279,6 +281,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_MAKE_ARCHIVE,
ARG_SYSTEM,
ARG_USER,
+ ARG_ALL,
};
static const struct option options[] = {
@@ -314,6 +317,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "make-archive", no_argument, NULL, ARG_MAKE_ARCHIVE },
{ "system", no_argument, NULL, ARG_SYSTEM },
{ "user", no_argument, NULL, ARG_USER },
+ { "all", no_argument, NULL, ARG_ALL },
{}
};
@@ -554,6 +558,10 @@ static int parse_argv(int argc, char *argv[]) {
user_scope_requested = true;
break;
+ case ARG_ALL:
+ arg_all = true;
+ break;
+
case '?':
return -EINVAL;
@@ -1889,7 +1897,7 @@ static int action_discover(void) {
HASHMAP_FOREACH(img, images) {
- if (!IN_SET(img->type, IMAGE_RAW, IMAGE_BLOCK))
+ if (!arg_all && startswith(img->name, "."))
continue;
r = table_add_many(