core: add IgnoreOnSoftReboot= unit option
As it says on the tin, configures the unit to survive a soft reboot. Currently all the following options have to be set by hand: Conflicts=reboot.target kexec.target poweroff.target halt.target Before=reboot.target kexec.target poweroff.target halt.target After=sysinit.target basic.target DefaultDependencies=no IgnoreOnIsolate=yes This is not very user friendly. If new default dependencies are added, or new shutdown/reboot types, they also have to be added manually. The new option is much simpler, easy to find, and does the right thing by default.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
03d298e1e5
commit
b80fc61e89
+14
-2
@@ -342,12 +342,24 @@ static int path_add_default_dependencies(Path *p) {
|
||||
return r;
|
||||
|
||||
if (MANAGER_IS_SYSTEM(UNIT(p)->manager)) {
|
||||
r = unit_add_two_dependencies_by_name(UNIT(p), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
|
||||
r = unit_add_two_dependencies_by_name(UNIT(p),
|
||||
UNIT_AFTER,
|
||||
UNIT(p)->ignore_on_soft_reboot ? -EINVAL : UNIT_REQUIRES,
|
||||
SPECIAL_SYSINIT_TARGET,
|
||||
true,
|
||||
UNIT_DEPENDENCY_DEFAULT);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return unit_add_two_dependencies_by_name(UNIT(p), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
|
||||
if (!UNIT(p)->ignore_on_soft_reboot)
|
||||
return unit_add_two_dependencies_by_name(
|
||||
UNIT(p),
|
||||
UNIT_BEFORE, UNIT_CONFLICTS,
|
||||
SPECIAL_SHUTDOWN_TARGET, true,
|
||||
UNIT_DEPENDENCY_DEFAULT);
|
||||
|
||||
return unit_add_dependencies_on_real_shutdown_targets(UNIT(p));
|
||||
}
|
||||
|
||||
static int path_add_trigger_dependencies(Path *p) {
|
||||
|
||||
Reference in New Issue
Block a user