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 @@
+
+
+
+ If combined with , also shows images that start with a
+ dot, i.e. hidden images.
+
+
+
+
diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
index 8739e130c3..7709f42c48 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,18 +1897,21 @@ 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(
t,
TABLE_STRING, img->name,
+ TABLE_SET_COLOR, startswith(img->name, ".") ? ANSI_GREY : NULL,
TABLE_STRING, image_type_to_string(img->type),
TABLE_STRING, image_class_to_string(img->class),
TABLE_BOOLEAN, img->read_only,
+ TABLE_SET_COLOR, !img->read_only ? ANSI_HIGHLIGHT_GREEN : ANSI_HIGHLIGHT_RED,
TABLE_PATH, img->path,
TABLE_TIMESTAMP, img->mtime != 0 ? img->mtime : img->crtime,
- TABLE_SIZE, img->usage);
+ TABLE_SIZE, img->usage,
+ TABLE_SET_COLOR, img->usage <= 0 ? ANSI_HIGHLIGHT_RED : NULL);
if (r < 0)
return table_log_add_error(r);
}
@@ -2055,6 +2066,16 @@ static int run(int argc, char *argv[]) {
return r;
}
+ if (arg_root) {
+ r = path_pick_update_warn(
+ &arg_root,
+ &pick_filter_image_dir,
+ PICK_ARCHITECTURE|PICK_TRIES,
+ /* ret_result= */ NULL);
+ if (r < 0)
+ return r;
+ }
+
switch (arg_action) {
case ACTION_UMOUNT:
return action_umount(arg_path);