1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00
Commit Graph

25438 Commits

Author SHA1 Message Date
Lennart Poettering
e4bb56c7a9 install: add root directory to LookupPaths structure
We use the root directory parameter while putting together the LookupPaths
structure, hence let's also store it in the structure as-is. That way we can
drop a parameter from half of the functions in install.c

Also, let's move the validation of the root paths into lookup_paths_init() so
that we can drop even more code from install.c
2016-04-12 13:43:30 +02:00
Lennart Poettering
32c0ed7bbb install: change in_search_path() to take a LookupPaths structure
Similar to the other calls that operate on the collected path data.
2016-04-12 13:43:30 +02:00
Lennart Poettering
f4dc1e65e3 install: rename unit_file_is_generated() → path_is_generator()
This way the funciton name matches nicely our other calls path_is_config() and
path_is_runtime().
2016-04-12 13:43:30 +02:00
Lennart Poettering
385eb99634 install: be more accurate when checking whether something is runtime configuration
Let's actually check the runtime config dir, instead of just /run.
2016-04-12 13:43:30 +02:00
Lennart Poettering
21b3926840 network: hashmap_put() can fail
Let's properly handle hashmap_put() failing.
2016-04-12 13:43:30 +02:00
Lennart Poettering
2c289ea833 core: introduce MANAGER_IS_RELOADING() macro
This replaces the old function call manager_is_reloading_or_reexecuting() which
was used only at very few places. Use the new macro wherever we check whether
we are reloading. This should hopefully make things a bit more readable, given
the nature of Manager:n_reloading being a counter.
2016-04-12 13:43:30 +02:00
Lennart Poettering
463d0d1569 core: remove ManagerRunningAs enum
Previously, we had two enums ManagerRunningAs and UnitFileScope, that were
mostly identical and converted from one to the other all the time. The latter
had one more value UNIT_FILE_GLOBAL however.

Let's simplify things, and remove ManagerRunningAs and replace it by
UnitFileScope everywhere, thus making the translation unnecessary. Introduce
two new macros MANAGER_IS_SYSTEM() and MANAGER_IS_USER() to simplify checking
if we are running in one or the user context.
2016-04-12 13:43:30 +02:00
Lennart Poettering
c51932be73 systemctl: port systemctl over to the new LookupPaths configuration directory fields 2016-04-12 13:43:30 +02:00
Lennart Poettering
e1c5c2b0d2 install: make use of configuration directory paths in LookupPaths
Now that the LookupPaths structure contains the directory paths, let's make use
of that everywhere instead of duplicating the logic.
2016-04-12 13:43:30 +02:00
Lennart Poettering
a0f84a104c core: add configuration directories to LookupPaths
Let's add a seperate fields for the directories where we place runtime and
persistent configuration, so that we can use this in install.c (to be added in
a later commit), and we store path information in the same place everywhere.
2016-04-12 13:43:30 +02:00
Lennart Poettering
7bfe3d44d0 core: when enabling a generated unit file, return a clean error
Let's be precise when the user tries to invoke an "enable" operation on a
generated unit file.
2016-04-12 13:43:29 +02:00
Lennart Poettering
f413930863 core: add a new unit file state "generated"
Now that we store the generator directories in LookupPaths we can use this to
intrdouce a new unit file state called "generated", for units in these
directories.

Fixes: #2348
2016-04-12 13:43:29 +02:00
Lennart Poettering
a3c4eb0710 core: rework generator dir logic, move the dirs into LookupPaths structure
A long time ago – when generators where first introduced – the directories for
them were randomly created via mkdtemp(). This was changed later so that they
use fixed name directories now. Let's make use of this, and add the genrator
dirs to the LookupPaths structure and into the unit file search path maintained
in it. This has the benefit that the generator dirs are now normal part of the
search path for all tools, and thus are shown in "systemctl list-unit-files"
too.
2016-04-12 13:43:29 +02:00
Lennart Poettering
4447e799be man: minor nspawn doc fixes 2016-04-12 13:43:29 +02:00
Lennart Poettering
1dfa3076cf core: drop SysV paths from path-lookup logic
We don't need it anymore, give that sysv-generator can determine the path on
its own now.
2016-04-12 13:43:29 +02:00
Lennart Poettering
4143c6c305 sysv-generator: don't use LookupPath logic for determining SysV paths
The sysv-generator is the only user of the SysV paths these days, let's make it
figure out the right paths on its own.

