Commit graph

61 commits

Author SHA1 Message Date
Lennart Poettering cad45ba11e selinux: rework selinux access check logic
a) Instead of parsing the bus messages inside of selinux-access.c
simply pass everything pre-parsed in the functions

b) implement the access checking with a macro that resolves to nothing
on non-selinux builds

c) split out the selinux checks into their own sources
selinux-util.[ch]

d) this unifies the job creation code behind the D-Bus calls
Manager.StartUnit() and Unit.Start().
2012-10-02 17:07:00 -04:00
Lennart Poettering 08ace05beb logs-show: various cleanups
Among other cleanups this introduces a threshold for the size of binary
blobs we serialize as integer arrays in the JSON output. THis can be
disabled via --all.
2012-09-28 00:55:24 +02:00
Zbigniew Jędrzejewski-Szmek 49111a708e systemctl: warn about triggering units only at the end
Instead of checking each unit separately, check once at the end. This
should avoid spurious warnings about a service being triggerable by
other stuff.
2012-09-19 08:27:34 +02:00
Zbigniew Jędrzejewski-Szmek d39b034af6 systemctl: properly report success
Systemctl would always return 1, because it treated uninteresting dbus
messages ("job added") as errors. Just ignore everything apart from
interesting ("job removed") messages.
2012-09-19 08:27:34 +02:00
Zbigniew Jędrzejewski-Szmek 46eddbb597 systemctl: use automatic cleanup once more
Semantics are slightly different, because before unit_name_mangle
returning NULL was ignored, and now it is reported as oom. But
unit_name_mangle only returns NULL on oom.
2012-09-19 08:25:51 +02:00
Zbigniew Jędrzejewski-Szmek d3b52baff9 systemctl: use automatic cleanup
Introduce a helper method to unref dbus messages and use it.
2012-09-19 08:25:36 +02:00
Zbigniew Jędrzejewski-Szmek 67445f4e22 core: move ManagerRunningAs to shared
Note: I did s/MANAGER/SYSTEMD/ everywhere, even though it makes the
patch quite verbose. Nevertheless, keeping MANAGER prefix in some
places, and SYSTEMD prefix in others would just lead to confusion down
the road. Better to rip off the band-aid now.
2012-09-18 19:53:34 +02:00
Lennart Poettering 67f3c40265 systemctl: show unit name when a job fails
https://bugzilla.redhat.com/show_bug.cgi?id=845028
https://bugzilla.redhat.com/show_bug.cgi?id=846483
2012-09-14 15:11:07 +02:00
Lennart Poettering a33fdebb30 systemctl: minor coding style fixes 2012-09-13 22:42:22 +02:00
Václav Pavlín 37370d0cbe install: append .service when enable/disable... is called
https://bugzilla.redhat.com/show_bug.cgi?id=856975
2012-09-13 22:35:18 +02:00
Lennart Poettering bb3241614a systemctl: direct the user to list-unit-files from the list-units output 2012-09-12 08:56:57 +02:00
Lennart Poettering b5b46d5995 when determining unit file list, include invalid unit names in an "invalid" state 2012-09-11 01:14:25 +02:00
Lennart Poettering dcc9ba80e1 systemctl: properly build flags for show_journal_by_unit() 2012-09-05 17:05:04 -07:00
Lennart Poettering 57371e5829 shutdown: remove explicit sync() invocations
The kernel implicitly does sync() anyway, hence there is no need to do
that in userspace explicitly. This makes the "-n" switch to halt(8) a
noop.
2012-09-05 15:32:57 -07:00
Lennart Poettering a6e87e90ed journalctl: rework JSON output mode
This splits the JSON output mode into different modes: json and
json-pretty. The former printing one entry per line, the latter showing
JSON objects nicely indented and in multiple lines to make it easier to
read for humans.
2012-09-05 15:25:32 -07:00
Lukas Nykryn 96342de68d service: add options RestartPreventExitStatus and SuccessExitStatus
In some cases, like wrong configuration, restarting after error
does not help, so administrator can specify statuses by RestartPreventExitStatus
which will not cause restart of a service.

