summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>2017-08-30 17:20:23 +0100
committerLennart Poettering <lennart@poettering.net>2017-08-30 18:20:23 +0200
commit64a36ae4b1dd23474dd7ea261381ac437b24fac2 (patch)
tree0830a9ac744f54e417c37d546984aabcaf8dbef7
parent3f1a3d4ac57867dc9ac0e98028c4b6f0fa93ad60 (diff)
downloadsystemd-64a36ae4b1dd23474dd7ea261381ac437b24fac2.tar.gz
systemd-64a36ae4b1dd23474dd7ea261381ac437b24fac2.tar.bz2
systemd-64a36ae4b1dd23474dd7ea261381ac437b24fac2.zip
units: starting suspend.target should not fail when suspend is successful (#6678)
and the same for hibernate.target and hybrid-sleep.target. Tested with both sucessful and unsuccessful suspends. The result of the start job was correct in both cases. Closes #6419 (a regression in v233 and v234). > suspend is unsual for a target, because it has to stop itself once it's > started. Otherwise you couldn't start it again, so you could only suspend > once! Currently that's implemented using BindsTo=systemd-sleep.service. > Meaning it pulls in systemd-sleep.service to do the actual suspend, and > then de-activates afterwards. But the behaviour of BindsTo was changed > recently (not without some issues during development) - maybe this bug > is caused by poettering/systemd@631b676 which I think was added in > release v233. > > sleep.target (see man systemd.special) has the same need, but it > implements it differently. It simply has StopWhenUnneeded=yes. This commit switches suspend.target etc. to the approach used by sleep.target.
-rw-r--r--units/hibernate.target3
-rw-r--r--units/hybrid-sleep.target3
-rw-r--r--units/suspend.target3
3 files changed, 6 insertions, 3 deletions
diff --git a/units/hibernate.target b/units/hibernate.target
index 143eb59230..0e1bc03258 100644
--- a/units/hibernate.target
+++ b/units/hibernate.target
@@ -9,5 +9,6 @@
Description=Hibernate
Documentation=man:systemd.special(7)
DefaultDependencies=no
-BindsTo=systemd-hibernate.service
+Requires=systemd-hibernate.service
After=systemd-hibernate.service
+StopWhenUnneeded=yes
diff --git a/units/hybrid-sleep.target b/units/hybrid-sleep.target
index d2d3409225..410e131b6e 100644
--- a/units/hybrid-sleep.target
+++ b/units/hybrid-sleep.target
@@ -9,5 +9,6 @@
Description=Hybrid Suspend+Hibernate
Documentation=man:systemd.special(7)
DefaultDependencies=no
-BindsTo=systemd-hybrid-sleep.service
+Requires=systemd-hybrid-sleep.service
After=systemd-hybrid-sleep.service
+StopWhenUnneeded=yes
diff --git a/units/suspend.target b/units/suspend.target
index f50cb2264f..80d652755c 100644
--- a/units/suspend.target
+++ b/units/suspend.target
@@ -9,5 +9,6 @@
Description=Suspend
Documentation=man:systemd.special(7)
DefaultDependencies=no
-BindsTo=systemd-suspend.service
+Requires=systemd-suspend.service
After=systemd-suspend.service
+StopWhenUnneeded=yes