]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysext: support --mutable=help
authorPascal Bachor <bachorp@users.noreply.github.com>
Fri, 26 Sep 2025 18:20:31 +0000 (20:20 +0200)
committerPascal Bachor <bachorp@users.noreply.github.com>
Fri, 26 Sep 2025 18:20:31 +0000 (20:20 +0200)
man/systemd-sysext.xml
src/sysext/sysext.c

index 8705fa7275d8603916cd22189357dbba345cebdf..050e21fafcbcdfffe7fc4836a6f10958732639b4 100644 (file)
       </varlistentry>
 
       <varlistentry>
-        <term><option>--mutable=<replaceable>BOOL</replaceable>|<replaceable>auto</replaceable>|<replaceable>import</replaceable>|<replaceable>ephemeral</replaceable>|<replaceable>ephemeral-import</replaceable></option></term>
-        <listitem><para>Set mutable mode.</para>
+        <term><option>--mutable=<replaceable>BOOL</replaceable>|<replaceable>auto</replaceable>|<replaceable>import</replaceable>|<replaceable>ephemeral</replaceable>|<replaceable>ephemeral-import</replaceable>|<replaceable>help</replaceable></option></term>
+        <listitem><para>Set mutable mode. The special value <literal>help</literal> will list the known values.</para>
 
         <variablelist>
           <varlistentry>
             with the modifications made to the host file system being discarded after unmerge.</para>
             <xi:include href="version-info.xml" xpointer="v256"/></listitem>
           </varlistentry>
+
+          <varlistentry>
+            <term><option>help</option></term>
+            <listitem><para>list known values and exit immediately.</para>
+            <xi:include href="version-info.xml" xpointer="v259"/></listitem>
+          </varlistentry>
         </variablelist>
 
         <xi:include href="version-info.xml" xpointer="v256"/></listitem>
index 5255ac1df1cf083735127cfd0de09091755023db..c88c10429600f40be8cb4af32ce4381427977a0f 100644 (file)
@@ -79,7 +79,7 @@ static const char* const mutable_mode_table[_MUTABLE_MAX] = {
         [MUTABLE_EPHEMERAL_IMPORT] = "ephemeral-import",
 };
 
-DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(mutable_mode, MutableMode, MUTABLE_YES);
+DEFINE_PRIVATE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(mutable_mode, MutableMode, MUTABLE_YES);
 
 static char **arg_hierarchies = NULL; /* "/usr" + "/opt" by default for sysext and /etc by default for confext */
 static char *arg_root = NULL;
@@ -2462,7 +2462,7 @@ static int verb_help(int argc, char **argv, void *userdata) {
                "  -h --help               Show this help\n"
                "     --version            Show package version\n"
                "\n%3$sOptions:%4$s\n"
-               "     --mutable=yes|no|auto|import|ephemeral|ephemeral-import\n"
+               "     --mutable=yes|no|auto|import|ephemeral|ephemeral-import|help\n"
                "                          Specify a mutability mode of the merged hierarchy\n"
                "     --no-pager           Do not pipe output into a pager\n"
                "     --no-legend          Do not show the headers and footers\n"
@@ -2577,6 +2577,14 @@ static int parse_argv(int argc, char *argv[]) {
                         break;
 
                 case ARG_MUTABLE:
+                        if (streq(optarg, "help")) {
+                                if (arg_legend)
+                                        puts("Known mutability modes:");
+
+                                DUMP_STRING_TABLE(mutable_mode, MutableMode, _MUTABLE_MAX);
+                                return 0;
+                        }
+
                         r = parse_mutable_mode(optarg);
                         if (r < 0)
                                 return log_error_errno(r, "Failed to parse argument to --mutable=: %s", optarg);