summaryrefslogtreecommitdiffstats
path: root/src/sysupdate (follow)
Commit message (Collapse)AuthorAgeFilesLines
* sysupdate: add missing full stop to the polkit messageYu Watanabe4 days1-1/+1
| | | | Follow-up for e55e7a5a613712dc9a94d40a1fea1f02d359961f.
* updatectl: fix DBus method signature for SetFeatureEnabledAbderrahim Kitouni6 days1-1/+1
| | | | | The signature was changed to 'sit' in sysupdated during review, but updatectl kept using 'sbt'
* sysupdated: Make sure targets we skip are skippedAdrian Vovk2024-11-061-7/+19
| | | | | | | | | | | | We'd log that we're skipping the target, but it would never actually get removed from the manager's list. Thus, we'd advertise targets that don't actually exist to clients. In the original version of the sysupdated PR, this was handled by removing the target from the manager's list in target_free, and using a _cleanup_ attribute to free the target when skipping. However, this changed at some point during review. So, this commit takes the alternative approach
* meson: add separate option for sysupdated, disable in release buildsZbigniew Jędrzejewski-Szmek2024-10-311-3/+3
| | | | | | This commit introduces a build-time option to enable/disable sysupdated separately from sysupdate. 'auto' translated to enabled by default in developer builds.
* pretty-print: rename draw_progress_bar_impl()→draw_progress_bar_unbuffered()Lennart Poettering2024-10-291-7/+7
|
* sd-json,tree-wide: add sd_json_format_enabled() and use it everwhereZbigniew Jędrzejewski-Szmek2024-10-281-6/+6
| | | | | | | | | | | | | | | | | | | We often used a pattern like if (!FLAGS_SET(flags, SD_JSON_FORMAT_OFF)), which is rather verbose and also contains a double negative, which we try to avoid. Add a little helper to avoid an explicit bit check. This change clarifies an aditional thing: in some cases we treated SD_JSON_FORMAT_OFF as a flag (flags & SD_JSON_FORMAT_OFF), while in other cases we treated it as an independent enum value (flags == SD_JSON_FORMAT_OFF). In the first form, flags like SD_JSON_FORMAT_SSE do _not_ turn the json output on, while in the second form they do. Let's use the first form everywhere. No functional change intended. Initially I wasn't sure if this helper should be made public or just internal, but it seems such a common pattern that if we expose the flags, we might just as well expose it too, to make life easier for any consumers.
* Merge pull request #33398 from AdrianVovk/sysupdate-optionalLennart Poettering2024-10-2111-109/+1095
|\ | | | | sysupdate: Add support for optional features
| * updatectl: Introduce optional feature verbsAdrian Vovk2024-10-191-30/+328
| | | | | | | | | | This introduces a nice UX for listing, inspecting, enabling, and disabling optional features from the command line.
| * sysupdated: Plumb through optional featuresAdrian Vovk2024-10-194-23/+261
| | | | | | | | This adds APIs to enumerate/inspect/enable/disable optional features.
| * sysupdate: Add verb to inspect featuresAdrian Vovk2024-10-183-1/+151
| |
| * sysupdate: Introduce optional featuresAdrian Vovk2024-10-187-66/+366
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optional features allow distros to define sets of transfers that can be enabled or disabled by the system administrator. This is useful for situations where a distro may want to ship some resources version-locked to the core OS, but many people have no need for the resource, such as: development tools/compilers, drivers for specialized hardware, language packs, etc We also rename sysupdate.d/*.conf -> sysupdate.d/*.transfer, because now there are more than one type of definition in sysupdate.d/. For backwards compat, we still load *.conf files as long as no *.transfer files are found and the *.conf files don't try to declare themselves as part of any features Fixes https://github.com/systemd/systemd/issues/33343 Fixes https://github.com/systemd/systemd/issues/33344
* | sysupdate: Use camelCase for JSON field namesAdrian Vovk2024-10-213-14/+14
|/ | | | | Seems like we missed some snake_case field names in previous reviews of systemd-sysupdate
* updatectl: remove unimplemented optionAntonio Alvarez Feijoo2024-10-141-1/+1
|
* Merge pull request #34679 from DaanDeMeyer/bus-logDaan De Meyer2024-10-091-1/+1
|\ | | | | Various logging improvements
| * bus-util: Log more information when connecting to a bus socket failsDaan De Meyer2024-10-091-1/+1
| | | | | | | | | | Let's log about which bus we're trying to connect to and what transport we're using to do it.
* | tree-wide: drop doubled empty linesYu Watanabe2024-10-071-2/+0
| |
* | Merge pull request #34491 from AdrianVovk/sysupdate-fixupsYu Watanabe2024-10-072-37/+45
|\ \ | |/ |/| Quick sysupdate fixups
| * sysupdated: Vacuum: Fixup dbus typeAdrian Vovk2024-09-231-1/+4
| | | | | | | | We were passing a u64 into an argument that needs a u32
| * sysupdated: Rearrange error logging a little bitAdrian Vovk2024-09-191-36/+36
| | | | | | | | | | | | | | | | | | First, this fixes a case where an error is logged twice at the LOG_ERR level. Second, this goes through and raises the log level where appropriate so that sysupdated is easier to debug. Finally, it replaces EINVAL with EPROTO where appropriate, since EINVAL implies that the caller passed some incorrect arguments (which is incorrect; sysupdate passed some invalid JSON back to us)
| * updatectl: check: Don't print an empty tableAdrian Vovk2024-09-191-0/+5
| | | | | | | | | | | | If there are no updates available, `updatectl check` would previously just print an empty table. We should instead just tell the user that there are no updates available.
* | tree-wide: use strv_extend_strv_consume() where appropriateMike Yuan2024-09-211-2/+3
| |
* | basic/memory-util: introduce mempcpy_typesafeMike Yuan2024-09-201-1/+1
|/
* updatectl: make sd_json_dispatch_field table staticYu Watanabe2024-09-181-27/+43
| | | | | | This also fixes memory leak of Version object on failure. Follow-up for ec15bb71c2ccd57702325a6e6626053a343f3511.
* sysupdate: Add --transfer-source=Daan De Meyer2024-09-095-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In mkosi, I want to add a sysupdate verb to wrap systemd-sysupdate. The definitions will be picked up from mkosi.sysupdate/ and passed to systemd-sysupdate. I want users to be able to write transfer definitions that are independent of the output directory used by mkosi. To make this possible, it should be possible to specify the directory that transfer sources should be looked up in on the sysupdate command line. Let's allow this via a new --transfer-source= option. Additionally, transfer sources that want to take advantage of this feature should specify PathRelativeTo=directory to indicate the configured Path= is interpreted relative to the tranfer source directory specified on the CLI. This allows for the following transfer definition to be put in mkosi.sysupdate: """ [Transfer] ProtectVersion=%A [Source] Type=regular-file Path=/ PathRelativeTo=directory MatchPattern=ParticleOS_@v.usr-%a.@u.raw [Target] Type=partition Path=auto MatchPattern=ParticleOS_@v MatchPartitionType=usr PartitionFlags=0 ReadOnly=1 """
* socket-util: make recvmsg_safe() handle MSG_TRUNC tooMike Yuan2024-09-042-19/+23
| | | | Also, unify MSG_TRUNC handling all across the codebase.
* pretty-print: introduce WITH_BUFFERED_STDERR macro to enable bufferingYu Watanabe2024-09-031-4/+1
| | | | | Then, the buffer will be flushed and buffering will be disabled on exiting from the scope.
* pretty-print: rename {draw,clear}_progress_bar_unbuffered() -> ↵Yu Watanabe2024-09-031-7/+7
| | | | | | | {draw,clear}_progress_bar_impl() Addresses https://github.com/systemd/systemd/pull/34205#discussion_r1739648525. Follow-ups for 5f9dd9c64d20e7cdf8b509421e28cfebf31b7c32.
* Merge pull request #34140 from yuwata/conf-parser-log-messageYu Watanabe2024-09-031-2/+2
|\ | | | | conf-parser: introduce log_syntax_parse_error() and use it
| * tree-wide: drop msg argument for DEFINE_CONFIG_PARSE() macro and friendsYu Watanabe2024-09-011-2/+2
| | | | | | | | | | This makes the macros use log_syntax_parse_error(), hopefully which provides more informative log message in general, and reduces binary size.
* | sysupdated: Improve logging about jobsAdrian Vovk2024-09-021-10/+21
| | | | | | | | | | | | | | | | | | If someone runs `updatectl update`, sysupdate will be running multiple update jobs at the same time, which can make reasoning about the output in the journal quite difficult. Especially if things go wrong: the error messages didn't mention which job failed. Nor was there any link between job ID and the PID of the worker process logging to the journal. This is all fixed here!
* | sysupdated: Cleanup handling of notificationsAdrian Vovk2024-09-021-32/+21
| | | | | | | | | | | | Cuts out some `strdup`s, and also avoids a rather weird case of donating memory to a function. Basically just duplicates the solution I just implemented for sysupdate's callout handler.
* | sysupdate: Don't ignore callout binary failureAdrian Vovk2024-09-021-18/+40
|/ | | | | | | | | | | | | Previously, if the callout binary (i.e. sd-pull, sd-import) failed gracefully, we'd return its exit status from the event loop and thus from run_callout(). Of course, exit status is a positive number in the event of failure. Which means that we completely ignore the callout binary failing, and instead continue using whatever it managed to download before failing. This is bad for obvious reasons, not the least of which is installing a half-downloaded OS. This also means that we would completely ignore failed signature checks 😬️
* progress-bar: Add unbuffered variantAdrian Vovk2024-08-311-7/+14
| | | | | | | | | | | | The progress_bar functions do their own buffering: they reconfigure stderr, then print, then flush and disable buffering on their own. In situations where multiple progress bars are being drawn at a time (for example, in updatectl), it's even more efficient to hoist the buffering and flushing to the call site, and avoid drawing each progress bar individually. To that end, new _unbuffered variants of the progress_bar functions. And we use them in updatectl.
* updatectl: Improve behavior of progress loggingAdrian Vovk2024-08-311-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This applies a couple of aesthetic changes to the way updatectl renders progress information 1. We invert from "ICON TARGET MESSAGE" to "TARGET: ICON MESSAGE" to better fit in with the systemd progress bars, which look like "TARGET [==========---------] XX%". The original version of the sysupdated PR implemented its own progress bars that were oriented differently: "[==========---------] TARGET XX%". When we swapped the progress bar we didn't swap the status messages 2. When a target finishes updating, instead of leaving a 100% progress bar on screen for potentially extended periods of time (which implies to the user that the update isn't actually done...), we show a status message saying the target is done updating. 3. Fixed a minor bug where an extra newline would be printed after the total progress bar. At the top of the rendering function, we scroll the terminal's scroll-back just enough to fit a line for each target, and one for the total. This means that we should not print an additional line after the total, or else it'll scroll the terminal's buffer by an additional character. This bug was introduced at some point during review 4. Clears the Total progress bar before quitting. By the time we're quitting, that progress bar will be showing no useful status for the user. Also, the fix in point 3 will cause the shell's prompt to appear on the same line as the Total progress bar, partially overwriting it and leaving the shell in a glitchy state.
* updatectl: Ensure we clear the progress barAdrian Vovk2024-08-311-0/+3
| | | | Otherwise we end up half-overwriting the progress bar, which looks buggy
* sysupdated: Register known error typesAdrian Vovk2024-08-311-2/+3
| | | | | | | | | | This fixes a bug introduced during review of sysupdated. Originally, we just returned EALREADY verbatim to signify that the target is already up-to-date. Then we switched this to a proper error (org.freedesktop.sysupdate1.NoCandidate) during review. But that now maps to EIO, not EALREADY. Thus, whenever there's nothing to update, updatectl would report I/O errors to the user, even though nothing actually went wrong.
* Merge pull request #33570 from AdrianVovk/sysupdate-incompleteAdrian Vovk2024-08-276-59/+209
|\ | | | | sysupdate: Handle incomplete versions
| * sysupdate: Repair incomplete versions in-placeAdrian Vovk2024-08-222-10/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous commit made sysupdate recognize installed versions where some transfers are missing. This commit teaches sysupdate how to correctly repair these incomplete versions. Previously, if you had a incomplete installation of the OS booted, and ran sysupdate in an attempt to repair it, sysupdate would make things worse by creating copies of the currently-booted partitions in the inactive slots. Then at boot you have two identical partitions, with identical labels an UUIDs, and end up with a mess. With this commit, sysupdate is able to recognize situations where it can simply download the missing transfers and leave the rest of the system undistrubed. Partial fix for https://github.com/systemd/systemd/issues/33339
| * sysupdate: Track incompletely-installed versionsAdrian Vovk2024-08-224-48/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When enumerating what versions exist for a given target, sysupdate would completely throw out any version that's incomplete (where some of the transfers in the target have that version installed or available, and other transfers do not). If we're trying to find what versions we can offer for download, this is great behavior. If the server side is advertising a partial update to download, we shouldn't present it to the user. On the other hand, if we're enumerating what versions we have currently installed, this is a bad behavior. It makes sysupdate fragile. For example, if a sysext introduces a new .conf file into /usr/lib/sysupdate.d, suddenly the currently-installed OS stops being a version that we've enumerated. Since it's not enumerated, it's not protected, and so sysupdate will wipe the booted OS. So if we're looking for installed versions, we now loosen the restrictions and enumerate incomplete installations. Partial fix for https://github.com/systemd/systemd/issues/33339
| * sysupdate: Check that --instances-max is in boundsAdrian Vovk2024-08-221-0/+8
| | | | | | | | | | Otherwise user can pass in --instances-max=0 and crash sysupdate with an assertion failure.
| * sysupdate: Fix resource_find_instanceAdrian Vovk2024-08-221-1/+13
| | | | | | | | | | | | | | | | | | The current implementation will never find a match, because in the event of a match instance_cmp falls through to comparing paths and the key we're matching against will always have a path of NULL. So let's just use a separate compare function, just to make sure future updates to instance_cmp don't break resource_find_instance again.
* | updatectl: fix typo and drop space in empty linesYu Watanabe2024-08-231-3/+3
|/ | | | Follow-ups for ec15bb71c2ccd57702325a6e6626053a343f3511 (#32363).
* Merge pull request #34076 from yuwata/polkit-messageLennart Poettering2024-08-221-4/+4
|\ | | | | polkit: add missing period in polkit messages
| * polkit: add missing period in messagesYu Watanabe2024-08-221-4/+4
| |
* | sysupdate: Simplify sysupdate_run_simple callsiteAdrian Vovk2024-08-221-22/+17
| | | | | | | | | | Allows the caller to optionally pass in a target, instead of making everyone call target_get_argument at the call site.
* | sysupdated: Verify inputs more rigorouslyAdrian Vovk2024-08-222-2/+9
| | | | | | | | Also return better errors
* | sysupdated: Fixup redundant constant nameAdrian Vovk2024-08-223-9/+9
| | | | | | | | SD_ stands for systemd, so SD_SYSTEMD_* is SYSTEMD_SYSTEMD_*
* | sysupdated: Fixup minor formatting issuesAdrian Vovk2024-08-221-3/+3
|/
* sysupdate: Implement updatectlAdrian Vovk2024-08-212-0/+1286
| | | | | | | This is the command-line tool to manage systemd-sysudpated Co-authored-by: Tom Coldrick <thomas.coldrick@codethink.co.uk> Co-authored-by: Abderrahim Kitouni <abderrahim.kitouni@codethink.co.uk>
* sysupdate: Implement systemd-sysupdated dbus serviceAdrian Vovk2024-08-217-1/+2106
| | | | | Co-authored-by: Tom Coldrick <thomas.coldrick@codethink.co.uk> Co-authored-by: Abderrahim Kitouni <abderrahim.kitouni@codethink.co.uk>