summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-04-12man: clarify that DefaultDependencies= is in the [Unit] sectionLennart Poettering
This hopefully reduces confusion resulting in issues like #2992.
2016-04-12tests: override XDG_RUNTIME_DIR where we use the user runtime dirLennart Poettering
We don#t really support systems where XDG_RUNTIME_DIR is not supported for systemd --user. Hence, let's always set our own XDG_RUNTIME_DIR for tests that involve systemd --user, so that we know it is set, and that it doesn't polute the user's actual runtime dir.
2016-04-12core: optimize unit_write_drop_in a bitLennart Poettering
There's no point in first determining the drop-in file name path, then forgetting it again, and then determining it again. Instead, just generated it once, and then write to ti directly.
2016-04-12core: when creating a drop-in snippet, add a comment explaining this to itLennart Poettering
2016-04-12core,systemctl: add new "systemctl revert" commandLennart Poettering
This allows dropping all user configuration and reverting back to the vendor default of a unit file. It basically undoes what "systemctl edit", "systemctl set-property" and "systemctl mask" do.
2016-04-12install: fix errno handlingLennart Poettering
2016-04-12install: simplify skip_root() a bitLennart Poettering
Exit early, so that we can get rid of the large if block.
2016-04-12nstall: no need to export unit_file_lookup_state() anymoreLennart Poettering
We only use it inside of install.c, hence let's make it static.
2016-04-12tree-wide: add new SIGNAL_VALID() macro-like function that validates signal ↵Lennart Poettering
numbers And port all code over to use it.
2016-04-12basic: remove rbtree code, it's unusedLennart Poettering
it's unused, and should we need it one day we can always resurrect it from git history.
2016-04-12sysv-generator: port to use new unit_file_exists() callLennart Poettering
The code previously queries the state of a unit file, but was only interested in the existance of it, hence let's use unit_file_exists() instead, the same way the SysV compat code in systemctl does it.
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