(In a subsequent commit we can then drop the same logic from LookupPath).
2016-04-12 13:43:29 +02:00
Lennart Poettering
03ce175f4c import: drop unused definition 2016-04-12 13:43:29 +02:00
Lennart Poettering
1ade1cc0bf Merge pull request #3016 from martinpitt/systemctl-enable
Install: correctly report symlink creations
2016-04-12 11:34:44 +02:00
Zbigniew Jędrzejewski-Szmek
6d10d308c6 Do not report masked units as changed (#2921)
* core/unit: extract checking of stat paths into helper function

The same code was repeated three times.

* core: treat masked files as "unchanged"

systemctl prints the "unit file changed on disk" warning
for a masked unit. I think it's better to print nothing in that
case.

When a masked unit is loaded, set mtime as 0. When checking
if a unit with mtime of 0 needs reload, check that the mask
is still in place.

* test-dnssec: fix build without gcrypt

Also reorder the test functions to follow the way they are called
from main().
2016-04-12 11:10:57 +02:00
Lukáš Nykrýn
35a6750d9e rules: set SYSTEMD_READY=0 on DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 only with ADD event (#2747)
The "SYSTEMD_READY=0" will cause automatic unmount
of mountpoint that is on top of such DM device
if this is used with multipath which sets
DM_UDEV_DISABLE_OTHER_RULES_FLAG in case
we have a CHANGE event thatcomes after DM multipath
device reload when one of the paths is down or up.

See https://bugzilla.redhat.com/show_bug.cgi?id=1312011
2016-04-12 07:44:28 +02:00
Evgeny Vereshchagin
dbab702a2a tests: port udev-test to log_*_errno (#3015)
SYSTEMD_LOG_LEVEL=debug test/udev-test.pl is working now
Also, fixes CID 1354602
2016-04-11 21:31:57 +02:00
Martin Pitt
3de1521427 Install: correctly report symlink creations
All callers of create_symlink(), such as install_info_symlink_wants(), expect
that to return > 0 if it actually did something, and then return that number.
unit_file_enable() uses that to determine if any action was done
(carries_install_info != 0) and if not, show a "The unit files have no
[Install] section" warning.

Return 1 instead of 0 in the two code paths of create_symlink() when the link
was created or replaced with a new value.

This fixes getting a bogus "No [Install] section" warning when enabling a unit
with full path, like "systemctl enable /some/path/myunit.service".
2016-04-11 21:03:29 +02:00
Lennart Poettering
70a399c43a Merge pull request #3014 from msekletar/nspawn-empty-machine-id-v3
nspawn: always setup machine id (v3)
2016-04-11 17:27:11 +02:00
Michal Sekletar
e01ff70a77 nspawn: always setup machine id
We check /etc/machine-id of the container and if it is already populated
we use value from there, possibly ignoring value of --uuid option from
the command line. When dealing with R/O image we setup transient machine
id.

Once we determined machine id of the container, we use this value for
registration with systemd-machined and we also export it via
container_uuid environment variable.

As registration with systemd-machined is done by the main nspawn process
we communicate container machine id established by setup_machine_id from
outer child to the main process by unix domain socket. Similarly to PID
of inner child.
2016-04-11 16:43:16 +02:00
Lennart Poettering
2270dfb852 Merge pull request #3012 from martinpitt/hwdb
hwdb updates
2016-04-11 16:07:16 +02:00
Ronny Chevalier
6c006ed487 Merge pull request #3011 from evverx/dont-silently-skip-test-namespace
tests: don't silently skip `test-namespace`
2016-04-11 13:51:51 +01:00
Martin Pitt
14b6625901 Merge pull request #2996 from keszybz/coverity-fixes
Coverity fixes
2016-04-11 11:19:27 +02:00
Martin Pitt
3a1e008f60 keymap: Add HP ProBook 640 G2
Fixes #2997
2016-04-11 11:17:07 +02:00
Martin Pitt
7b2cee4994 hwdb: Add SteelSeries Sensei Raw mouse
Fixes #3009
2016-04-11 10:48:43 +02:00
Evgeny Vereshchagin
d2528deb44 tests: don't silently skip test-namespace 2016-04-10 23:41:04 +00:00
Zbigniew Jędrzejewski-Szmek
cbe2220614 Merge pull request #3008 from evverx/udev-test-ignore-some-mount-errors
tests: ignore some mount errors in test-udev
2016-04-10 17:21:18 -04:00
Evgeny Vereshchagin
ad43ccb096 tests: ignore some mount errors in test-udev
Fixes:
$ sudo make distcheck
...
FAIL: test/udev-test.pl
...

$ vi systemd-229/_build/sub/test/udev-test.pl.log
...
failed to mount empty
/home/ubuntu/systemd/systemd-229/_inst/lib/udev/rules.d No such file or directory
...
failed to mount empty
/home/ubuntu/systemd/systemd-229/_inst/lib/udev/rules.d No such file or directory
...
414 errors occurred
2016-04-10 20:01:27 +00:00
Martin Pitt
d24b90cb5d Merge pull request #3002 from robertwec/master
hwdb: Add MODECOM MC-WM4 and Sharkoon Shark Force
2016-04-10 09:50:44 +02:00
Martin Pitt
807280092d Merge pull request #3004 from tsmock/master
hwdb/70-mouse.hwdb: Add Dynex Wired Mouse (DX-WMSE2)
2016-04-10 09:48:52 +02:00
Taylor Smock
7fab057dcc hwdb/70-mouse.hwdb: Add Dynex Wired Mouse (DX-WMSE2) 2016-04-09 17:37:48 -06:00
Robert Węcławski
c29b3379b2 hwdb: Add MODECOM MC-WM4 and Sharkoon Shark Force 2016-04-10 00:53:23 +02:00
Zbigniew Jędrzejewski-Szmek
7236ce6e9e core/service: only search for pid if loading from file failed
CID #1237511.
2016-04-08 21:09:17 -04:00
Zbigniew Jędrzejewski-Szmek
783e05d637 core/service: drop return value that is always ignored anyway 2016-04-08 21:09:11 -04:00
Zbigniew Jędrzejewski-Szmek
0b9aa27016 shutdown: use (void)
NULL cgroup is handled below.
2016-04-08 21:09:09 -04:00
Zbigniew Jędrzejewski-Szmek
d929b0f98b nspawn: ignore failure to chdir
CID #1322380.
2016-04-08 21:09:06 -04:00
Zbigniew Jędrzejewski-Szmek
ddea446252 journal: assert gcry_mpi_scan succeeded
It might be nicer to propagate the error to the caller, but that'd
be a bigger refactoring. This shouldn't really fail, so just add
an assert.

CID #1349697.
2016-04-08 21:08:54 -04:00
Zbigniew Jędrzejewski-Szmek
9d4e7d1380 sd-resolve: ignore error in pthread_join()
CID #1338424.
2016-04-08 21:08:42 -04:00
Zbigniew Jędrzejewski-Szmek
94edd38e1d basic/util: check return value of dup2 in fork_agent()
CID #1304689.
2016-04-08 21:08:29 -04:00
Zbigniew Jędrzejewski-Szmek
edfd706d9c import: use (void) more
CID #1299018-9.
2016-04-08 21:08:23 -04:00
Zbigniew Jędrzejewski-Szmek
b3b90a25f3 udevadm: assert return value
This mirrors what we do in now().
CID #1351755.
2016-04-08 21:08:21 -04:00
Zbigniew Jędrzejewski-Szmek
045e00cf16 udevd: use (void) to silence coverity
CID #1351429.
2016-04-08 21:08:18 -04:00
Zbigniew Jędrzejewski-Szmek
164d025dd3 resolved: handle oom properly
CID #1349699-1349700.
2016-04-08 21:08:15 -04:00
Zbigniew Jędrzejewski-Szmek
0229100b6c network: check return value
CID #1349698.
2016-04-08 21:08:02 -04:00
Lennart Poettering
0c0ee5ebee Merge pull request #2990 from evverx/sys-depends-on-sys-tar-xz
build-sys: test/sys depends on test/sys.tar.xz
2016-04-08 19:08:52 +02:00
Evgeny Vereshchagin
17d6dede6a build-sys: test/sys depends on test/sys.tar.xz
Fixes:
$ ls -ld test/sys
drwxr-xr-x. 12 vagrant vagrant 4096 Jan  6  2012 test/sys

$ git pull
Updating d4337c1..710a885
Fast-forward
 ...
 test/sys.tar.xz                             | Bin 261380 -> 165116 bytes
 test/udev-test.pl                           |  67 ++++++++++++-----

$ sudo make check TESTS=test/udev-test.pl
...
FAIL: test/udev-test.pl

$ rm -r test/sys
$ make test/sys
$ sudo make check TESTS=test/udev-test.pl
...
PASS: test/udev-test.pl
2016-04-08 13:53:03 +00:00