summaryrefslogtreecommitdiffstats
path: root/src/import (follow)
Commit message (Collapse)AuthorAgeFilesLines
* curl-util: do not configure new io event source when the event loop is ↵Yu Watanabe8 days1-0/+4
| | | | | | | | already dead Similar to c5ecf0949460dd0bf3211db128a385ce6375252e, but for io event source. Fixes #35322.
* pretty-print: add format-string version of draw_progress_bar()Lennart Poettering2024-10-294-44/+32
| | | | | We often format the prefix string via asprintf() before, let's hence add a helper for that.
* import: Draw progress barsDaan De Meyer2024-10-294-4/+69
| | | | | | | Currently every progress update results in a new progress message which is extremely verbose. Instead, let's use the progress bar infra to draw a proper progress bar similar to what we do in systemd-repart now.
* sd-json,tree-wide: add sd_json_format_enabled() and use it everwhereZbigniew Jędrzejewski-Szmek2024-10-281-1/+1
| | | | | | | | | | | | | | | | | | | 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 #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-1/+0
|/
* time-util: rework localtime_or_gmtime() into localtime_or_gmtime_usec()Lennart Poettering2024-09-051-7/+1
| | | | | | | | | | | | We typically want to deal in usec_t, hence let's change the prototype accordingly, and do proper range checks. Also, make sure are not confused by negative times. Do something similar for mktime_or_timegm(). This is a more comprehensive alternative to #34065 Replaces: #34065
* socket-util: make recvmsg_safe() handle MSG_TRUNC tooMike Yuan2024-09-041-16/+15
| | | | Also, unify MSG_TRUNC handling all across the codebase.
* progress-bar: Put a space after the prefixAdrian Vovk2024-08-311-1/+1
| | | | | We always want a space there. So let's just put one in the drawing routine, and adjust the call cites to avoid adding a second one.
* polkit: add missing period in messagesYu Watanabe2024-08-221-4/+4
|
* tree-wide: voidify polkit_agent_open_if_enabled()Yu Watanabe2024-08-191-2/+2
|
* import: check overflowYu Watanabe2024-08-012-0/+10
| | | | Fixes CID#1548022 and CID#1548075.
* terminal-util: split out color macros/helpers into its own headerLennart Poettering2024-07-194-0/+4
| | | | | | | | | This is a lot of stuff, and sometimes quite wild, let's turn this into its own header. All stuff color-related that just generates sequences is now in ansi-color.h (no .c file!), and everything more complex that probes/ineracts with terminals remains in termina-util.[ch]
* table: Fix JSON name mangling breaking changesAdrian Vovk2024-07-171-0/+5
| | | | | | | | | In previous commits, we've changed the JSON name mangling logic. This, of course, will cause breaking changes to occur on anything that relied on the JSON mangling logic. This commit fixes those breaking changes by manually forcing the JSON name back to what it was before.
* sd-varlink: make our internal Varlink API public as sd-varlink.[ch]Lennart Poettering2024-07-161-28/+29
| | | | | | | | | | It's time. sd-json was already done earlier in this cycle, let's now make sd-varlink public too. This is mostly just a search/replace job of epical proportions. I left some functions internal (mostly IDL handling), and I turned some static inline calls into regular calls.
* Merge pull request #33491 from keszybz/allow-interactive-auth-in-inhibitLuca Boccassi2024-06-261-1/+1
|\ | | | | Allow interactive auth in inhibit
| * Rename spawn-polkit-agent.c to just polkit-agent.cZbigniew Jędrzejewski-Szmek2024-06-261-1/+1
| | | | | | | | | | The functions in the file were *not* using the spawn prefix, and the prefix seems completely unnecessary.
* | import-generator: open up NotifyAccess for varlinkctlMike Yuan2024-06-251-1/+2
| | | | | | | | So that it can report errors through VARLINKERROR=.
* | import: add generator that synthesizes download jobs from kernel cmdlineLennart Poettering2024-06-252-0/+293
| |
* | importd: allow activation in early boot, and make it socket activatableLennart Poettering2024-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | Previously, importd was only accessible via D-Bus, which required it to be a late boot service. Now that we have Varlink we can rearrange things to become early-boot activated, just after the image directories are mounted. This will later allow us to have generator that auto-downloads images on boot.
* | importd: add simple varlink APILennart Poettering2024-06-251-5/+283
|/ | | | | For now, let's just support Pull() and ListTransfers(), but this is just a start.
* importd: unify setup of bus connectivity in one placeLennart Poettering2024-06-151-6/+8
|
* libsystemd: turn json.[ch] into a public APILennart Poettering2024-06-121-3/+3
| | | | | | | | | | | | | | | This is preparation for making our Varlink API a public API. Since our Varlink API is built on top of our JSON API we need to make that public first (it's a nice API, but JSON APIs there are already enough, this is purely about the Varlink angle). I made most of the json.h APIs public, and just placed them in sd-json.h. Sometimes I wasn't so sure however, since the underlying data structures would have to be made public too. If in doubt I didn#t risk it, and moved the relevant API to src/libsystemd/sd-json/json-util.h instead (without any sd_* symbol prefixes). This is mostly a giant search/replace patch.
* Merge pull request #33071 from keszybz/sd_event_source-cleanupYu Watanabe2024-06-121-4/+2
|\ | | | | Clean up calls to sd_event_source_set_enabled()
| * various: remove unnecessary check before sd_event_source_set_enabled()Zbigniew Jędrzejewski-Szmek2024-05-301-4/+2
| | | | | | | | sd_event_source_set_enabled() does the same check internally.
* | tree-wide: never consider service idle if polkit authentication is still pendingLennart Poettering2024-06-121-2/+3
| | | | | | | | Let's be correct on this.
* | importctl: Fix 0 flags argument in sd_bus_message_append()Daan De Meyer2024-06-031-2/+2
|/
* curl-glue: catch libcurl attempting to change timeout handler when we ↵Lennart Poettering2024-05-131-0/+7
| | | | | | | | | | | | destroy a curl context on exit If we destroy both an event loop and a curl contect object at the same time, then we get into this weird situation where curl wants us to reconfigure a timout event source right before destruction, which sd-event will refuse however, since it is already being shutdown. Hence, catch that and simply don't bother adjusting the timeout, since we cannot get back from there anyway.
* importctl: fix flag checking against wrong variableAntonio Alvarez Feijoo2024-05-021-5/+5
| | | | Fixes 67c7ee11afb5ff703c3ca8e390c8360140298a0f
* import: skip the whole subdir when building with -Dimportd=falseFrantisek Sumsal2024-04-261-11/+13
| | | | Resolves: #32501
* gcrypt: dlopenify for libsystemdLuca Boccassi2024-04-031-1/+3
| | | | | | | | | gcrypt is used only for journal sealing operations in libsystemd, so it can be made into a dlopen dependency that is used only on demand. This allows to reduce the footprint of libsystemd in the most common cases. Keep systemd-pull and systemd-resolved with normal linking, as they are executables, and usually built with OpenSSL support anyway.
* fd-util: beef up fd_verify_safe_flags() featuresLennart Poettering2024-03-111-1/+1
| | | | | | | | | | | Let's make fd_verify_safe_flags() even more useful: 1. let's return the cleaned up flags (i.e. just the access mode) after validation, hiding all the noise, such as O_NOFOLLOW, O_LARGEFILE and similar. 2. let's add a "full" version of the call that allows passing additional flags that are OK to be set.
* importd: add command to list downloaded imagesLennart Poettering2024-03-013-0/+186
| | | | | | It's a bit weird we allow importing/pulling/exporting images, but we have no scheme for showing what#s already downloaded. Hence let's add this, it's easy to add after all.
* importd: pass log level to invoked childLennart Poettering2024-03-011-0/+4
|
* import: mention explicitly which image directory we operate onLennart Poettering2024-03-013-12/+14
| | | | | Also, let's move the similar message about sync() mode to more common code.
* import: downgrade HTTP error code log message levelsLennart Poettering2024-03-011-1/+1
| | | | | | | Let's downgrade log levels a bit on HTTP error codes. After all we gracefully handle many of them, and we do generated an extra message for the ones which are fatal anyway, hence there's no point in emphasizing the HTTP erro message levels as we currently do.
* importctl: draw a pretty progress bar while downloadingLennart Poettering2024-03-012-17/+107
| | | | Everybody loves pretty terminal progress bar.
* importd: log the import callout that is going to be calledLennart Poettering2024-03-011-1/+6
|
* importd: make keeping pristine copy of downloaded images optionalLennart Poettering2024-03-016-79/+163
| | | | | | | | | | | | | | | | | | Previously, when downloading an image, importd would first download them into one image which it would then consider immutable (named after the originating URL/etag), and then immediately make a copy of it (named after the client chosen name). This makes some sense in VM/container cases where the images are typically mutable, and thus the original downloaded copy is of some value. For sysexts/confexts/portable this doesn't make much sense though, as they are typically immutable. Hence make the concept optional. This adds --keep-download=yes/no as a new option that controls the above. Moreover it disables the behaviour for all image classes but "machine". The behaviour remains enabled for "machine", for compat.
* importd: validate local image names with the right helperLennart Poettering2024-03-018-35/+38
| | | | | | | | A while back we introduced image_name_is_valid() for validating image file names. It's more liberal than hostname_is_valid() in many ways (and allows version suffixes and such). Since importd deals in offline images (as opposed to machined otherwise which deals in running machines), let's hence use the right helper to validate the identifiers.
* importlisttransfersxclientLennart Poettering2024-03-011-1/+5
|
* importctl: add support for selecting image class to downloadLennart Poettering2024-03-011-93/+289
|
* importd: tighten checks in fds passed to usLennart Poettering2024-03-011-0/+12
|
* importd: add support for downloading sysext/confext/portable images tooLennart Poettering2024-03-0113-106/+462
| | | | | | | | | | | | | This adds "Ex" versions of all bus calls import implements, that make two changes: 1. A "class" parameter is added that allows choosing between machine/sysext/confext/portable images to download. Depending on the chose class the target directory is selected differently (i.e. not just /var/lib/machines/, but alternatively /var/lib/portables/, /var/lib/extensions/, /var/lib/confexts/. 2. The boolean flags are replaced by a 64bit flags parameter.
* import: merge PullFlags enum into ImportFlagsLennart Poettering2024-03-018-118/+112
| | | | | | | | | | The two enums are mostly the same, the former is just an extension of the latter. Let's merge them, to simplify things. This is particularly useful as we then can reuse this systematically as D-Bus method call flags too, in a generic fashion that works for both imports and pulls the same. Pretty much just renaming of flags.
* importctl: port tabular output for format-table.h APIsLennart Poettering2024-03-011-74/+71
|
* importctl: modernize signal handlingLennart Poettering2024-03-011-4/+2
|
* importctl: add standalone client to importdLennart Poettering2024-03-012-0/+875
| | | | | | | | This is pretty much a 1:1 copy of the importd specific part of machinectl. We turn this into a separate tool, so that we can eventually make the tool generic to also download other DDIs, not just machine images.
* importd: modernize signal handling a bitLennart Poettering2024-03-013-30/+14
|