Commit Graph

645 Commits

Author SHA1 Message Date
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Frantisek Sumsal d7a0f1f4f9 tree-wide: assorted coccinelle fixes 2020-10-09 15:02:23 +02:00
Lennart Poettering 890084db03 tree-wide: port remaining umount() calls to umount_verbose() 2020-09-23 18:57:37 +02:00
Lennart Poettering 21935150a0 tree-wide: switch remaining mount() invocations over to mount_nofollow_verbose()
(Well, at least the ones where that makes sense. Where it does't make
sense are the ones that re invoked on the root path, which cannot
possibly be a symlink.)
2020-09-23 18:57:37 +02:00
Lennart Poettering d5bc4e6898 machine: fix error code propagation in two cases 2020-09-23 13:24:25 +02:00
Lennart Poettering 2a03b9ed21 tree-wide: don't needlessly negate error number passed to bus_error_message()
Like it's customary in our codebase bus_error_message() internally takes
abs() of the passed error anyway, hence no need to explicitly negate it.
We mostly got this right, but in too many cases we didn't. Fix that.
2020-09-14 21:42:22 +02:00
Lennart Poettering 652d90407a tree-wide: copy hardlinks wherever we deal with possibly large OS-style trees
Fixes: #7382
2020-09-09 20:21:49 +02:00
Zbigniew Jędrzejewski-Szmek 90e74a66e6 tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
fangxiuning 6d95e7d9b2
tree-wide: drop pointless zero initialization (#16900) 2020-08-30 06:21:20 +09:00
PhoenixDiscord e8607daf7d
Replace gendered pronouns with gender neutral ones. (#16844) 2020-08-27 11:52:48 +09:00
Zbigniew Jędrzejewski-Szmek 955a632971 tree-wide: use sd_bus_error_has_names() in more places 2020-08-24 19:48:26 +02:00
Lennart Poettering 5a27b39518 nspawn/machine: move mount propagation dir to /run/host/incoming
Previously we'd use a directory /run/systemd/nspawn/incoming for
accepting mounts to propagate from the host. This is a bit weird, since
we have a shared namespace: /run/systemd/ contains both stuff managed by
the surround nspawn as well as from the systemd inside.

We now have the /run/host/ hierarchy that has special stuff we want to
pass from host to container. Let's make use of that here, and move this
directory here too.

This is not a compat breakage, since the payload never interfaces with
that directory natively: it's only nspawn and machined that need to
agree on it.
2020-08-20 10:17:25 +02:00
Lennart Poettering 0a388dfcc5 core,home,machined: generate description fields for all groups we synthesize 2020-08-07 08:39:52 +02:00
Marti Raudsepp 09364a8043 machine: Pass machine, user, program values to polkit on OpenMachineShell
This allows more granular access control in PolicyKit rules, similar to
/etc/sudoers, for polkit actions:
* org.freedesktop.machine1.host-shell
* org.freedesktop.machine1.shell

Example configuration, place in /etc/polkit-1/rules.d/

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.machine1.host-shell"
        && subject.user == "my-user"
        && action.lookup("user") == "target-user") {
            return polkit.Result.YES;
    }
});
2020-08-03 10:03:13 +02:00
fangxiuning ddbab78f9a bus: use bus_log_connect_error to print error message 2020-07-21 10:02:01 +09:00
Lennart Poettering 8e32ad9557 machine: fix if check
Fixes: coverity 1430462
2020-07-16 08:35:26 +02:00
Lennart Poettering 4751364e76 machined: implement user/group lookup varlink API in machined too
Let's natively support our own API in machined too.

This allows us to remove half of nss-mymachines in a later commit.
2020-07-14 17:06:23 +02:00
Lennart Poettering 74d1b7d2ad machined: refactor UID/GID machine translation
Let's move the heavy lifting out of the bus call implemntations, and
into generic code.

This allows us to expose them easily via Varlink too in a later commit.
2020-07-14 17:06:23 +02:00
fangxiuning 4b6607d949 table use table_log_print_error() instead of table_log_show_error 2020-07-08 15:16:52 +08:00
fangxiuning df83eb546b table add table_log_sort_error() 2020-07-08 10:53:57 +08:00
fangxiuning d836018a73 table add table_log_show_error() 2020-07-08 10:50:59 +08:00
Lennart Poettering 40af3d020f shared: split out property get helpers
No code changes, just some refactoring.
2020-06-30 15:10:17 +02:00
Lennart Poettering 9176326ba2 shared: split out code for printing properties
No code changes, just some refactoring.
2020-06-30 15:09:56 +02:00
Lennart Poettering 807542bece shared: split out code that maps properties to local structs
Just some refactoring, no code changes.
2020-06-30 15:09:35 +02:00
Lennart Poettering 9b71e4ab90 shared: actually move all BusLocator related calls to bus-locator.c 2020-06-30 15:09:19 +02:00
Lennart Poettering c664cf5607 shared: split out BusObjectImplementor APIs
Just some refactoring, no code changes
2020-06-30 15:08:35 +02:00
Filipe Brandenburger 41d1f469cf log: introduce log_parse_environment_cli() and log_setup_cli()
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.
2020-06-24 16:49:26 +02:00
Vito Caputo 14456f7607 machine: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
2020-05-07 08:46:43 -07:00
Benjamin Robin 0a0e594a26 tree-wide: Mark as _unused_ variables that are only used in assert()
Allow to build without any warning with NDEBUG defined
2020-05-06 23:03:25 +02:00
Zbigniew Jędrzejewski-Szmek 4faa530cf6 machined: convert to the new scheme and add --bus-introspect 2020-05-05 22:38:31 +02:00
Zbigniew Jędrzejewski-Szmek d4cc0edfce importd,logind: add --bus-introspect= option 2020-05-05 22:34:17 +02:00
Zbigniew Jędrzejewski-Szmek fc021a5bbf logind,importd,hostnamed,localed,timedated,machined,resolved: add option parsing stubs
--help and --version are implemented in the usual style.
help() prints full path, since the program is not expected to
be in $PATH.
2020-05-03 10:55:51 +02:00
Lennart Poettering ac9f55ed40 tree-wide: implement new log control API dbus interface in all our daemons 2020-04-21 17:08:16 +02:00
Zbigniew Jędrzejewski-Szmek bbe17ca1cb machined: add dbus parameter names 2020-04-12 19:48:01 +02:00
Vito Caputo 4fa744a35c *: convert amenable fdopen calls to take_fdopen
Mechanical change to eliminate some cruft by using the
new take_fdopen{_unlocked}() wrappers where trivial.
2020-03-31 06:48:03 -07:00
Lennart Poettering d93dda3afe systemctl: show logs for correct namespace of service 2020-01-31 15:02:52 +01:00
Lennart Poettering 269e4d2d6b shared: split out polkit stuff from bus-util.c → bus-polkit.c
It's enough, complex stuff to warrant its own source file.