Sometimes you have non-standart exit status, so this can be specified
by SuccessfulExitStatus.
2012-08-14 14:46:03 +02:00
Simon Peeters c516c8d17f systemctl: fix issue with systemctl daemon-reexec 2012-08-10 18:08:22 +02:00
Simon Peeters c67de56f50 move bus_method_call_with_reply() to dbus-common 2012-08-08 02:04:40 +02:00
Simon Peeters f22f08cd5f systemctl: use bus_method_call_with_reply() where posible
use the method introduced by the previous commit
2012-08-08 01:32:30 +02:00
Simon Peeters f3de59c592 systemctl: add bus_method_call_with_reply
this method combines the folowing dbus calls and there error handling:
 dbus_message_new_method_call()
 dbus_message_append_args()
 dbus_connection_send_with_reply_and_block()
2012-08-08 01:29:55 +02:00
Michal Sekletar dfcc5c33f4 shutdown: allow to specify broadcast message when cancelling shutdown
makes shutdown behaviour more compatible
2012-08-06 16:25:55 +02:00
Lennart Poettering 498261871d journalctl: hightlight log lines by priority
warn/notice = bright white
< error = red
2012-07-26 16:56:21 +02:00
Shawn Landden 0d0f0c50d3 log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
2012-07-26 11:48:26 +02:00
Shawn Landden 669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Zbigniew Jędrzejewski-Szmek 81cf1c43c9 systemctl: use color specification understood by dot
grey66 is aproximately equal to dark grey. Not understanding dark grey is really
a bug in dot, but trivial to work around.

Closes https://bugs.freedesktop.org/show_bug.cgi?id=45706
2012-07-23 18:26:31 +02:00
Zbigniew Jędrzejewski-Szmek d91b8841d7 collect, keymap, systemctl: use _noreturn_ 2012-07-22 23:53:48 +02:00
Lennart Poettering c74f17d96c core: drop KillMode parameter from KillUnit() bus call
It made no sense, and since we are documenting the bus calls now and
want to include them in our stability promise we really should get it
cleaned up sooner, not later.
2012-07-20 00:10:32 +02:00
Zbigniew Jędrzejewski-Szmek 085d71209b logs: Adapt interface in log-show.c (show_journal_by_unit)
Convert more flag arguments into one flag variable.
2012-07-17 17:20:58 +02:00
Zbigniew Jędrzejewski-Szmek c147dc42f8 systemctl: filter shown units by their load state
E.g. systemctl --all -t masked gives the list of masked units.

The -t/--type option is reused. This is possible because unit types
and unit load states are called differently, so it is possible to
distinguish what the user meant. Using the same option also means that
the interface is user for the user: less options to remember.
2012-07-10 18:05:47 +02:00
Zbigniew Jędrzejewski-Szmek 6d97280899 systemctl: check the argument to -t for invalid values
Systemctl accepted anything as the argument for -t, and simply said '0
units found'. It is better to catch this user error early.
2012-07-10 17:07:32 +02:00
Auke Kok 8401e9f91d MeeGo: Remove build support for MeeGo distribution.
The MeeGo distribution is still a supported distribution, but
will probably not see an updated version of systemd anymore.

Most of the development is focussing on Tizen now, and the
generic support for building --with-distro=other is more than
adequate enough.

This patch removes the support as a custom configuration build
target in systemd. People who are still building this for
the MeeGo distribution should build as "other" distro.
2012-07-09 16:37:46 +02:00
Lennart Poettering 0315fe3746 systemctl: make sure we print URLs we can't show in systemctl in a nicely clickable way 2012-06-25 22:57:20 +02:00
Lennart Poettering b0193f1c1f systemctl: automatically turn paths and unescaped unit names into proper unit names
This makes sure that

  systemctl status /home

is implicitly translated to:

  systemctl status /home.mount

Similar, /dev/foobar becomes dev-foobar.device.

Also, all characters that cannot be part of a unit name are implicitly
escaped.
2012-06-22 13:08:48 +02:00
Lennart Poettering 089842938d journal: expose and make use of cutoff times of journal
This helps explaining when the log output of "systemctl status" is
incomplete because the logs got rotated since the service was started.
2012-06-17 00:03:12 +02:00
Michal Schmidt 34cdc274ed systemctl: clearer error message for missing install information
Some users found it difficult to understand what systemctl was telling
them.
Instead of "install information" talk about "[Install] section", which
is more likely to ring a bell. And suggest that it is intentional, so
that users do not attempt to "correct" the unit files.

