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.
This commit is contained in:
parent
f3f054f03e
commit
823e5fabb7
|
@ -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")) {
|
||||
|
|
Loading…
Reference in New Issue