forked from pool/systemd
.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=553
This commit is contained in:
parent
06eb8a9cf3
commit
03f3ab857c
@ -1,28 +1,44 @@
|
||||
From 5cf46aa4339670afac386b1b0e630b739f3621c7 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Milasan <rmilasan@suse.com>
|
||||
Date: Thu, 12 Jul 2012 15:56:34 +0000
|
||||
Subject: re-enable by_path links for ata devices
|
||||
Subject: [PATCH] Persistent by_path links for ata devices
|
||||
|
||||
Fix by-path links for ATA transport (bnc#770910)
|
||||
With newer kernel we have the 'port_no' attribute,
|
||||
which allows us to construct a valid ata by-path link.
|
||||
|
||||
With this patch ATA links of the form
|
||||
|
||||
ata-<port>.[01]
|
||||
|
||||
(for master/slave devices) or
|
||||
|
||||
ata-<port>.<pmp>.0
|
||||
|
||||
(for devices behind port multipliers)
|
||||
are generated.
|
||||
|
||||
References: bnc#770910,FATE#317063
|
||||
|
||||
Signed-off-by: Robert Milasan <rmilasan@suse.com>
|
||||
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
||||
---
|
||||
src/udev/udev-builtin-path_id.c | 92 +++++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 80 insertions(+), 12 deletions(-)
|
||||
src/udev/udev-builtin-path_id.c | 53 +++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 41 insertions(+), 12 deletions(-)
|
||||
|
||||
--- systemd-206.orig/src/udev/udev-builtin-path_id.c
|
||||
+++ systemd-206/src/udev/udev-builtin-path_id.c
|
||||
@@ -338,6 +338,85 @@ static struct udev_device *handle_scsi_h
|
||||
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
|
||||
index 0599980..fbd3fda 100644
|
||||
--- a/src/udev/udev-builtin-path_id.c
|
||||
+++ b/src/udev/udev-builtin-path_id.c
|
||||
@@ -339,6 +339,46 @@ static struct udev_device *handle_scsi_hyperv(struct udev_device *parent, char *
|
||||
return parent;
|
||||
}
|
||||
|
||||
+static struct udev_device *handle_ata(struct udev_device *parent, char **path)
|
||||
+{
|
||||
+ struct udev_device *hostdev;
|
||||
+ int host, bus, target, lun;
|
||||
+ const char *name;
|
||||
+ char *base;
|
||||
+ char *pos;
|
||||
+ DIR *dir;
|
||||
+ struct dirent *dent;
|
||||
+ int basenum, len;
|
||||
+ struct udev *udev = udev_device_get_udev(parent);
|
||||
+ struct udev_device *hostdev, *portdev;
|
||||
+ int host, bus, target, lun, port_no;
|
||||
+ const char *name, *atahost, *port;
|
||||
+
|
||||
+ hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host");
|
||||
+ if (hostdev == NULL)
|
||||
@ -32,70 +48,35 @@ Fix by-path links for ATA transport (bnc#770910)
|
||||
+ if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4)
|
||||
+ return NULL;
|
||||
+
|
||||
+ /* rebase ata offset to get the local relative number */
|
||||
+ basenum = -1;
|
||||
+ base = strdup(udev_device_get_syspath(hostdev));
|
||||
+ if (base == NULL)
|
||||
+ /* The ata port is the parent of the SCSI host */
|
||||
+ hostdev = udev_device_get_parent(hostdev);
|
||||
+ atahost = udev_device_get_sysname(hostdev);
|
||||
+ if (strncmp(atahost, "ata", 3))
|
||||
+ return NULL;
|
||||
+ pos = strrchr(base, '/');
|
||||
+ if (pos == NULL) {
|
||||
+ parent = NULL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ pos[0] = '\0';
|
||||
+ len = strlen(base) - 5;
|
||||
+ if (len <= 0) {
|
||||
+ parent = NULL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ base[len] = '\0';
|
||||
+ dir = opendir(base);
|
||||
+ if (dir == NULL) {
|
||||
+ parent = NULL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
|
||||
+ char *rest;
|
||||
+ int i;
|
||||
+
|
||||
+ if (dent->d_name[0] == '.')
|
||||
+ continue;
|
||||
+ if (dent->d_type != DT_DIR && dent->d_type != DT_LNK)
|
||||
+ continue;
|
||||
+ if (strncmp(dent->d_name, "ata", 3) != 0)
|
||||
+ continue;
|
||||
+ i = strtoul(&dent->d_name[3], &rest, 10);
|
||||
+
|
||||
+ /* ata devices start with 1, so decrease by 1 if i is bigger then 0 */
|
||||
+ if (i > 0)
|
||||
+ i--;
|
||||
+ if (rest[0] != '\0')
|
||||
+ continue;
|
||||
+ /*
|
||||
+ * find the smallest number; the host really needs to export its
|
||||
+ * own instance number per parent device; relying on the global host
|
||||
+ * enumeration and plainly rebasing the numbers sounds unreliable
|
||||
+ */
|
||||
+ if (basenum == -1 || i < basenum)
|
||||
+ basenum = i;
|
||||
+ }
|
||||
+ closedir(dir);
|
||||
+ if (basenum == -1) {
|
||||
+ parent = NULL;
|
||||
+ /* ATA port number is found in 'port_no' attribute */
|
||||
+ portdev = udev_device_new_from_subsystem_sysname(udev, "ata_port",
|
||||
+ atahost);
|
||||
+ port = udev_device_get_sysattr_value(portdev, "port_no");
|
||||
+ if (!port || sscanf(port, "%d", &port_no) != 1) {
|
||||
+ hostdev = NULL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ host -= basenum;
|
||||
+
|
||||
+ path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun);
|
||||
+ if (bus != 0)
|
||||
+ /* Devices behind port multiplier have a bus != 0*/
|
||||
+ path_prepend(path, "ata-%u.%u.0", port_no, bus);
|
||||
+ else
|
||||
+ /* Master/slave are distinguished by target id */
|
||||
+ path_prepend(path, "ata-%u.%u", port_no, target);
|
||||
+out:
|
||||
+ free(base);
|
||||
+ udev_device_unref(portdev);
|
||||
+ return hostdev;
|
||||
+}
|
||||
+
|
||||
static struct udev_device *handle_scsi(struct udev_device *parent, char **path)
|
||||
{
|
||||
const char *devtype;
|
||||
@@ -374,19 +453,8 @@ static struct udev_device *handle_scsi(s
|
||||
@@ -375,19 +415,8 @@ static struct udev_device *handle_scsi(struct udev_device *parent, char **path)
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -116,3 +97,6 @@ Fix by-path links for ATA transport (bnc#770910)
|
||||
goto out;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.1.4
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
--- systemd-206.orig/Makefile.am
|
||||
+++ systemd-206/Makefile.am
|
||||
@@ -2484,6 +2484,10 @@ dist_udevrules_DATA += \
|
||||
rules/80-hotplug-cpu-mem.rules
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
+dist_udevrules_DATA += \
|
||||
+ rules/61-msft.rules
|
||||
+
|
||||
+# ------------------------------------------------------------------------------
|
||||
if ENABLE_GUDEV
|
||||
if ENABLE_GTK_DOC
|
||||
SUBDIRS += \
|
||||
--- /dev/null
|
||||
+++ systemd-206/rules/61-msft.rules
|
||||
@@ -0,0 +1,9 @@
|
||||
+# MSFT compability rules
|
||||
+ACTION!="add|change", GOTO="msft_end"
|
||||
+
|
||||
+ENV{DEVTYPE}=="partition", IMPORT{parent}="SCSI_IDENT_*"
|
||||
+KERNEL=="sd*[!0-9]|sr*", ENV{SCSI_IDENT_LUN_T10}!="?*", IMPORT{program}="/usr/bin/sg_inq -p di --export $tempnode"
|
||||
+KERNEL=="sd*|sr*", ENV{DEVTYPE}=="disk", ENV{SCSI_IDENT_LUN_T10}=="?*", SYMLINK+="disk/by-id/scsi-1$env{SCSI_IDENT_LUN_T10}"
|
||||
+KERNEL=="sd*", ENV{DEVTYPE}=="partition", ENV{SCSI_IDENT_LUN_T10}=="?*", SYMLINK+="disk/by-id/scsi-1$env{SCSI_IDENT_LUN_T10}-part%n"
|
||||
+
|
||||
+LABEL="msft_end"
|
@ -1,90 +0,0 @@
|
||||
--- systemd-208/units/sigpwr.target
|
||||
+++ systemd-208/units/sigpwr.target 2014-01-14 15:53:32.878735762 +0000
|
||||
@@ -8,3 +8,5 @@
|
||||
[Unit]
|
||||
Description=Power Failure
|
||||
Documentation=man:systemd.special(7)
|
||||
+BindsTo=powerfail.service
|
||||
+DefaultDependencies=no
|
||||
+RefuseManualStart=yes
|
||||
--- systemd-208/units/powerfail.service
|
||||
+++ systemd-208/units/powerfail.service 2014-01-14 16:11:41.802235712 +0000
|
||||
@@ -0,0 +1,21 @@
|
||||
+# This file is part of systemd.
|
||||
+#
|
||||
+# Copyright (c) 2014 SUSE LINUX Products GmbH, Germany.
|
||||
+# Author: Werner Fink
|
||||
+# Please send feedback to http://www.suse.de/feedback
|
||||
+#
|
||||
+# Description:
|
||||
+#
|
||||
+# Used to start the systemd-powerfail.service
|
||||
+#
|
||||
+
|
||||
+[Unit]
|
||||
+Description=powerfail handling
|
||||
+BindsTo=sigpwr.target
|
||||
+DefaultDependencies=no
|
||||
+RefuseManualStart=yes
|
||||
+
|
||||
+[Service]
|
||||
+Type=oneshot
|
||||
+ExecStart=/usr/lib/systemd/systemd-powerfail
|
||||
+RemainAfterExit=false
|
||||
--- systemd-208/man/systemd-powerfail.service.8
|
||||
+++ systemd-208/man/systemd-powerfail.service.8 2014-01-14 18:22:21.286735810 +0000
|
||||
@@ -0,0 +1,54 @@
|
||||
+'\" t
|
||||
+.TH "SYSTEMD\-POWERFAIL\&.SERVICE" "8" "" "systemd 208" "systemd-powerfail.service"
|
||||
+.\" -----------------------------------------------------------------
|
||||
+.\" * Define some portability stuff
|
||||
+.\" -----------------------------------------------------------------
|
||||
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
+.\" http://bugs.debian.org/507673
|
||||
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
||||
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
+.ie \n(.g .ds Aq \(aq
|
||||
+.el .ds Aq '
|
||||
+.\" -----------------------------------------------------------------
|
||||
+.\" * set default formatting
|
||||
+.\" -----------------------------------------------------------------
|
||||
+.\" disable hyphenation
|
||||
+.nh
|
||||
+.\" disable justification (adjust text to left margin only)
|
||||
+.ad l
|
||||
+.\" -----------------------------------------------------------------
|
||||
+.\" * MAIN CONTENT STARTS HERE *
|
||||
+.\" -----------------------------------------------------------------
|
||||
+.SH "NAME"
|
||||
+systemd-powerfail.service, systemd-powerfail \- Power Fail signal handling
|
||||
+.SH "SYNOPSIS"
|
||||
+.PP
|
||||
+systemd\-powerfail\&.service
|
||||
+.PP
|
||||
+/usr/lib/systemd/systemd\-powerfail
|
||||
+.SH "DESCRIPTION"
|
||||
+.PP
|
||||
+systemd\-powerfail
|
||||
+is a system service that is used to evaulate the content of
|
||||
+\fI/var/run/powerstatus\fR. Based on the content of this
|
||||
+file:
|
||||
+.IP F(AIL)
|
||||
+Power is failing, UPS is providing the power. The
|
||||
+systemd\-powerfail
|
||||
+is now doing a timed shutdown.
|
||||
+.IP O(K)
|
||||
+The power has been restored, and pending shutdown
|
||||
+will be cancled.
|
||||
+.IP L(OW)
|
||||
+The power is failing and the UPS has a low battery.
|
||||
+The
|
||||
+systemd\-powerfail
|
||||
+is doing an immediate shutdown.
|
||||
+.PP
|
||||
+If \fI/var/run/powerstatus\fR doesn't exist or contains anything else then the letters
|
||||
+F, O or L, systemd\-powerfail will behave as if it has read the letter F.
|
||||
+.PP
|
||||
+.SH "SEE ALSO"
|
||||
+.PP
|
||||
+\fBshutdown\fR(8),
|
||||
+\fBpowerd\fR(8)
|
@ -62,6 +62,17 @@ Fri Mar 7 08:00:31 UTC 2014 - werner@suse.de
|
||||
- Add linker scripts as place holder of the old systemd shared
|
||||
libraries now all included in libsystemd.so (bnc#867128)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 7 14:50:39 CET 2014 - hare@suse.de
|
||||
|
||||
- Integrate powerd handling in initctl service
|
||||
+ Remove 1016-support-powerfail-with-powerstatus.patch
|
||||
+ Remove systemd-powerfail
|
||||
+ Add systemd-powerd-initctl-support.patch
|
||||
- Remove 61-msft.rules; superseded by sg3_utils (bnc#866933)
|
||||
- Persistent by-path links for ATA devices (FATE#317063)
|
||||
+ Update 1001-re-enable-by_path-links-for-ata-devices.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 4 10:37:02 UTC 2014 - werner@suse.de
|
||||
|
||||
|
@ -142,7 +142,6 @@ Source8: systemd-journald.init
|
||||
Source9: nss-myhostname-config
|
||||
Source10: macros.systemd.upstream
|
||||
Source11: after-local.service
|
||||
Source12: systemd-powerfail
|
||||
|
||||
Source1060: boot.udev
|
||||
Source1061: write_dev_root_rule
|
||||
@ -296,8 +295,6 @@ Patch1010: 1010-do-not-install-sulogin-unit-with-poweroff.patch
|
||||
Patch1012: 0001-pam_systemd_do_override_XDG_RUNTIME_DIR_of_the_original_user.patch
|
||||
# PATCH-FIX-OPENSUSE 1014-journald-with-journaling-FS.patch
|
||||
Patch1014: 1014-journald-with-journaling-FS.patch
|
||||
# PATCH-FIX-SUSE 1016-support-powerfail-with-powerstatus.patch
|
||||
Patch1016: 1016-support-powerfail-with-powerstatus.patch
|
||||
# PATCH-FIX-SUSE 1018-Make-LSB-Skripts-know-about-Required-and-Should.patch
|
||||
Patch1018: 1018-Make-LSB-Skripts-know-about-Required-and-Should.patch
|
||||
# PATCH-FIX-SUSE 1019-make-completion-smart-to-be-able-to-redirect.patch
|
||||
@ -306,6 +303,8 @@ Patch1019: 1019-make-completion-smart-to-be-able-to-redirect.patch
|
||||
Patch1020: 0001-add-network-device-after-NFS-mount-units.patch
|
||||
# PATCH-FIX-SUSE 1022-systemd-tmpfiles-ownerkeep.patch
|
||||
Patch1022: 1022-systemd-tmpfiles-ownerkeep.patch
|
||||
# PATCH-FIX-SUSE systemd-powerd-initctl-support.patch
|
||||
Patch1023: systemd-powerd-initctl-support.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
|
||||
@ -329,8 +328,6 @@ Patch1005: 1005-create-default-links-for-primary-cd_dvd-drive.patch
|
||||
Patch1006: 1006-udev-always-rename-network.patch
|
||||
# PATCH-FIX-OPENSUSE 1007-physical-hotplug-cpu-and-memory.patch
|
||||
Patch1007: 1007-physical-hotplug-cpu-and-memory.patch
|
||||
# PATCH-FIX-OPENSUSE 1008-add-msft-compability-rules.patch
|
||||
Patch1008: 1008-add-msft-compability-rules.patch
|
||||
|
||||
%description
|
||||
Systemd is a system and service manager, compatible with SysV and LSB
|
||||
@ -626,11 +623,11 @@ cp %{SOURCE7} m4/
|
||||
%patch1010 -p1
|
||||
%patch1012 -p1
|
||||
%patch1014 -p1
|
||||
%patch1016 -p1
|
||||
%patch1018 -p1
|
||||
%patch1019 -p1
|
||||
%patch1020 -p1
|
||||
%patch1022 -p1
|
||||
%patch1023 -p1
|
||||
%patch1999 -p1
|
||||
%patch2000 -p1
|
||||
%patch2001 -p1
|
||||
@ -645,7 +642,6 @@ cp %{SOURCE7} m4/
|
||||
# don't apply when bootstrapping to not modify Makefile.am
|
||||
%if ! 0%{?bootstrap}
|
||||
%patch1007 -p1
|
||||
%patch1008 -p1
|
||||
%endif
|
||||
|
||||
# ensure generate files are removed
|
||||
@ -840,11 +836,7 @@ EOF
|
||||
install -m 644 %{S:11} %{buildroot}/%{_prefix}/lib/systemd/system/
|
||||
ln -s ../after-local.service %{buildroot}/%{_prefix}/lib/systemd/system/multi-user.target.wants/
|
||||
|
||||
# support for SIGPWR handling with /var/run/powerstatus of e.g. powerd
|
||||
install -m 755 %{S:12} %{buildroot}/%{_prefix}/lib/systemd/
|
||||
install -m 644 units/powerfail.service %{buildroot}/%{_prefix}/lib/systemd/system/
|
||||
%if ! 0%{?bootstrap}
|
||||
install -m 644 man/systemd-powerfail.service.8 %{buildroot}/%{_mandir}/man8/
|
||||
%if %{without python}
|
||||
for man in systemd.directives.7 systemd.index.7
|
||||
do
|
||||
|
125
systemd-powerd-initctl-support.patch
Normal file
125
systemd-powerd-initctl-support.patch
Normal file
@ -0,0 +1,125 @@
|
||||
From 7b8b1ca177a532a6673e5795af867b3631622391 Mon Sep 17 00:00:00 2001
|
||||
From: Hannes Reinecke <hare@suse.de>
|
||||
Date: Fri, 7 Mar 2014 14:04:58 +0100
|
||||
Subject: [PATCH] systemd: powerd initctl support
|
||||
|
||||
Old versions of powerd will be using the initctl fifo to signal
|
||||
state changes. To maintain backward compability systemd should
|
||||
be interpreting these messages, too.
|
||||
|
||||
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
||||
---
|
||||
src/initctl/initctl.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 70 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
|
||||
index 468df35..d4794a6 100644
|
||||
--- a/src/initctl/initctl.c
|
||||
+++ b/src/initctl/initctl.c
|
||||
@@ -32,8 +32,11 @@
|
||||
#include <sys/un.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
+#include <sys/reboot.h>
|
||||
+#include <linux/reboot.h>
|
||||
|
||||
#include "sd-daemon.h"
|
||||
+#include "sd-shutdown.h"
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "util.h"
|
||||
@@ -44,6 +47,7 @@
|
||||
#include "bus-util.h"
|
||||
#include "bus-error.h"
|
||||
#include "def.h"
|
||||
+#include "socket-util.h"
|
||||
|
||||
#define SERVER_FD_MAX 16
|
||||
#define TIMEOUT_MSEC ((int) (DEFAULT_EXIT_USEC/USEC_PER_MSEC))
|
||||
@@ -141,7 +145,53 @@ static void change_runlevel(Server *s, int runlevel) {
|
||||
}
|
||||
}
|
||||
|
||||
+static int send_shutdownd(unsigned delay, char mode, const char *message) {
|
||||
+ usec_t t = now(CLOCK_REALTIME) + delay * USEC_PER_MINUTE;
|
||||
+ struct sd_shutdown_command c = {
|
||||
+ .usec = t,
|
||||
+ .mode = mode,
|
||||
+ .dry_run = false,
|
||||
+ .warn_wall = true,
|
||||
+ };
|
||||
+
|
||||
+ union sockaddr_union sockaddr = {
|
||||
+ .un.sun_family = AF_UNIX,
|
||||
+ .un.sun_path = "/run/systemd/shutdownd",
|
||||
+ };
|
||||
+
|
||||
+ struct iovec iovec[2] = {{
|
||||
+ .iov_base = (char*) &c,
|
||||
+ .iov_len = offsetof(struct sd_shutdown_command, wall_message),
|
||||
+ }};
|
||||
+
|
||||
+ struct msghdr msghdr = {
|
||||
+ .msg_name = &sockaddr,
|
||||
+ .msg_namelen = offsetof(struct sockaddr_un, sun_path)
|
||||
+ + sizeof("/run/systemd/shutdownd") - 1,
|
||||
+ .msg_iov = iovec,
|
||||
+ .msg_iovlen = 1,
|
||||
+ };
|
||||
+
|
||||
+ _cleanup_close_ int fd;
|
||||
+
|
||||
+ fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
|
||||
+ if (fd < 0)
|
||||
+ return -errno;
|
||||
+
|
||||
+ if (!isempty(message)) {
|
||||
+ iovec[1].iov_base = (char*) message;
|
||||
+ iovec[1].iov_len = strlen(message);
|
||||
+ msghdr.msg_iovlen++;
|
||||
+ }
|
||||
+
|
||||
+ if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0)
|
||||
+ return -errno;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void request_process(Server *s, const struct init_request *req) {
|
||||
+ int r;
|
||||
assert(s);
|
||||
assert(req);
|
||||
|
||||
@@ -184,9 +234,28 @@ static void request_process(Server *s, const struct init_request *req) {
|
||||
return;
|
||||
|
||||
case INIT_CMD_POWERFAIL:
|
||||
+ r = send_shutdownd(2, SD_SHUTDOWN_POWEROFF,
|
||||
+ "THE POWER IS FAILED! SYSTEM GOING DOWN! PLEASE LOG OFF NOW!");
|
||||
+ if (r < 0) {
|
||||
+ log_warning("Failed to talk to shutdownd, shutdown cancelled: %s", strerror(-r));
|
||||
+ }
|
||||
+ return;
|
||||
case INIT_CMD_POWERFAILNOW:
|
||||
+ r = send_shutdownd(0, SD_SHUTDOWN_POWEROFF,
|
||||
+ "THE POWER IS FAILED! LOW BATTERY - EMERGENCY SYSTEM SHUTDOWN!");
|
||||
+ if (r < 0) {
|
||||
+ log_warning("Failed to talk to shutdownd, proceeding with immediate shutdown: %s", strerror(-r));
|
||||
+ reboot(RB_ENABLE_CAD);
|
||||
+ reboot(RB_POWER_OFF);
|
||||
+ }
|
||||
+ return;
|
||||
+
|
||||
case INIT_CMD_POWEROK:
|
||||
- log_warning("Received UPS/power initctl request. This is not implemented in systemd. Upgrade your UPS daemon!");
|
||||
+ r = send_shutdownd(0, SD_SHUTDOWN_NONE,
|
||||
+ "THE POWER IS BACK");
|
||||
+ if (r < 0) {
|
||||
+ log_warning("Failed to talk to shutdownd, proceeding with shutdown: %s", strerror(-r));
|
||||
+ }
|
||||
return;
|
||||
|
||||
case INIT_CMD_CHANGECONS:
|
||||
--
|
||||
1.8.1.4
|
||||
|
@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# /usr/lib/systemd/systemd-powerfail
|
||||
#
|
||||
# Copyright (c) 2014 SUSE LINUX Products GmbH, Germany.
|
||||
# Author: Werner Fink
|
||||
# Please send feedback to http://www.suse.de/feedback
|
||||
#
|
||||
# Description:
|
||||
#
|
||||
# Used to evaluate the status of /var/run/powerstatus
|
||||
#
|
||||
|
||||
trap "echo" SIGINT SIGSEGV SIGTERM
|
||||
|
||||
POWERFAIL='THE POWER IS FAILED! SYSTEM GOING DOWN! PLEASE LOG OFF NOW!'
|
||||
POWERFAILNOW='THE POWER IS FAILED! LOW BATTERY - EMERGENCY SYSTEM SHUTDOWN!'
|
||||
POWERISBACK='THE POWER IS BACK'
|
||||
|
||||
typeset pwrstat=0
|
||||
test -s /var/run/powerstatus && read pwrstat < /var/run/powerstatus
|
||||
rm -f /var/run/powerstatus
|
||||
|
||||
case "$pwrstat" in
|
||||
O*) exec /sbin/shutdown -c +0 "$POWERISBACK" ;;
|
||||
L*) exec /sbin/shutdown -P +0 "$POWERFAILNOW" ;;
|
||||
*) exec /sbin/shutdown -P +2 "$POWERFAIL" ;;
|
||||
esac
|
@ -62,6 +62,17 @@ Fri Mar 7 08:00:31 UTC 2014 - werner@suse.de
|
||||
- Add linker scripts as place holder of the old systemd shared
|
||||
libraries now all included in libsystemd.so (bnc#867128)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 7 14:50:39 CET 2014 - hare@suse.de
|
||||
|
||||
- Integrate powerd handling in initctl service
|
||||
+ Remove 1016-support-powerfail-with-powerstatus.patch
|
||||
+ Remove systemd-powerfail
|
||||
+ Add systemd-powerd-initctl-support.patch
|
||||
- Remove 61-msft.rules; superseded by sg3_utils (bnc#866933)
|
||||
- Persistent by-path links for ATA devices (FATE#317063)
|
||||
+ Update 1001-re-enable-by_path-links-for-ata-devices.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 4 10:37:02 UTC 2014 - werner@suse.de
|
||||
|
||||
|
14
systemd.spec
14
systemd.spec
@ -137,7 +137,6 @@ Source8: systemd-journald.init
|
||||
Source9: nss-myhostname-config
|
||||
Source10: macros.systemd.upstream
|
||||
Source11: after-local.service
|
||||
Source12: systemd-powerfail
|
||||
|
||||
Source1060: boot.udev
|
||||
Source1061: write_dev_root_rule
|
||||
@ -291,8 +290,6 @@ Patch1010: 1010-do-not-install-sulogin-unit-with-poweroff.patch
|
||||
Patch1012: 0001-pam_systemd_do_override_XDG_RUNTIME_DIR_of_the_original_user.patch
|
||||
# PATCH-FIX-OPENSUSE 1014-journald-with-journaling-FS.patch
|
||||
Patch1014: 1014-journald-with-journaling-FS.patch
|
||||
# PATCH-FIX-SUSE 1016-support-powerfail-with-powerstatus.patch
|
||||
Patch1016: 1016-support-powerfail-with-powerstatus.patch
|
||||
# PATCH-FIX-SUSE 1018-Make-LSB-Skripts-know-about-Required-and-Should.patch
|
||||
Patch1018: 1018-Make-LSB-Skripts-know-about-Required-and-Should.patch
|
||||
# PATCH-FIX-SUSE 1019-make-completion-smart-to-be-able-to-redirect.patch
|
||||
@ -301,6 +298,8 @@ Patch1019: 1019-make-completion-smart-to-be-able-to-redirect.patch
|
||||
Patch1020: 0001-add-network-device-after-NFS-mount-units.patch
|
||||
# PATCH-FIX-SUSE 1022-systemd-tmpfiles-ownerkeep.patch
|
||||
Patch1022: 1022-systemd-tmpfiles-ownerkeep.patch
|
||||
# PATCH-FIX-SUSE systemd-powerd-initctl-support.patch
|
||||
Patch1023: systemd-powerd-initctl-support.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
|
||||
@ -324,8 +323,6 @@ Patch1005: 1005-create-default-links-for-primary-cd_dvd-drive.patch
|
||||
Patch1006: 1006-udev-always-rename-network.patch
|
||||
# PATCH-FIX-OPENSUSE 1007-physical-hotplug-cpu-and-memory.patch
|
||||
Patch1007: 1007-physical-hotplug-cpu-and-memory.patch
|
||||
# PATCH-FIX-OPENSUSE 1008-add-msft-compability-rules.patch
|
||||
Patch1008: 1008-add-msft-compability-rules.patch
|
||||
|
||||
%description
|
||||
Systemd is a system and service manager, compatible with SysV and LSB
|
||||
@ -621,11 +618,11 @@ cp %{SOURCE7} m4/
|
||||
%patch1010 -p1
|
||||
%patch1012 -p1
|
||||
%patch1014 -p1
|
||||
%patch1016 -p1
|
||||
%patch1018 -p1
|
||||
%patch1019 -p1
|
||||
%patch1020 -p1
|
||||
%patch1022 -p1
|
||||
%patch1023 -p1
|
||||
%patch1999 -p1
|
||||
%patch2000 -p1
|
||||
%patch2001 -p1
|
||||
@ -640,7 +637,6 @@ cp %{SOURCE7} m4/
|
||||
# don't apply when bootstrapping to not modify Makefile.am
|
||||
%if ! 0%{?bootstrap}
|
||||
%patch1007 -p1
|
||||
%patch1008 -p1
|
||||
%endif
|
||||
|
||||
# ensure generate files are removed
|
||||
@ -835,11 +831,7 @@ EOF
|
||||
install -m 644 %{S:11} %{buildroot}/%{_prefix}/lib/systemd/system/
|
||||
ln -s ../after-local.service %{buildroot}/%{_prefix}/lib/systemd/system/multi-user.target.wants/
|
||||
|
||||
# support for SIGPWR handling with /var/run/powerstatus of e.g. powerd
|
||||
install -m 755 %{S:12} %{buildroot}/%{_prefix}/lib/systemd/
|
||||
install -m 644 units/powerfail.service %{buildroot}/%{_prefix}/lib/systemd/system/
|
||||
%if ! 0%{?bootstrap}
|
||||
install -m 644 man/systemd-powerfail.service.8 %{buildroot}/%{_mandir}/man8/
|
||||
%if %{without python}
|
||||
for man in systemd.directives.7 systemd.index.7
|
||||
do
|
||||
|
Loading…
Reference in New Issue
Block a user