summaryrefslogtreecommitdiffstats
path: root/src/id128 (follow)
Commit message (Collapse)AuthorAgeFilesLines
* id128: add 'var-partition-uuid' verbLuca Boccassi2024-07-171-6/+24
| | | | | | | As per DPS the UUID for /var/ should be keyed by the local machine-id, which is non-trivial to do in a script. Enhance 'systemd-id128' to take 'var-partition-uuid' as a verb, and if so perform the calculation.
* id128: refuse --app-specific= if we're listing GPT typesMike Yuan2024-07-171-17/+20
| | | | | | | | Prompted by #33737 The intention of b37e8184a5a376749fbf68674ed6d7a4fc9901aa is to expose sd_id128_get_app_specific() on command line. But combining that with GPT type list makes little sense.
* libsystemd: turn json.[ch] into a public APILennart Poettering2024-06-121-2/+2
| | | | | | | | | | | | | | | 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.
* id128: add --no-pager, --no-legend, --json=/-j switches to systemd-id128 toolLennart Poettering2024-01-111-4/+38
|
* id128: add forgotten option to --helpZbigniew Jędrzejewski-Szmek2023-09-061-0/+1
|
* id128: rework conditional to reduce indentationZbigniew Jędrzejewski-Szmek2023-09-021-13/+12
|
* sd-id128: do not allow null 'app_id' paramZbigniew Jędrzejewski-Szmek2023-09-021-1/+3
| | | | | | | | | | | | | | | | | | | | | If it is null, we get the 'base' param unchanged: $ build/systemd-id128 show 00000000000000000000000000000001 \ --app-specific=00000000000000000000000000000000 00000000000000000000000000000001 This is not good, because it breaks our promise that the base (usually either machine-id or boot-id) cannot be derived from the result. Some application using the library could use a null app id, inadvertently exposing the machine or boot id. (This could happen because of forgotten initialization, or maybe because the app id is configurable, and the user configures it wrongly.) Note: the other way the secret is not exposed: $ build/systemd-id128 show 00000000000000000000000000000000 \ --app-specific=00000000000000000000000000000002 4f63080959264900b0d88d999dae2d3a Normally systemd would not allow a null machine-id or boot-id, but we can let the user do the calculation that if they want to.
* id128: allow combining --app with showZbigniew Jędrzejewski-Szmek2023-09-021-3/+11
| | | | | | This effectively exposes sd_id128_get_app_specific() on the commandline. Fixes https://github.com/systemd/systemd/issues/27514.
* systemd-id128: properly document the show verbZbigniew Jędrzejewski-Szmek2023-08-291-1/+1
| | | | | | https://github.com/systemd/systemd/issues/27514 requested this functionality among other things, but it is already implemented. The man page was also missing 'show' in the synopsis, so add that, along with an example.
* id128: add option -P to only show valueZbigniew Jędrzejewski-Szmek2023-08-291-2/+14
| | | | | | We have '-P' in systemctl with similar meaning. Partially closes https://github.com/systemd/systemd/issues/27514.
* meson: move declarations of cgroups-agent, id128, volatile-root, and pathYu Watanabe2023-08-011-0/+9
|
* tree-wide: "<n>bit" → "<n>-bit"Zbigniew Jędrzejewski-Szmek2023-07-021-1/+1
| | | | In some places, "<n> bits" is used when more appropriate.
* gpt: Expose GptPartitionType and get rid of SECONDARY/OTHERDaan De Meyer2022-11-151-1/+4
| | | | | | | | | | | | Instead of exposing just the partition type UUID, let's expose the GptPartitionType struct, which has a lot more information available in a much more accessible way. Also, let's get rid of SECONDARY/OTHER in PartitionDesignator. These were only there to support preferred architectures in dissect-image.c, but we can easily handle that by comparing architectures when we decide whether to override a partition. This is done in a new function compare_arch().
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
|
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-1/+0
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* id128: clarify that the "well-known" IDs are about GPT partition typesLennart Poettering2021-09-101-1/+1
| | | | | At least for now they are all GPT partition types, and we should mention that.
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-01-311-1/+1
| | | | It may be useful when debugging daemons.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-5/+5
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* table use table_log_print_error() instead of table_log_show_errorfangxiuning2020-07-081-1/+1
|
* log: introduce log_parse_environment_cli() and log_setup_cli()Filipe Brandenburger2020-06-241-3/+1
| | | | | | | | | | | | | | | | Presently, CLI utilities such as systemctl will check whether they have a tty attached or not to decide whether to parse /proc/cmdline or EFI variable SystemdOptions looking for systemd.log_* entries. But this check will be misleading if these tools are being launched by a daemon, such as a monitoring daemon or automation service that runs in background. Make log handling of CLI tools uniform by never checking /proc/cmdline or EFI variables to determine the logging level. Furthermore, introduce a new log_setup_cli() shortcut to set up common options used by most command-line utilities.
* id128: change table header from "uuid" to just "id"Lennart Poettering2020-01-291-1/+1
| | | | | | The tool deals with any kind of 128bit id, not just uuid, and by default we display just a series of hex chars, hence let's not claim everything was a "uuid", but just generically say "id"
* systemd-id128: add new verb to print GPT partitions UUIDsZbigniew Jędrzejewski-Szmek2020-01-231-1/+85
|
* id128: fix initializer element is not constantAnita Zhang2019-11-201-1/+1
| | | | | | | | | | | | Was getting: ../src/id128/id128.c:15:1: error: initializer element is not constant static sd_id128_t arg_app = SD_ID128_NULL; ^ when building on CentOS 7. Other parts of the code initialize `static sd_id128_t` to {} and this was the original setting before a19fdd66c22 anyways.
* id128: add new "-u" switch for outputting Ids in UUID formatLennart Poettering2019-11-151-13/+22
| | | | | | | | For some unrelated stuff I wanted the machine ID in UUID format, and it was annoying doing that manually. So let's add a switch for this, so that this works: systemd-id128 machine-id -u
* id128: actually support --prettyZbigniew Jędrzejewski-Szmek2019-08-201-0/+1
| | | | We must be all lazy, at least I know I always used -p ;).
* Enable log colors for most of tools in /usr/binZbigniew Jędrzejewski-Szmek2019-05-081-0/+1
| | | | | | | | | | When emitting the calendarspec warning we want to see some color. Follow-up for 04220fda5c. Exceptions: - systemctl, because it has a lot hand-crafted coloring - tmpfiles, sysusers, stdio-bridge, etc, because they are also used in services and I'm not sure if this wouldn't mess up something.
* id128: no command accepts additional argumentsYu Watanabe2019-03-151-1/+1
|
* coccinelle: also mark previous synthetic errnos as suchZbigniew Jędrzejewski-Szmek2018-11-221-1/+2
|
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-1/+1
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* util-lib: move main() definition macros to its own header fileLennart Poettering2018-11-191-0/+1
| | | | | | | | | This way, we can extend the macro a bit with stuff pulled in from other headers without this affecting everything which pulls in macro.h, which is one of our most basic headers. This is just refactoring, no change in behaviour, in prepartion for later changes.
* id128: define main through macroZbigniew Jędrzejewski-Szmek2018-11-171-6/+5
|
* id128,analyze: fix layout of help messageYu Watanabe2018-11-101-4/+4
|
* systemd-id128: a new tool to print machine/boot/invocation/app-specific idsZbigniew Jędrzejewski-Szmek2018-10-021-0/+167
The raison d'etre for this program is printing machine-app-specific IDs. We provide a library function for that, but not a convenient API. We can hardly ask people to quickly hack their own C programs or call libsystemd through CFFI in python or another scripting language if they just want to print an ID. Verb 'new' was already available as 'journalctl --new-id128', but this makes it more discoverable. v2: - rename binary to systemd-id128 - make --app-specific= into a switch that applies to boot-id and machine-id