SHA256
1
0
forked from pool/systemd
Dr. Werner Fink 2014-03-25 17:29:50 +00:00 committed by Git OBS Bridge
parent 35f3cd2dab
commit 3556bf6f5f
6 changed files with 172 additions and 0 deletions

View File

@ -0,0 +1,94 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 19 Feb 2013 11:20:31 +0100
Subject: Forward suspend / hibernate calls to pm-utils
forward suspend/hibernation calls to pm-utils, if installed (bnc#790157)
---
src/sleep/sleep.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
--- systemd-206.orig/src/sleep/sleep.c
+++ systemd-206/src/sleep/sleep.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <getopt.h>
+#include <stdlib.h>
#include "systemd/sd-id128.h"
#include "systemd/sd-messages.h"
@@ -35,6 +36,8 @@
#include "sleep-config.h"
static char* arg_verb = NULL;
+static bool delegate_to_pmutils = false;
+static const char *pmtools;
static int write_mode(char **modes) {
int r = 0;
@@ -50,9 +53,6 @@ static int write_mode(char **modes) {
r = k;
}
- if (r < 0)
- log_error("Failed to write mode to /sys/power/disk: %s",
- strerror(-r));
return r;
}
@@ -90,6 +90,8 @@ static int execute(char **modes, char **
FILE *f;
const char* note = strappenda("SLEEP=", arg_verb);
+ if (!delegate_to_pmutils) {
+
/* This file is opened first, so that if we hit an error,
* we can abort before modyfing any state. */
f = fopen("/sys/power/state", "we");
@@ -102,6 +104,7 @@ static int execute(char **modes, char **
r = write_mode(modes);
if (r < 0)
return r;
+ }
arguments[0] = NULL;
arguments[1] = (char*) "pre";
@@ -114,8 +117,10 @@ static int execute(char **modes, char **
"MESSAGE=Suspending system...",
note,
NULL);
-
+ if (!delegate_to_pmutils)
r = write_state(f, states);
+ else
+ r = -system(pmtools);
if (r < 0)
return r;
@@ -158,6 +163,7 @@ static int parse_argv(int argc, char *ar
};
int c;
+ struct stat buf;
assert(argc >= 0);
assert(argv);
@@ -196,6 +202,18 @@ static int parse_argv(int argc, char *ar
return -EINVAL;
}
+ if (streq(arg_verb, "suspend")) {
+ pmtools = "/usr/sbin/pm-suspend";
+ }
+ else if (streq(arg_verb, "hibernate") || streq(arg_verb, "hybrid-sleep")) {
+ if (streq(arg_verb, "hibernate"))
+ pmtools = "/usr/sbin/pm-hibernate";
+ else
+ pmtools = "/usr/sbin/pm-suspend-hybrid";
+ }
+
+ delegate_to_pmutils = (stat(pmtools, &buf) >= 0 && S_ISREG(buf.st_mode) && (buf.st_mode & 0111));
+
return 1 /* work to do */;
}

View File

@ -0,0 +1,23 @@
Found this during debugging an other problem. The issue was that
after ``sudo -i'' and a ``cd /usr/lib/systemd/system/'' followed
later by a shutdown may fail with (journalctl -b -1):
systemd-exit.service: Failed at step CHDIR spawning: /usr/bin/kill
which then caused the subsequent fault that umounting the users
home directories done by automount are busy.
--- systemd-210/units/user/systemd-exit.service.in
+++ systemd-210/units/user/systemd-exit.service.in 2014-03-25 16:59:20.406235916 +0000
@@ -10,8 +10,9 @@ Description=Exit the Session
Documentation=man:systemd.special(7)
DefaultDependencies=no
Requires=shutdown.target
-After=shutdown.target
+After=shutdown.target multi-user.target
[Service]
Type=oneshot
-ExecStart=@KILL@ -s 58 $MANAGERPID
+WorkingDirectory=/
+ExecStart=@KILL@ -s SIGRTMIN+24 $MANAGERPID

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Tue Mar 25 17:28:18 UTC 2014 - werner@suse.de
- Readd patch Forward-suspend-hibernate-calls-to-pm-utils.patch
older code base as 13.1 only
- Add patch avoid-random-hangs-on-timeouts-due-lost-cwd.patch
to be able to terminate the user manager even if cwd of the
user is gone
-------------------------------------------------------------------
Tue Mar 25 13:08:56 UTC 2014 - thomas.blume@suse.com
- add prepare-suspend-to-disk.patch
enable suspend conditions check and preparation for systemd-sleep
(fate#316824, bnc#856389, bnc#856392)
- remove Forward-suspend-hibernate-calls-to-pm-utils.patch since it is obsolete
(bnc#856392#c20)
- add boot-local-start.patch
fix startup for /etc/init.d/boot.local (bnc#869142)
-------------------------------------------------------------------
Mon Mar 24 11:19:38 UTC 2014 - coolo@suse.com

View File

@ -150,6 +150,7 @@ Source1060: boot.udev
Source1061: write_dev_root_rule
Source1062: systemd-udev-root-symlink
Source1063: udev-generate-peristent-rule.sh
Source1064: systemd-sleep-grub
#
# PATCH-FIX-UPSTREAM avoid-assertion-if-invalid-address-familily-is-passed-to-g.patch lnussel@suse.com bnc#791101 -- avoid assertion if invalid address familily is passed to gethostbyaddr_r
@ -202,6 +203,8 @@ Patch42: systemd-pam_config.patch
Patch23: disable-nss-myhostname-warning-bnc-783841.patch
# PATCH-FIX-OPENSUSE handle-HOSTNAME.patch fcrozat@suse.com -- handle /etc/HOSTNAME (bnc#803653)
Patch24: handle-etc-HOSTNAME.patch
# PATCH-FIX-OPENSUSE forward to pm-utils -- for code base <= 1310
Patch25: Forward-suspend-hibernate-calls-to-pm-utils.patch
# PATCH-FIX-UPSTREAM rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch rjschwei@suse.com -- add lid switch of ARM based Chromebook as a power switch to logind
Patch38: rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch
# PATCH-FIX-OPENSUSE use-usr-sbin-sulogin-for-emergency-service.patch arvidjaar@gmail.com -- fix path to sulogin
@ -328,6 +331,13 @@ Patch1022: 1022-systemd-tmpfiles-ownerkeep.patch
Patch1023: systemd-powerd-initctl-support.patch
# PATCH-FIX-SUSE systemctl-set-default-target.patch
Patch1024: systemctl-set-default-target.patch
# PATCH-FIX-SUSE prepare-suspend-to-disk.patch (fate #316824)
Patch1025: prepare-suspend-to-disk.patch
# PATCH-FIX-SUSE boot-local-start.patch (bnc #869142)
Patch1026: boot-local-start.patch
# PATCH-FIX-SUSE avoid random hangs on timeouts due lost cwd at terminating user manager
Patch1027: avoid-random-hangs-on-timeouts-due-lost-cwd.patch
# PATCH-FIX-SUSE systemd-install-compat_pkgconfig-always.patch
Patch1999: systemd-install-compat_pkgconfig-always.patch
# PATCH-FIX-OPENSUSE systemd-dbus-system-bus-address.patch always use /run/dbus not /var/run
@ -584,6 +594,9 @@ cp %{SOURCE7} m4/
%patch22 -p1
%patch23 -p1
%patch24 -p1
%if 0%{?suse_version} <= 1310
%patch25 -p1
%endif
# check if this is still needed, or can be derived from fbdev uaccess rule
# http://lists.freedesktop.org/archives/systemd-devel/2012-November/007561.html
%patch27 -p1
@ -659,6 +672,9 @@ cp %{SOURCE7} m4/
%patch1022 -p1
%patch1023 -p1
%patch1024 -p1
%patch1025 -p1
%patch1026 -p1
%patch1027 -p1
%patch1999 -p1
%patch2000 -p1
%patch2001 -p1
@ -773,6 +789,7 @@ install -m755 -D %{S:1061} %{buildroot}/%{_prefix}/lib/udev/write_dev_root_rule
sed -ie "s|@@PREFIX@@|%{_prefix}/lib/udev|g" %{S:1062}
install -m644 -D %{S:1062} %{buildroot}/%{_prefix}/lib/systemd/system/systemd-udev-root-symlink.service
install -m755 -D %{S:1063} %{buildroot}/%{_prefix}/lib/udev/udev-generate-peristent-rule
install -m755 -D %{S:1064} %{buildroot}/%{_bindir}/systemd-sleep-grub
mkdir -p %{buildroot}/%{_prefix}/lib/systemd/system/basic.target.wants
ln -sf ../systemd-udev-root-symlink.service %{buildroot}/%{_prefix}/lib/systemd/system/basic.target.wants
rm -rf %{buildroot}%{_sysconfdir}/rpm
@ -1109,6 +1126,7 @@ exit 0
/bin/systemd
/bin/systemd-ask-password
/bin/systemctl
%{_bindir}/systemd-sleep-grub
%{_bindir}/bootctl
%{_bindir}/busctl
%{_bindir}/kernel-install

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Mar 25 17:28:18 UTC 2014 - werner@suse.de
- Readd patch Forward-suspend-hibernate-calls-to-pm-utils.patch
older code base as 13.1 only
- Add patch avoid-random-hangs-on-timeouts-due-lost-cwd.patch
to be able to terminate the user manager even if cwd of the
user is gone
-------------------------------------------------------------------
Tue Mar 25 13:08:56 UTC 2014 - thomas.blume@suse.com

View File

@ -198,6 +198,8 @@ Patch42: systemd-pam_config.patch
Patch23: disable-nss-myhostname-warning-bnc-783841.patch
# PATCH-FIX-OPENSUSE handle-HOSTNAME.patch fcrozat@suse.com -- handle /etc/HOSTNAME (bnc#803653)
Patch24: handle-etc-HOSTNAME.patch
# PATCH-FIX-OPENSUSE forward to pm-utils -- for code base <= 1310
Patch25: Forward-suspend-hibernate-calls-to-pm-utils.patch
# PATCH-FIX-UPSTREAM rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch rjschwei@suse.com -- add lid switch of ARM based Chromebook as a power switch to logind
Patch38: rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch
# PATCH-FIX-OPENSUSE use-usr-sbin-sulogin-for-emergency-service.patch arvidjaar@gmail.com -- fix path to sulogin
@ -328,6 +330,8 @@ Patch1024: systemctl-set-default-target.patch
Patch1025: prepare-suspend-to-disk.patch
# PATCH-FIX-SUSE boot-local-start.patch (bnc #869142)
Patch1026: boot-local-start.patch
# PATCH-FIX-SUSE avoid random hangs on timeouts due lost cwd at terminating user manager
Patch1027: avoid-random-hangs-on-timeouts-due-lost-cwd.patch
# PATCH-FIX-SUSE systemd-install-compat_pkgconfig-always.patch
Patch1999: systemd-install-compat_pkgconfig-always.patch
@ -585,6 +589,9 @@ cp %{SOURCE7} m4/
%patch22 -p1
%patch23 -p1
%patch24 -p1
%if 0%{?suse_version} <= 1310
%patch25 -p1
%endif
# check if this is still needed, or can be derived from fbdev uaccess rule
# http://lists.freedesktop.org/archives/systemd-devel/2012-November/007561.html
%patch27 -p1
@ -662,6 +669,7 @@ cp %{SOURCE7} m4/
%patch1024 -p1
%patch1025 -p1
%patch1026 -p1
%patch1027 -p1
%patch1999 -p1
%patch2000 -p1
%patch2001 -p1