No other changes, just splitting out.
2020-01-22 12:34:10 +01:00
Yu Watanabe ab1b472062
Merge pull request #14555 from poettering/table-multine
format-table: proper multi-line support
2020-01-14 06:48:57 +09:00
Lennart Poettering 04d8507f68
Merge pull request #14381 from keszybz/ifindex-cleanup
Resolve alternative names
2020-01-13 17:57:59 +01:00
Lennart Poettering fc6eb08e74 machinectl: modernize address table handling
Primarily, use the new multi-line support in table formatting.

Also, stream-line naming of the "max-addresses" options. We used three
names for the concept internall, let's just unify on the name we use for
this for external users, i.e. "max-addresses".
2020-01-13 16:38:40 +01:00
Zbigniew Jędrzejewski-Szmek 8571210a21 machinectl: reduce scope of iterator variables 2020-01-12 11:24:35 +01:00
Zbigniew Jędrzejewski-Szmek 597da51bae tree-wide: make parse_ifindex simply return the index
We don't need a seperate output parameter that is of type int.  glibc() says
that the type is "unsigned", but the kernel thinks it's "int".  And the
"alternative names" interface also uses ints. So let's standarize on ints,
since it's clearly not realisitic to have interface numbers in the upper half
of unsigned int range.
2020-01-11 12:06:08 +01:00
Yu Watanabe 12845a91b5 machinectl: do not truncate addresses when --full is specified 2020-01-10 19:19:15 +09:00
Yu Watanabe 679c7c7a67 machinectl: optimize table creation 2020-01-10 18:28:17 +09:00
Yu Watanabe a65e34ccb0 machinectl: do not ellipsize table when --full is specified 2020-01-10 12:24:51 +09:00
Zbigniew Jędrzejewski-Szmek 698876640d machine: fold machine_stop_scope() into machine_stop()
No functional change.
2019-11-22 10:24:32 +01:00
Zbigniew Jędrzejewski-Szmek eec12b7756 machined: simplify reference handling for units
Before, we'd unref from machine_stop_unit, still keeping the unit name around,
and only forget the name later, when garbage collecting. If we didn't call
manager_stop_unit(), then we wouldn't do the unref. Let's unref at the same
point where we do garbage collection, so that it is always true that
iff we have the name generated with AddRef=1, then have a reference to the unit,
and as soon as we forget the name, we drop the reference.

This should fix the issue when repeated systemd-nspawn --register=yes fails
with "scope already exists" error.

Incidentally, this fixes an error in the code path where r was used instead of q.
2019-11-22 10:24:32 +01:00
Zbigniew Jędrzejewski-Szmek a01ecfa982 machine: simplify machine_start_scope()
It is called from only one place, and we can make things simpler by calculating the
necessary stuff directly in the function. No functional change.
2019-11-22 10:24:29 +01:00
Zbigniew Jędrzejewski-Szmek af22794712 machine: make machine_start_scope() static
Having this function which is called only from one place in a separate file
makes the code harder to follow. In preparation for subsequent changes, let's
make it static.
2019-11-22 10:23:32 +01:00
Lennart Poettering 353b2baa20 tree-wide: clean up --help texts a bit
This cleans up and unifies the outut of --help texts a bit:

1. Highlight the human friendly description string, not the command
   line via ANSI sequences. Previously both this description string and
   the brief command line summary was marked with the same ANSI
   highlight sequence, but given we auto-page to less and less does not
   honour multi-line highlights only the command line summary was
   affectively highlighted. Rationale: for highlighting the description
   instead of the command line: the command line summary is relatively
   boring, and mostly the same for out tools, the description on the
   other hand is pregnant, important and captions the whole thing and
   hence deserves highlighting.

2. Always suffix "Options" with ":" in the help text

3. Rename "Flags" →  "Options" in one case

4. Move commands to the top in a few cases

5. add coloring to many more help pages

6. Unify on COMMAND instead of {COMMAND} in the command line summary.
   Some tools did it one way, others the other way. I am not sure what
   precisely {} is supposed to mean, that uppercasing doesn't, hence
   let's simplify and stick to the {}-less syntax

And minor other tweaks.
2019-11-18 15:14:43 +01:00