forked from pool/systemd
70c63e98f9
- mark more subpackages as !bootstrap for systemd-mini usage. - spec : remove --with-firmware-path, firmware loader was removed in v217 - spec: remove --disable-multi-seat-x, gone.(fixed in xorg) - spec: Do not enable systemd-readahead-collect.service and systemd-readahead-replay.service as these do not exist anymore. - spec: drop timedate-add-support-for-openSUSE-version-of-etc-sysconfig.patch Yast was fixed to write all timezone changes exactly how timedated expects things to be done. - spec: remove handle-etc-HOSTNAME.patch, since late 2014 the netcfg package handles the migration from /etc/HOSTNAME to /etc/hostname and owns both files. -spec: remove boot.udev and systemd-journald.init as they currently serve no purpose. - suse-sysv-bootd-support.diff: Remove HAVE_SYSVINIT conditions, we are in sysvcompat-only codepath, also remove the code targetting other distributions, never compiled as the TARGET_$DISTRO macros are never defined. - systemd-powerd-initctl-support.patch guard with HAVE_SYSV_COMPAT - set-and-use-default-logconsole.patch: fix HAVE_SYSV_COMPAT guards - insserv-generator.patch: Only build when sysvcompat is enabled - vhangup-on-all-consoles.patch add a comment indicating this is a workaround for a kernel bug. - spec: Add option to allow disabling sysvinit compat at build time. - spec: Add option to enable resolved at build time. - spec: Remove all %ifs for !factory products, current systemd releases can neither be built nor installed in older products without upgrading several components of the base system. (removed: 1008-add-msft-compability-rules.patch was only for =< 13.1) - spec: remove all dummy "aliases" to /etc/init.d, that made sense only when those init scripts still existed. (dummy localfs.service source: gone) OBS-URL: https://build.opensuse.org/request/show/286653 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=215
98 lines
2.8 KiB
Diff
98 lines
2.8 KiB
Diff
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 | 27 ++++++++++++++++++++++-----
|
|
1 file changed, 22 insertions(+), 5 deletions(-)
|
|
|
|
Index: systemd/src/sleep/sleep.c
|
|
===================================================================
|
|
--- systemd.orig/src/sleep/sleep.c
|
|
+++ systemd/src/sleep/sleep.c
|
|
@@ -24,6 +24,7 @@
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <getopt.h>
|
|
+#include <stdlib.h>
|
|
|
|
#include "sd-id128.h"
|
|
#include "sd-messages.h"
|
|
@@ -36,6 +37,8 @@
|
|
#include "def.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;
|
|
@@ -53,10 +56,6 @@ static int write_mode(char **modes) {
|
|
if (r == 0)
|
|
r = k;
|
|
}
|
|
-
|
|
- if (r < 0)
|
|
- log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");
|
|
-
|
|
return r;
|
|
}
|
|
|
|
@@ -97,6 +96,8 @@ static int execute(char **modes, char **
|
|
int r;
|
|
_cleanup_fclose_ FILE *f = NULL;
|
|
|
|
+ if (!delegate_to_pmutils) {
|
|
+
|
|
/* This file is opened first, so that if we hit an error,
|
|
* we can abort before modifying any state. */
|
|
f = fopen("/sys/power/state", "we");
|
|
@@ -107,6 +108,7 @@ static int execute(char **modes, char **
|
|
r = write_mode(modes);
|
|
if (r < 0)
|
|
return r;
|
|
+ }
|
|
|
|
execute_directories(dirs, DEFAULT_TIMEOUT_USEC, arguments);
|
|
|
|
@@ -115,8 +117,10 @@ static int execute(char **modes, char **
|
|
LOG_MESSAGE("Suspending system..."),
|
|
"SLEEP=%s", arg_verb,
|
|
NULL);
|
|
-
|
|
+ if (!delegate_to_pmutils)
|
|
r = write_state(&f, states);
|
|
+ else
|
|
+ r = -system(pmtools);
|
|
if (r < 0)
|
|
return r;
|
|
|
|
@@ -156,6 +160,7 @@ static int parse_argv(int argc, char *ar
|
|
};
|
|
|
|
int c;
|
|
+ struct stat buf;
|
|
|
|
assert(argc >= 0);
|
|
assert(argv);
|
|
@@ -193,6 +198,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 */;
|
|
}
|
|
|