summaryrefslogtreecommitdiff
path: root/src/shared/install.c
Commit message (Collapse)AuthorAge
* shared: fix memleakRonny Chevalier2017-03-14
| | | | path was used for 2 purposes but it was not freed before being reused.
* fix gcc warnings about uninitialized variablesHarald Hoyer2015-03-27
| | | | | | | | | | | | | like: src/shared/install.c: In function ‘unit_file_lookup_state’: src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized] return r < 0 ? r : state; ^ src/shared/install.c:1796:13: note: ‘r’ was declared here int r; ^
* sysv-generator: initialize LookupPaths just onceZbigniew Jędrzejewski-Szmek2015-03-14
| | | | | | | | With debugging on, sysv-generator would print the full set of lookup paths for *every* sysv script. While at it, pass LookupPaths as a pointer in sysv-generator, and constify it everywhere.
* tree-wide: there is no ENOTSUP on linuxDavid Herrmann2015-03-13
| | | | Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* util: rework strappenda(), and rename it strjoina()Lennart Poettering2015-02-03
| | | | | | After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
* path-lookup, systemctl: export lookup_paths_init_from_scope() from ↵Ivan Shapovalov2015-01-05
| | | | shared/install.c and use it
* util: rename ignore_file() to hidden_file()Lennart Poettering2014-12-19
| | | | | hidden_file() is a bit more precise, since dot files usually shouldn't be ignored, but certainly be considered hidden.
* core: properly pass unit file state to clients via the busLennart Poettering2014-12-10
|
* shared: install - report error if mask symlink can not be marked for removalTom Gundersen2014-11-29
|
* treewide: yet more log_*_errno + return simplificationsMichal Schmidt2014-11-28
| | | | | | | | | | | | | Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* shared/install: when unit contains only Also=, report 'indirect'Jan Synacek2014-11-10
| | | | | | | If a unit contains only Also=, with no Alias= or WantedBy=, it shouldn't be reported as static. New 'indirect' status shall be introduced. https://bugzilla.redhat.com/show_bug.cgi?id=864298
* shared/install: avoid prematurely rejecting "missing" unitsDave Reisner2014-10-31
| | | | | | | | | | f7101b7368df copied some logic to prevent enabling masked units, but also added a check which causes attempts to enable templated units to fail. Since we know the logic beyond this check will properly handle units which truly do not exist, we can rely on the unit file state comparison to suffice for expressing the intent of f7101b7368df. ref: https://bugs.archlinux.org/task/42616
* systemctl: do not ignore errors in symlink removalZbigniew Jędrzejewski-Szmek2014-10-25
| | | | On an ro fs, systemctl disable ... would fail silently.
* install, cgtop: adjust hashmap_move_one() callers for -ENOMEM possibilityMichal Schmidt2014-10-23
| | | | | | | | | | | | That hashmap_move_one() currently cannot fail with -ENOMEM is an implementation detail, which is not possible to guarantee in general. Hashmap implementations based on anything else than chaining of individual entries may have to allocate. hashmap_move_one will not fail with -ENOMEM if a proper reservation has been made beforehand. Use reservations in install.c. In cgtop.c simply propagate the error instead of asserting.
* install: make InstallContext::{will_install,have_installed} OrderedHashmapsMichal Schmidt2014-10-23
| | | | It appears order may matter here. Use OrderedHashmaps to be safe.
* systemctl: add add-wants and add-requires verbsLukas Nykryn2014-10-08
|
* core: don't allow enabling if unit is maskedJan Synacek2014-10-07
|
* Rename user_runtime to user_runtime_dirZbigniew Jędrzejewski-Szmek2014-10-02
| | | | | This makes this function name similar to user_config_home() and makes it match the name of the environment variable.
* add a transient user unit directorySteven Allen2014-10-02
| | | | | | | | | This patch adds a transient user unit directory under `$XDG_RUNTIME_DIR/systemd/user/` and stores transient user-instance units (such as those created by `systemd-run --user`) under there instead of putting them in $XDG_CONFIG_HOME/systemd/user/. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=67331
* shared: fix resource leak in config_parse_default_instanceAndreas Henriksson2014-09-16
| | | | | | The recently allocated "printed" is not freed on error path. Found by coverity. Fixes: CID#1237745
* hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt2014-09-15
| | | | | | | | | It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
* systemctl: fix broken list-unit-files with --rootLukas Nykryn2014-08-27
|
* Revert "systemctl: fix broken list-unit-files with --root"Lennart Poettering2014-08-26
| | | | | | | This reverts commit 41a451cc2901a5deb985aea4cc8de204a22e5612. This breaks checks for masking of units file, since we invoke null_or_empty_path() on the resulting path.
* systemctl: fix broken list-unit-files with --rootLukas Nykryn2014-08-25
| | | | | | | | This patch modifies unit_file_get_list which will now return hashmap of structures where f->path is *without* root_dir prefix. This change should be ok, because current code either does not use root_dir at all or calls basename() on the f->path.
* install: simplify usage of _cleanup_ macrosLennart Poettering2014-08-21
|
* systemctl: fail in the case that no unit files were foundLukas Nykryn2014-08-20
| | | | | | | | | | | | | Previously systemctl died with message -bash-4.2# systemctl --root /rawhi list-unit-files (src/systemctl/systemctl.c:868) Out of memory. in the case that no unit files were found in the --root or the directory did not exist. So lets return ENOENT in the case that --root does not exist and empty list in the case that there are no unit files.
* util: allow strappenda to take any number of argsDave Reisner2014-08-13
| | | | | This makes strappenda3 redundant, so we remove its usage and definition. Add a few tests along the way for sanity.
* Properly report invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | $ systemd-analyze verify trailing-g.service [./trailing-g.service:2] Trailing garbage, ignoring. trailing-g.service lacks ExecStart setting. Refusing. Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument. Failed to create trailing-g.service/start: Invalid argument
* Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | | | | | | | | | | | | | | | String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
* Add utility function to append root to pathZbigniew Jędrzejewski-Szmek2014-07-26
|
* Always check asprintf return codeKarel Zak2014-07-26
| | | | | | | There is a small number of the places in sources where we don't check asprintf() return code and assume that after error the function returns NULL pointer via the first argument. That's wrong, after error the content of pointer is undefined.
* test-tables: add new entriesZbigniew Jędrzejewski-Szmek2014-07-16
| | | | | | One missing string found. A few things had to be moved around to make it possible to test them.
* Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek2014-07-16
| | | | | | | | Special care is needed so that we get an error message if the file failed to parse, but not when it is missing. To avoid duplicating the same error check in every caller, add an additional 'warn' boolean to tell config_parse whether a message should be issued. This makes things both shorter and more robust wrt. to error reporting.
* Constify ConfigTableItem tablesZbigniew Jędrzejewski-Szmek2014-07-15
|
* conf-files: include root in returned file pathsMichael Marineau2014-06-20
| | | | | | | | | | This restores the original root handling logic that was present prior to 112cfb18 when path expansion moved to path_strv_canonicalize_absolute. That behavior partially went away in 12ed81d9. Alternatively all users of conf_files_list* could be updated to concatenate the paths themselves as unit_file_query_preset did but since no user needs the un-concatenated form that is pointless duplication.
* install: remove unused variableThomas Hindoe Paaboel Andersen2014-06-17
|
* install: improve paths we show the user when enabling/disablingLennart Poettering2014-06-17
|
* install: simplify symlink --root= logicLennart Poettering2014-06-17
|
* install: "systemctl enable" should be a nop for template units lacking a ↵Lennart Poettering2014-06-17
| | | | DefaultInstance= setting
* install: make sure that --root= mode doesn't make us consider all units ↵Lennart Poettering2014-06-17
| | | | outside of search path
* install: make sure "systemctl disable foobar@.service" actually removes all ↵Lennart Poettering2014-06-17
| | | | instances
* install: introduce new DefaultInstance= field for [Install] sectionsLennart Poettering2014-06-17
| | | | | | | | | | | | The DefaultInstance= name is used when enabling template units when only specifying the template name, but no instance. Add DefaultInstance=tty1 to getty@.service, so that when the template itself is enabled an instance for tty1 is created. This is useful so that we "systemctl preset-all" can work properly, because we can operate on getty@.service after finding it, and the right instance is created.
* install: when looking for a unit file for enabling, search for templates ↵Lennart Poettering2014-06-17
| | | | | | | only after traversing all search directories Let's always make sure to look in all search directories for the full unit names first, before looking for templates for them.
* install: use symlink_atomic() instead of unlink()+symlink() when force ↵Lennart Poettering2014-06-17
| | | | creating a symlink
* install: various modernizationsLennart Poettering2014-06-17
|
* install: teach preset query logic --root= supportLennart Poettering2014-06-17
|
* install: beef up preset logic to limit to only enable or only disable, and ↵Lennart Poettering2014-06-17
| | | | | | | | | | | | | | | | do all-unit preset operations The new "systemctl preset-all" command may now be used to put all installed units back into the enable/disable state the vendor/admin encoded in preset files. Also, introduce "systemctl --preset-mode=enable-only" and "systemctl --preset-mode=disable-only" to only apply the enable or only the disable operations of a "systemctl preset" or "systemctl preset-all" operation. "systemctl preset-all" implements this RFE: https://bugzilla.redhat.com/show_bug.cgi?id=630174