]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
updatectl: Add a --no-ask-password argument
authorPhilip Withnall <pwithnall@gnome.org>
Wed, 20 May 2026 16:15:00 +0000 (17:15 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 20 May 2026 19:24:55 +0000 (04:24 +0900)
While commit 83c1e8ff5f9 added support for interactive polkit
authentication in `updatectl`, some users might want to disable that for
some use cases; so add the standard `--no-ask-password` argument.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: https://github.com/systemd/systemd/issues/37412

man/updatectl.xml
src/sysupdate/updatectl.c

index c7b0dbd3096c00e24e8138c29b8c8ac0629b42fd..a6da35b52f0ee51790f8ec06c943334d18ad896e 100644 (file)
         <xi:include href="version-info.xml" xpointer="v257"/></listitem>
       </varlistentry>
 
+      <xi:include href="standard-options.xml" xpointer="no-ask-password" />
       <xi:include href="standard-options.xml" xpointer="help" />
       <xi:include href="standard-options.xml" xpointer="version" />
     </variablelist>
index cf574a86e9063b65f0748957b871b590f709834b..bafc41c6ae0c73f36642505aea7638ef6137723b 100644 (file)
@@ -35,6 +35,7 @@ static bool arg_legend = true;
 static bool arg_reboot = false;
 static bool arg_offline = false;
 static bool arg_now = false;
+static bool arg_ask_password = true;
 static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
 static const char *arg_host = NULL;
 
@@ -1723,6 +1724,10 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
 
                 OPTION_GROUP("Verbs"): {}
 
+                OPTION_COMMON_NO_ASK_PASSWORD:
+                        arg_ask_password = false;
+                        break;
+
                 OPTION_COMMON_HELP:
                         return help();
 
@@ -1755,7 +1760,7 @@ static int run(int argc, char *argv[]) {
         if (arg_transport == BUS_TRANSPORT_LOCAL)
                 polkit_agent_open();
 
-        (void) sd_bus_set_allow_interactive_authorization(bus, true);
+        (void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);
 
         return dispatch_verb(args, bus);
 }