Dr. Werner Fink 2014-01-21 12:55:52 +00:00 committed by Git OBS Bridge
parent 974d6e3467
commit 3d2db08a62
6 changed files with 112 additions and 34 deletions

View File

@ -0,0 +1,90 @@
--- 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)

View File

@ -1,24 +0,0 @@
Simple fix for bnc#750845. Maybe the original values are broken as the
delay of the first two entries in when_wall() are less then the warning
intervall. Now we warn once per hour in the first 3 hours, then all
30 minutes in last hour, all 15 minutes in the last 45 minutes, all 10
minutes in the last 15 minutes, and then all minute in the last 10 minutes.
---
shutdownd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- systemd-208/src/shutdownd/shutdownd.c
+++ systemd-208/src/shutdownd/shutdownd.c 2014-01-15 12:11:23.206235784 +0000
@@ -156,8 +156,9 @@ _const_ static usec_t when_wall(usec_t n
usec_t delay;
usec_t interval;
} table[] = {
- { 0, USEC_PER_MINUTE },
- { 10 * USEC_PER_MINUTE, 15 * USEC_PER_MINUTE },
+ { 10 * USEC_PER_MINUTE, USEC_PER_MINUTE },
+ { 15 * USEC_PER_MINUTE, 10 * USEC_PER_MINUTE },
+ { 45 * USEC_PER_MINUTE, 15 * USEC_PER_MINUTE },
{ USEC_PER_HOUR, 30 * USEC_PER_MINUTE },
{ 3 * USEC_PER_HOUR, USEC_PER_HOUR },
};

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Jan 21 12:51:20 UTC 2014 - werner@suse.de
- Drop patch 1017-enforce-sufficient-shutdown-warnings.patch
as the original code behaves exactly as the shutdown code of
the old SysVinit (bnc#750845)
- Rename support-powerfail-with-powerstatus.patch to
1016-support-powerfail-with-powerstatus.patch
-------------------------------------------------------------------
Mon Jan 20 10:18:20 UTC 2014 - fcrozat@suse.com

View File

@ -287,10 +287,8 @@ Patch1013: U_logind_revert_lazy_session_activation_on_non_vt_seats.patch
Patch1014: 1014-journald-with-journaling-FS.patch
# PATCH-FIX-UPSTREAM build-sys-make-multi-seat-x-optional.patch
Patch1015: build-sys-make-multi-seat-x-optional.patch
# PATCH-FIX-SUSE support-powerfail-with-powerstatus.patch
Patch1016: support-powerfail-with-powerstatus.patch
# PATCH-FIX-SUSE 1017-enforce-sufficient-shutdown-warnings.patch
Patch1017: 1017-enforce-sufficient-shutdown-warnings.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
@ -579,7 +577,6 @@ cp %{SOURCE7} m4/
%patch1014 -p1
%patch1015 -p1
%patch1016 -p1
%patch1017 -p1
%patch1018 -p1
%patch1019 -p1

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Jan 21 12:51:20 UTC 2014 - werner@suse.de
- Drop patch 1017-enforce-sufficient-shutdown-warnings.patch
as the original code behaves exactly as the shutdown code of
the old SysVinit (bnc#750845)
- Rename support-powerfail-with-powerstatus.patch to
1016-support-powerfail-with-powerstatus.patch
-------------------------------------------------------------------
Mon Jan 20 10:18:20 UTC 2014 - fcrozat@suse.com

View File

@ -282,10 +282,8 @@ Patch1013: U_logind_revert_lazy_session_activation_on_non_vt_seats.patch
Patch1014: 1014-journald-with-journaling-FS.patch
# PATCH-FIX-UPSTREAM build-sys-make-multi-seat-x-optional.patch
Patch1015: build-sys-make-multi-seat-x-optional.patch
# PATCH-FIX-SUSE support-powerfail-with-powerstatus.patch
Patch1016: support-powerfail-with-powerstatus.patch
# PATCH-FIX-SUSE 1017-enforce-sufficient-shutdown-warnings.patch
Patch1017: 1017-enforce-sufficient-shutdown-warnings.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
@ -574,7 +572,6 @@ cp %{SOURCE7} m4/
%patch1014 -p1
%patch1015 -p1
%patch1016 -p1
%patch1017 -p1
%patch1018 -p1
%patch1019 -p1