summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2016-05-19 16:37:04 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-05-19 10:37:04 -0400
commit823e5fabb783d452607ff8ccaa5235af14eb44eb (patch)
tree9217c6b534468a8a08d9ccbbdf17a7b15c54af6a
parentf3f054f03e6de7865132e9602da178dfc82102ab (diff)
downloadsystemd-823e5fabb783d452607ff8ccaa5235af14eb44eb.tar.gz
systemctl: reload configuration when enabling sysv units too (#3297)
After enabling/disabling a unit, the daemon configuration is expected to be unless '--no-reload' option is passed. However this is not done when enabling a sysv units. This can lead to the following scenario: $ cp /etc/init.d/named /etc/init.d/foo $ systemctl enable foo foo.service is not a native service, redirecting to systemd-sysv-install Executing /usr/lib/systemd/systemd-sysv-install enable foo $ systemctl start foo Failed to start foo.service: Unit foo.service failed to load: No such file or directory. This can also be seen after installing a package providing a sysv service: the service can't be started unless 'daemon-reload' is called manually. This shouldn't be needed and this patch will fix this case too since during package installation, the service is expected to be enabled/disabled.
-rw-r--r--src/systemctl/systemctl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3b4678c119..fe24b936ec 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5478,8 +5478,11 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
return r;
/* If the operation was fully executed by the SysV compat, let's finish early */
- if (strv_isempty(names))
- return 0;
+ if (strv_isempty(names)) {
+ if (arg_no_reload || install_client_side())
+ return 0;
+ return daemon_reload(argc, argv, userdata);
+ }
if (install_client_side()) {
if (streq(verb, "enable")) {