https://bugzilla.redhat.com/show_bug.cgi?id=817033
2012-06-14 23:35:56 +02:00
Michal Schmidt 48899192a7 unit-name: introduce unit_dbus_path_from_name()
Use the same function in core and in systemctl.
get_unit_path() in systemctl becomes unnecessary.
2012-06-13 18:42:02 +02:00
Michal Schmidt 1c291cf34c systemctl: warn about all active triggers, not just sockets 2012-06-13 18:42:02 +02:00
Michal Schmidt 222d0348f9 systemctl: fix iteration in check_listening_sockets() 2012-06-13 18:42:02 +02:00
Michal Schmidt 31be1221a1 systemctl: remove is_socket_listening
We can use the functionality of check_unit(). Factor out
check_one_unit().
2012-06-13 18:42:01 +02:00
Michal Schmidt e61a3135e9 systemctl: style fixes for the previous patch
Use the usual indentation, bracketing style, and no assignments in ifs.
Since check_listening_sockets provides just optional hints for the user,
don't pass its DBusErrors to the caller.
2012-06-13 18:42:01 +02:00
Michal Sekletar 701cdcb9ee systemctl will print warning when stopping unit
systemctl now prints warning and list of sockets in listenning state which can
trigger start of service which is about to be stopped
2012-06-13 18:42:01 +02:00
Kay Sievers b43f208f78 systemctl: rename "man" to "help" 2012-06-04 19:55:38 +02:00
Lennart Poettering 256425cc10 systemctl: introduce "systemctl man" to show man page for unit
For now this only reads man: URLs, but later on we might want to support
info: too. http/https is probably out of focus.
2012-05-31 04:11:57 +02:00
Lennart Poettering ba1261bc02 build-sys: fix built with --disable-logind 2012-05-30 22:25:01 +02:00
Lennart Poettering 07719a21b6 manager: rework generator logic
Previously generated units were always placed at the end of the search
path. With this change there will be three unit dirs instead of one, to
place generated entries at the beginning, in the middle and at the end
of the search path:

beginning: for units that need to override all configuration, regardless
of user or vendor. Example use: system-update-generator uses this to
temporarily redirect default.target.

middle: for units that need to override vendor configuration, but not
vendor configuration. Example use: /etc/fstab should override vendor
supplied configuration (think /tmp), but should not override native user
configuration.

end: does not override anything but is available as well. Possible usage
might be to convert D-Bus bus service files to native units but allowing
vendor supplied native units to win.
2012-05-23 03:43:29 +02:00
Lennart Poettering 1b64d026af units: remove service sysv_path variable and replace it by generic unit_path
UnitPath= is also writable via native units and may be used by generators
to clarify from which file a unit is generated. This patch also hooks up
the cryptsetup and fstab generators to set UnitPath= accordingly.
2012-05-22 23:08:24 +02:00
Nis Martensen 386da8589b delta: fix spelling of overridden 2012-05-21 18:31:43 +02:00
Lennart Poettering 49dbfa7b2b units: introduce new Documentation= field and make use of it everywhere
This should help making the boot process a bit easier to explore and
understand for the administrator. The simple idea is that "systemctl
status" now shows a link to documentation alongside the other status and
decriptionary information of a service.

This patch adds the necessary fields to all our shipped units if we have
proper documentation for them.
2012-05-21 15:14:51 +02:00
Michal Schmidt a223b325b4 systemctl: drop useless DBus calls from 'systemctl show foo.service'
systemctl called LoadUnit, GetUnit, GetAll in this order to get the properties.

It is useless to load units explicitly, because it won't ensure anything. The
unit may be freed immediately by the garbage collector.

It is unnecessary to call GetUnit, because systemctl can easily translate the
unit name to DBus path by itself.

GetAll will load the unit if necessary.
2012-05-21 12:59:00 +02:00
Lennart Poettering 957eb8cab2 systemctl: add switch-root verb 2012-05-14 22:41:30 +02:00