summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-04-12systemctl: don't confuse sysv code with generated unitsLennart Poettering
The SysV compat code checks whether there's a native unit file before looking for a SysV init script. Since the newest rework generated units will show up in the unit path, and hence the checks ended up assuming that there always was a native unit file for each init script: the generated one. With this change the generated unit file directory is suppressed from the search path when this check is done, to avoid the confusion.
2016-04-12path-lookup: move generator_binary_paths() to end of fileLennart Poettering
Let's keep the code that manipulates LookupPaths together, and move generator_binary_paths() to the end of the .h and .c files, since it is not strictly related to that.
2016-04-12systemctl: add error message when we get unexpected event from waitid()Lennart Poettering
We should log about everything we don't expect. Also, add a comment for one case were we do not log, on purpose, and make it use a separate error code.
2016-04-12systemctl: fix incorrect errno for error messageLennart Poettering
2016-04-12systemctl: move check whether a service exists as native unit file to install.cLennart Poettering
Move the search path check from the SysV service compat support into install.c so that we can reuse the usual algorithm instead of rolling a private loop for this.
2016-04-12core: rework reboot parameter logic a bitLennart Poettering
Always warn if something fails, and clarify that the involved utility functions do so in their name. Drop the REBOOT_PARAM_FILE macro. We don't do this for other flag file paths like this, so don't do this for this one either. The path isn't configurable anyway, hence let's make this easier to read by avoiding this one indirection.
2016-04-12core: be more paranoid when mixing umask and fopen()Lennart Poettering
Let's be extra careful with the umask when we use simple fopen(), as this creates files with 0777 by default.
2016-04-12core: rework how transient unit files and property drop-ins workLennart Poettering
With this change the logic for placing transient unit files and drop-ins generated via "systemctl set-property" is reworked. The latter are now placed in the newly introduced "control" unit file directory. The fomer are now placed in the "transient" unit file directory. Note that the properties originally set when a transient unit was created will be written to and stay in the transient unit file directory, while later changes are done via drop-ins. This is preparation for a later "systemctl revert" addition, where existing drop-ins are flushed out, but the original transient definition is restored.
2016-04-12core: introduce a "control" unit file directoryLennart Poettering
This patch adds a concept of a "control" unit file directory, which is supposed to be used as place for unit file drop-ins created by "systemctl set-property" (note that this directory is not actually hooked up to "systemctl set-property" yet, that's coming in a later patch). The rationale for this: previously changes made by the user and by "systemctl set-property" were done in the same directory, which made semantics very unclear: the changes made by "systemctl set-property" were applied instantly, and their drop-ins only written to not lose settings on a later "systemctl daemon-reload", while drop-ins made by the user would only be in effect after "systemctl daemon-reload". This is particular problematic as the changes made by "systemctl set-property" would really apply immediately without any respect for the unit search path. This meant that using "set-property" could have an effect that is lsot as soon as "daemon-reload" is issued, in case there was a "later" drop-in already in place. With this change the directories are seperated, and the "control" directory always takes the highest priority of all, to avoid any confusion.
2016-04-12install: rename generator_paths() → generator_binary_paths()Lennart Poettering
This is too confusing, as this funciton returns the paths to the generator binaries, while usually when we refer to the just the "generator path" we mean the generated unit files. Let's clean this up.
2016-04-12core: move flushing of generated unit files to path-lookup.cLennart Poettering
It's very similar to the mkdir and trim operations for the generator dirs, hence let's unify this at a single place.
2016-04-12core: minor coding style fixLennart Poettering
2016-04-12tests: make sure test-path-lookup can run even when no units are installed ↵Lennart Poettering
on test system
2016-04-12localed: downgrade libxkbcommon to an optional runtime dependencyLennart Poettering
Previously, libxkbcommon was a compile-time option. When enabled the localed binary would strictly depend on it, thus pulling in libxkbcommon and its dependencies, which are non-trivial in size. With this change we dlopen() libxkbcommon when it is available instead. If the library is available behaviour is as before. However, if it isn't the system is considered "headless", i.e. without local hardware and all attempts to set the local keyboard configuration will be refused. This is useful for general-purpose distributions which want to support "headless" (such as container systems) and "full" systems with the same build.
2016-04-12test: bump up log level for install root testLennart Poettering
2016-04-12shared: add a temporary work-around for kernel header inclusion fuck-upLennart Poettering
See: #2864
2016-04-12install: unify checking whether operations may be applied to a unit file in ↵Lennart Poettering
a new function Let's replace repeated code by a single implementation in a single function.
2016-04-12install: introduce a new unit file state "transient"Lennart Poettering
Now, that the search path logic knows the unit path for transient units we also can introduce an explicit unit file state "transient" that clarifies to the user what kind of unit file he is encountering.
2016-04-12install: fix root prefix handlingLennart Poettering
Previously, we'd execute some operations with the root prefix applied, while others without (which was a bug). Clean this up: all paths are now prefixed properly with the root path, and we strip it off when necessary. (Of course, an alternative option would be to strictly pass around paths without the prefix prepended and only prepend it right before hitting the disk, however, I am came to the conclusion this would result in more code.)
2016-04-12path-lookup: make user_runtime_dir() more genericLennart Poettering
Let's make the suffix it appends configurable. This way we can reuse it at a second place.
2016-04-12path-lookup: clean up user_config_home() and user_runtime_dir()Lennart Poettering
Let's modernize these calls a bit. Also, don't call them from user_dirs() anymore, as we already have both dirs in the list a second time via the persistent_config and runtime_config function parameters.
2016-04-12update CODING_STYLE a bitLennart Poettering
2016-04-12path-lookup: stop exporting two functionsLennart Poettering
user_runtime_dir() and user_config_home() are not used externally anymore, hence let's not export them anymore.
2016-04-12core: modernize manager_build_unit_patch_cache() a bitLennart Poettering
2016-04-12core: don't reorder drop-ins when changing propertiesLennart Poettering
The drop-in order we present should actually show what we is in effect, hence let's not reorder it when writing changes. After all, just sorting alphabetically is going to break things, as it doesn't respect that /etc breaks /run breaks /usr...
2016-04-12core: don't drop transient drop-ins when loading the restLennart Poettering
Previously, when creating a transient unit, we'd first add the transient drop-ins to the unit, and then normally load any other drop-ins later on top of this, replacing the already loaded drop-ins. Let's not do this, after all the transient drop-ins area already in effect, let's just add what we find on disk, but not replace it.
2016-04-12core: rework logic to drop duplicate and non-existing items from search pathLennart Poettering
Move this into a function of its own, so that we can run it after we ran the generators, so that it takes into account removed generator dirs.
2016-04-12path-lookup: split out logic for mkdir/rmdir of generator dirs in their own ↵Lennart Poettering
functions
2016-04-12core: add a separate unit directory for transient unitsLennart Poettering
Previously, transient units were created below the normal runtime directory /run/systemd/system. With this change they are created in a special transient directory /run/systemd/transient, which only contains data for transient units. This clarifies the life-cycle of transient units, and makes clear they are distinct from user-provided runtime units. In particular, users may now extend transient units via /run/systemd/system, without systemd interfering with the life-cycle of these files. This change also adds code so that when a transient unit exits only the drop-ins in this new directory are removed, but nothing else. Fixes: #2139
2016-04-12path-lookup: add configured unit paths back into search pathLennart Poettering
After all, for test builds they might differ from /etc/systemd/{user|system}, hence they should be included.
2016-04-12core: reuse manager_get_runtime_prefix() at more placesLennart Poettering
2016-04-12install: add root directory to LookupPaths structureLennart Poettering
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-12install: change in_search_path() to take a LookupPaths structureLennart Poettering
Similar to the other calls that operate on the collected path data.
2016-04-12install: rename unit_file_is_generated() → path_is_generator()Lennart Poettering
This way the funciton name matches nicely our other calls path_is_config() and path_is_runtime().
2016-04-12install: be more accurate when checking whether something is runtime ↵Lennart Poettering
configuration Let's actually check the runtime config dir, instead of just /run.
2016-04-12network: hashmap_put() can failLennart Poettering
Let's properly handle hashmap_put() failing.
2016-04-12core: introduce MANAGER_IS_RELOADING() macroLennart Poettering
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-12core: remove ManagerRunningAs enumLennart Poettering
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-12systemctl: port systemctl over to the new LookupPaths configuration ↵Lennart Poettering
directory fields
2016-04-12install: make use of configuration directory paths in LookupPathsLennart Poettering
Now that the LookupPaths structure contains the directory paths, let's make use of that everywhere instead of duplicating the logic.
2016-04-12core: add configuration directories to LookupPathsLennart Poettering
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-12core: when enabling a generated unit file, return a clean errorLennart Poettering
Let's be precise when the user tries to invoke an "enable" operation on a generated unit file.
2016-04-12core: add a new unit file state "generated"Lennart Poettering
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-12core: rework generator dir logic, move the dirs into LookupPaths structureLennart Poettering
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-12man: minor nspawn doc fixesLennart Poettering
2016-04-12core: drop SysV paths from path-lookup logicLennart Poettering
We don't need it anymore, give that sysv-generator can determine the path on its own now.
2016-04-12sysv-generator: don't use LookupPath logic for determining SysV pathsLennart Poettering
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-12import: drop unused definitionLennart Poettering
2016-04-12Merge pull request #3016 from martinpitt/systemctl-enableLennart Poettering
Install: correctly report symlink creations
2016-04-12Do not report masked units as changed (#2921)Zbigniew Jędrzejewski-Szmek
* 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().