From: Philip Withnall Date: Wed, 31 Dec 2025 00:48:54 +0000 (+0000) Subject: sysupdate: Add acquire and install verbs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bc92084357c210c6961e028607764abfde10a33;p=thirdparty%2Fsystemd.git 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 Helps: https://github.com/systemd/systemd/issues/34814 --- diff --git a/man/systemd-sysupdate.xml b/man/systemd-sysupdate.xml index 778ff2e793e..1dea457e133 100644 --- a/man/systemd-sysupdate.xml +++ b/man/systemd-sysupdate.xml @@ -128,19 +128,33 @@ - VERSION + --offline VERSION 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. + If is specified, the update must already have been acquired using + acquire and, if so, this pre-acquired version is the one which will be updated + to. + + + + + + VERSION + + 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. + 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 InstanceMax= in sysupdate.d5, or via the available partition slots of the right type. This implicit operation can also be invoked explicitly via the vacuum command described below. - + @@ -299,7 +313,7 @@ - When used in combination with the update command and a new version is + When used in combination with the update commands and a new version is installed, automatically reboots the system immediately afterwards. @@ -312,6 +326,9 @@ This is most useful when used in combination with the list command, to query locally installed versions. + If used in combination with the update command, it allows updates to be + downloaded in advance (using acquire) and installed later. + diff --git a/src/sysupdate/sysupdate.c b/src/sysupdate/sysupdate.c index 700962819fc..9af09b497d8 100644 --- a/src/sysupdate/sysupdate.c +++ b/src/sysupdate/sysupdate.c @@ -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 },