]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysupdate: Add acquire and install verbs
authorPhilip Withnall <pwithnall@gnome.org>
Wed, 31 Dec 2025 00:48:54 +0000 (00:48 +0000)
committerPhilip Withnall <pwithnall@gnome.org>
Mon, 9 Feb 2026 12:05:10 +0000 (12:05 +0000)
These expose the two parts of ‘update’, so that update sets can be
acquired (downloaded) and installed (applied) in separate actions at
different times. For example, this could allow a load of update sets to
be acquired when online, and later applied when offline.

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

man/systemd-sysupdate.xml
src/sysupdate/sysupdate.c

index 778ff2e793ef3f627f2241f813506975bba41b4a..1dea457e133e52765306b36e75511613f86b60cb 100644 (file)
       </varlistentry>
 
       <varlistentry>
-        <term><option>update</option> <optional><replaceable>VERSION</replaceable></optional></term>
+        <term><option>update</option> <optional>--offline</optional> <optional><replaceable>VERSION</replaceable></optional></term>
 
         <listitem><para>Installs (updates to) the specified version, or if none is specified to the newest
         version available. If the version is already installed or no newer version available, no operation is
         executed.</para>
 
+        <para>If <option>--offline</option> is specified, the update must already have been acquired using
+        <command>acquire</command> and, if so, this pre-acquired version is the one which will be updated
+        to.</para>
+
+        <xi:include href="version-info.xml" xpointer="v251"/></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>acquire</option> <optional><replaceable>VERSION</replaceable></optional></term>
+
+        <listitem><para>Acquires (downloads) the specified version, ready to install it. If no version is
+        specified, the newest version available is acquired. If the version is already installed or no newer
+        version is available, no operation is executed.</para>
+
         <para>If a new version to install/update to is found, old installed versions are deleted until at
         least one new version can be installed, as configured via <varname>InstanceMax=</varname> in
         <citerefentry><refentrytitle>sysupdate.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>, or
         via the available partition slots of the right type. This implicit operation can also be invoked
         explicitly via the <command>vacuum</command> command described below.</para>
 
-        <xi:include href="version-info.xml" xpointer="v251"/></listitem>
+        <xi:include href="version-info.xml" xpointer="v260"/></listitem>
       </varlistentry>
 
       <varlistentry>
       <varlistentry>
         <term><option>--reboot</option></term>
 
-        <listitem><para>When used in combination with the <command>update</command> command and a new version is
+        <listitem><para>When used in combination with the <command>update</command> commands and a new version is
         installed, automatically reboots the system immediately afterwards.</para>
 
         <xi:include href="version-info.xml" xpointer="v251"/></listitem>
         This is most useful when used in combination with the <command>list</command> command, to query
         locally installed versions.</para>
 
+        <para>If used in combination with the <command>update</command> command, it allows updates to be
+        downloaded in advance (using <command>acquire</command>) and installed later.</para>
+
         <xi:include href="version-info.xml" xpointer="v257"/></listitem>
       </varlistentry>
 
index 700962819fc112edbbc48660fad1ac072648f0ce..9af09b497d8b1bf09d53aa3676df522725e88b10 100644 (file)
@@ -1600,7 +1600,16 @@ static int verb_update_impl(int argc, char **argv, UpdateActionFlags action_flag
 }
 
 static int verb_update(int argc, char **argv, void *userdata) {
-        return verb_update_impl(argc, argv, UPDATE_ACTION_ACQUIRE | UPDATE_ACTION_INSTALL);
+        UpdateActionFlags flags = UPDATE_ACTION_INSTALL;
+
+        if (!arg_offline)
+                flags |= UPDATE_ACTION_ACQUIRE;
+
+        return verb_update_impl(argc, argv, flags);
+}
+
+static int verb_acquire(int argc, char **argv, void *userdata) {
+        return verb_update_impl(argc, argv, UPDATE_ACTION_ACQUIRE);
 }
 
 static int verb_pending_or_reboot(int argc, char **argv, void *userdata) {
@@ -1782,6 +1791,7 @@ static int verb_help(int argc, char **argv, void *userdata) {
                "  features [FEATURE]      Show optional features\n"
                "  check-new               Check if there's a new version available\n"
                "  update [VERSION]        Install new version now\n"
+               "  acquire [VERSION]       Acquire (download) new version now\n"
                "  vacuum                  Make room, by deleting old versions\n"
                "  pending                 Report whether a newer version is installed than\n"
                "                          currently booted\n"
@@ -1995,6 +2005,7 @@ static int sysupdate_main(int argc, char *argv[]) {
                 { "features",   VERB_ANY, 2, 0,            verb_features          },
                 { "check-new",  VERB_ANY, 1, 0,            verb_check_new         },
                 { "update",     VERB_ANY, 2, 0,            verb_update            },
+                { "acquire",    VERB_ANY, 2, 0,            verb_acquire           },
                 { "vacuum",     VERB_ANY, 1, 0,            verb_vacuum            },
                 { "reboot",     1,        1, 0,            verb_pending_or_reboot },
                 { "pending",    1,        1, 0,            verb_pending_or_reboot },