sysupdate: Add acquire and install verbs
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
This commit is contained in:
@@ -128,19 +128,33 @@
|
||||
</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>
|
||||
@@ -299,7 +313,7 @@
|
||||
<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>
|
||||
@@ -312,6 +326,9 @@
|
||||
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>
|
||||
|
||||
|
||||
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user