summaryrefslogtreecommitdiff
path: root/src/systemctl
AgeCommit message (Collapse)Author
2014-12-24sd-bus: rename sd_bus_open_system_container() to sd_bus_open_system_machine()Lennart Poettering
Pretty much everywhere else we use the generic term "machine" when referring to containers in API, so let's do though in sd-bus too. In particular, since the concept of a "container" exists in sd-bus too, but as part of the marshalling system.
2014-12-16systemctl: fix argument handling when invoked as "shutdown"Jan Synacek
2014-12-16systemctl: refuse to edit runtime dropins when they already exist in /etcZbigniew Jędrzejewski-Szmek
The check for existing unit files and dropins is unified. path_join() is updated to not insert duplicate separators.
2014-12-16systemctl: share path lookup between 'cat' and 'edit'Zbigniew Jędrzejewski-Szmek
'systemctl cat' now works for templates too. 'systemctl edit' does not refuse to edit units that have changed on disk. That restriction didn't seem useful, actually editing units that have changed on disk before they are started is very reasonable. 'edit' with instances and templates works again: Now: $ build/systemctl edit getty@ Failed to copy /etc/systemd/system/getty@.service.d/override.conf to /etc/systemd/system/getty@.service.d/.override.confdff6290408c86369: Permission denied $ build/systemctl edit getty@tty3 Failed to create directories for /etc/systemd/system/getty@tty3.service.d/override.conf: Permission denied $ build/systemctl edit --full getty@tty3 Failed to copy /usr/lib/systemd/system/getty@.service to /etc/systemd/system/.getty@tty3.serviced3d175087e7e439b: Permission denied Failed to create temporary file for /etc/systemd/system/getty@tty3.service: Permission denied $ build/systemctl edit --full getty@ Failed to copy /usr/lib/systemd/system/getty@.service to /etc/systemd/system/.getty@.servicea3caad491c0f2f3d: Permission denied Failed to create temporary file for /etc/systemd/system/getty@.service: Permission denied
2014-12-16systemctl: split out LookupPaths initializationZbigniew Jędrzejewski-Szmek
2014-12-16systemctl: move two functions upZbigniew Jędrzejewski-Szmek
No functional change.
2014-12-16systemctl: unify warning about unit files changed on diskZbigniew Jędrzejewski-Szmek
2014-12-16systemctl: do not use -1 for return codeZbigniew Jędrzejewski-Szmek
Also make the error messages more specific to give a hint to the user how to solve the problem.
2014-12-15unit: handle nicely of certain unit types are not supported on specific systemsLennart Poettering
Containers do not really support .device, .automount or .swap units; Systems compiled without support for swap do not support .swap units; Systems without kdbus do not support .busname units. With this change attempts to start a unsupported unit types will result in an immediate "unsupported" job result, which is a lot more descriptive then before. Also, attempts to start device units in containers will now immediately fail instead of causing jobs to be enqueued that never go away.
2014-12-13systemctl: handle correctly template units for edit verbRonny Chevalier
Previously, if we provided getty@.service to systemctl edit it would have failed when using the bus because it is an invalid unit name. But it would have succeeded when searching in the filesystem. Now, we check if we have a template, if we do we search in the filesystem, if we don't have a templae and we can use the bus, we do. Furthermore, if we provided getty@tty1.service it would not have worked when searching the filesystem, but it would have worked with the bus. So now, when using the filesystem we use the template name and not the unit name, and the same when logging errors. (Also did a refactoring to avoid a long function)
2014-12-12copy: use btrfs reflinking only whe we know we copy full filesLennart Poettering
2014-12-12util: when using basename() for creating temporary files, verify the ↵Lennart Poettering
resulting name is actually valid Also, rename filename_is_safe() to filename_is_valid(), since it actually does a full validation for what the kernel will accept as file name, it's not just a heuristic.
2014-12-11treewide: correct spacing near eol in code commentsTorstein Husebø
2014-12-10sd-bus: move common errors src/shared/bus-errors.h → ↵Lennart Poettering
src/libsystemd/sd-bus/bus-common-errors.h Stuff in src/shared/ should not use stuff from src/libsystemd/ really.
2014-12-09systemctl: fix invalid free when enabling sysv services failsZbigniew Jędrzejewski-Szmek
The error was introduced in v215-343-g60731f32f1 'systemctl: do not bother to mutate state on error', by causing strv_free to attempt to free a static string. Simplify the whole thing by always keeping the array in valid state.
2014-12-09treewide: sanitize loop_writeZbigniew Jędrzejewski-Szmek
loop_write() didn't follow the usual systemd rules and returned status partially in errno and required extensive checks from callers. Some of the callers dealt with this properly, but many did not, treating partial writes as successful. Simplify things by conforming to usual rules.
2014-12-06remove duplicated includesThomas Hindoe Paaboel Andersen
2014-12-04systemctl: fix a leakThomas Hindoe Paaboel Andersen
2014-12-02systemctl: show unit file preset state in "systemctl status" output"Lennart Poettering
2014-11-30systemctl: remove unused variableThomas Hindoe Paaboel Andersen
2014-11-29systemctl: add edit verbRonny Chevalier
It helps editing units by either creating a drop-in file, like /etc/systemd/system/my.service.d/override.conf, or by copying the original unit from /usr/lib/systemd/ to /etc/systemd/ if the --full option is specified. It invokes an editor on temporary files related to the unit files and if the editor exited successfully, then it renames the temporary files to their original names (e.g. my.service or override.conf) and daemon-reload is invoked. If the temporary file is empty the modification is canceled. See https://bugzilla.redhat.com/show_bug.cgi?id=906824
2014-11-28treewide: another round of simplificationsMichal Schmidt
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: yet more log_*_errno + return simplificationsMichal Schmidt
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.
2014-11-28Revert "systemctl: append default suffix only if none present"Zbigniew Jędrzejewski-Szmek
This reverts a chunk out of commit 5e03c6e3b517286bbd65b48d88f60e5b83721894 which was trying to pass NULL to the the '.service' default. Anyway, it seems better to be explicit.
2014-11-28systemctl: append default suffix only if none presentZbigniew Jędrzejewski-Szmek
Simplify unit_name_mangle() and unit_name_mangle_with_suffix() to always behave the same, and only append a suffix if there is no type suffix. If a user says 'isolate blah.device' it is better to return an error that the type cannot be isolated, than to try to isolate blah.device.target.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
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().
2014-11-22systemctl: show BindsTo/BoundBy in list-dependenciesZbigniew Jędrzejewski-Szmek
Suggested-by: Peter Mattern <matternp@arcor.de> http://lists.freedesktop.org/archives/systemd-devel/2014-November/025437.html
2014-11-10shared/install: when unit contains only Also=, report 'indirect'Jan Synacek
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
2014-11-07copy: teach copy_bytes() sendfile() support, and then replace ↵Lennart Poettering
sendfile_full() by it
2014-11-06systemctl: when invokes as "reboot -f", sync()Lennart Poettering
We do this in the clean shutdown path in shutdown.c, hence we should do is for "reboot -f", too.
2014-11-06core: introduce the concept of AssertXYZ= similar to ConditionXYZ=, but ↵Lennart Poettering
fatal for a start job if not met
2014-10-29systemctl: obey --state in list-unit-filesZbigniew Jędrzejewski-Szmek
2014-10-29systemctl: let list-{units,unit-files } honour --typeZbigniew Jędrzejewski-Szmek
The docs don't clarify what is expected, but I don't see any reason why --type should be ignored. Also restucture the compund conditions into separate clauses for easier reading.
2014-10-17systemctl: by default interactively ask for polkit authorization, if possibleLennart Poettering
Also, allow using --no-ask-password to turn off ineractive polkit authorization.
2014-10-13systemctl: when mangle unit names for the "isolate", suffix with ".target" ↵Lennart Poettering
rather than ".service" by default After all, we set AllowIsolate exclusively for target units so far, and this is more or less the only thing tht makes sense, hence also use ".target" as completion suffix by default.
2014-10-13systemctl: move unit action table closer to the functions that use themLennart Poettering
All other static tables we placed next to the functions that access them, so let's do this for the unit action table too.
2014-10-09systemctl: remove casts in formattingZbigniew Jędrzejewski-Szmek
2014-10-08systemctl: suggest -xe not -xnZbigniew Jędrzejewski-Szmek
https://bugzilla.redhat.com/show_bug.cgi?id=1150289
2014-10-08systemctl: add add-wants and add-requires verbsLukas Nykryn
2014-10-02systemctl: remove spurious newlineLennart Poettering
2014-09-18systemctl: fix resource leak CID #1237747Cristian Rodríguez
..by simply moving the declaration of "unit" into the STRV_FOREACH loop as suggested by Andreas.
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
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.
2014-08-31Quote unit names in suggested systemctl commandlinesZbigniew Jędrzejewski-Szmek
The fact that unit names have to be quoted can be a bit surprising. Show quotes in the hint commandline, but only after checking that this is necessary, since quotes are visually heavy and usually not needed. https://bugs.freedesktop.org/show_bug.cgi?id=82832
2014-08-26systemctl: Correct error message printed when bus_process_wait failsSjoerd Simons
Actually use the variable containing the return code of bus_process_wait when printing the error message as a result of it failing.
2014-08-21systemctl: in list-unit-files, always show legend, even if we know about no ↵Lennart Poettering
unit files
2014-08-20systemctl: fail in the case that no unit files were foundLukas Nykryn
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.
2014-08-13util: allow strappenda to take any number of argsDave Reisner
This makes strappenda3 redundant, so we remove its usage and definition. Add a few tests along the way for sanity.
2014-08-04bus: always explicitly close bus from main programsLennart Poettering
Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC busses anymore when unsent messages remain that keep their reference, when they otherwise are not referenced anymore. This means that if we explicitly want connections to go away, we need to close them. With this change we will no do so explicitly wherver we connect to the bus from a main program (and thus know when the bus connection should go away), or when we create a private bus connection, that really should go away after our use. This fixes connection leaks in the NSS and PAM modules.