[packages/pm-utils] add patches from fedora (NM fix, grub2, s2both in kernel support, ...)
glen
glen at pld-linux.org
Sat Jul 13 13:17:09 CEST 2013
commit 4f0aa2cab190734ddcdff712a386927d13e22db5
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Jul 13 14:14:20 2013 +0300
add patches from fedora (NM fix, grub2, s2both in kernel support, ...)
add-in-kernel-suspend-to-both.patch | 33 ++++++++++++++++++++
grub2.patch | 46 +++++++++++++++++++++++++++
hook-exit-code-log.patch | 20 ++++++++++++
init-logfile-append.patch | 14 +++++++++
log-line-spacing-fix.patch | 15 +++++++++
man-fix.patch | 62 +++++++++++++++++++++++++++++++++++++
networkmanager-typo-fix.patch | 13 ++++++++
nm_method.patch | 40 ++++++++++++++++++++++++
pm-utils.spec | 18 ++++++++++-
9 files changed, 260 insertions(+), 1 deletion(-)
---
diff --git a/pm-utils.spec b/pm-utils.spec
index 07ba052..a586636 100644
--- a/pm-utils.spec
+++ b/pm-utils.spec
@@ -10,7 +10,15 @@ Source0: http://pm-utils.freedesktop.org/releases/%{name}-%{version}.tar.gz
# Source0-md5: 1742a556089c36c3a89eb1b957da5a60
Source1: http://pm-utils.freedesktop.org/releases/pm-quirks-%{quirkver}.tar.gz
# Source1-md5: 3b6ee39056b9ece0cd5e073a4c272b05
-Patch0: bashism.patch
+Patch0: init-logfile-append.patch
+Patch1: networkmanager-typo-fix.patch
+Patch2: grub2.patch
+Patch3: hook-exit-code-log.patch
+Patch4: log-line-spacing-fix.patch
+Patch5: nm_method.patch
+Patch6: add-in-kernel-suspend-to-both.patch
+Patch7: man-fix.patch
+Patch10: bashism.patch
URL: http://pm-utils.freedesktop.org/
BuildRequires: autoconf >= 2.52
BuildRequires: automake
@@ -48,6 +56,14 @@ związanych z zarządzaniem energią.
%prep
%setup -q -a1
%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch10 -p1
%build
%{__aclocal}
diff --git a/add-in-kernel-suspend-to-both.patch b/add-in-kernel-suspend-to-both.patch
new file mode 100644
index 0000000..8022ee2
--- /dev/null
+++ b/add-in-kernel-suspend-to-both.patch
@@ -0,0 +1,33 @@
+# Add support for in-kernel (from kernel 3.6) suspend to both (#843657)
+diff --git a/pm/pm-functions.in b/pm/pm-functions.in
+--- a/pm/pm-functions.in
++++ b/pm/pm-functions.in
+@@ -316,8 +316,28 @@ if [ -z "$HIBERNATE_MODULE" ] && \
+ {
+ [ -n "${HIBERNATE_MODE}" ] && \
+ grep -qw "${HIBERNATE_MODE}" /sys/power/disk && \
++ HIBERNATE_MODE_SAVE=$(cat /sys/power/disk) && \
++ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE##*[}" && \
++ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE%%]*}" && \
+ echo -n "${HIBERNATE_MODE}" > /sys/power/disk
+ echo -n "disk" > /sys/power/state
++ RET=$?
++ echo -n "$HIBERNATE_MODE_SAVE" > /sys/power/disk
++ return "$RET"
++ }
++fi
++
++# for kernels that support suspend to both (i.e. hybrid suspend)
++# since kernel 3.6
++if [ -z "$SUSPEND_HYBRID_MODULE" ] && \
++ [ -f /sys/power/disk ] && \
++ grep -q disk /sys/power/state && \
++ grep -q suspend /sys/power/disk; then
++ SUSPEND_HYBRID_MODULE="kernel"
++ do_suspend_hybrid()
++ {
++ HIBERNATE_MODE="suspend"
++ do_hibernate
+ }
+ fi
+
diff --git a/grub2.patch b/grub2.patch
new file mode 100644
index 0000000..61269be
--- /dev/null
+++ b/grub2.patch
@@ -0,0 +1,46 @@
+# Add support for grub2 in 01grub hook
+diff -up pm-utils-1.4.1/pm/sleep.d/01grub.orig pm-utils-1.4.1/pm/sleep.d/01grub
+--- pm-utils-1.4.1/pm/sleep.d/01grub.orig 2010-07-04 16:42:51.000000000 +0200
++++ pm-utils-1.4.1/pm/sleep.d/01grub 2011-08-22 14:11:39.460613138 +0200
+@@ -4,7 +4,8 @@
+
+ default_resume_kernel()
+ {
+- [ "$1" = "suspend" ] && return $NA
++ local g2reboot
++ [ "$1" = "suspend" ] && return $NA
+ case $(uname -m) in
+ i?86|x86_64|athlon)
+ ;;
+@@ -13,14 +14,26 @@ default_resume_kernel()
+ ;;
+ esac
+
+- [ -x /sbin/grubby -a -x /sbin/grub ] || return $NA
++ [ -x /sbin/grubby -a \( -x /sbin/grub -o -r /etc/grub2.cfg \) ] || \
++ return $NA
+ [ -e "/boot/vmlinuz-$(uname -r)" ] || return 1
+- out=$(/sbin/grubby --info /boot/vmlinuz-$(uname -r) |grep index)
++ out=$(/sbin/grubby --info /boot/vmlinuz-$(uname -r) |grep index | \
++ head -n 1)
+ [ -n "${out}" ] || return 1
+ current=${out#index=}
+- echo "savedefault --default=${current} --once" | \
+- /sbin/grub --device-map=/boot/grub/device.map \
+- --batch --no-floppy --no-curses >/dev/null
++ if [ -r /etc/grub2.cfg ]; then
++ # to enable this functionality in grub2
++ # GRUB_DEFAULT=saved is needed in /etc/default/grub
++ # if you want to be able to by-pass the selection in the
++ # boot menu, also use GRUB_SAVEDEFAULT=true
++ g2reboot=`which grub2-reboot 2>/dev/null` || \
++ g2reboot=`which grub-reboot 2>/dev/null` || return $NA
++ $g2reboot ${current} > /dev/null
++ else
++ echo "savedefault --default=${current} --once" | \
++ /sbin/grub --device-map=/boot/grub/device.map \
++ --batch --no-floppy --no-curses >/dev/null
++ fi
+
+ return 0
+ }
diff --git a/hook-exit-code-log.patch b/hook-exit-code-log.patch
new file mode 100644
index 0000000..91f0deb
--- /dev/null
+++ b/hook-exit-code-log.patch
@@ -0,0 +1,20 @@
+# Fix hooks exit code logging
+diff -up pm-utils-1.4.1/pm/pm-functions.in.orig pm-utils-1.4.1/pm/pm-functions.in
+--- pm-utils-1.4.1/pm/pm-functions.in.orig 2011-08-22 14:52:58.976213050 +0200
++++ pm-utils-1.4.1/pm/pm-functions.in 2011-08-22 14:57:26.000000000 +0200
+@@ -195,11 +195,13 @@ hook_ok()
+ _run_hook() {
+ # $1 = hook to run
+ # rest of args passed to hook unchanged.
++ local hook_status
+ log "Running hook $*:"
+ hook_ok "$1" && "$@"
++ hook_status=$?
+ log ""
+- log -n "$*: "
+- hook_exit_status $? && LAST_HOOK="${1##*/}" || inhibit
++ log -n "$*: "
++ hook_exit_status $hook_status && LAST_HOOK="${1##*/}" || inhibit
+ }
+
+ if profiling; then
diff --git a/init-logfile-append.patch b/init-logfile-append.patch
new file mode 100644
index 0000000..1a851b8
--- /dev/null
+++ b/init-logfile-append.patch
@@ -0,0 +1,14 @@
+# Use append instead of write for init_logfile (#660329)
+--- pm-utils-1.4.1/pm/pm-functions.in.old 2010-07-04 16:50:13.000000000 +0200
++++ pm-utils-1.4.1/pm/pm-functions.in 2010-12-07 16:48:39.555074652 +0100
+@@ -271,7 +271,9 @@
+ return 1
+ fi
+ export LOGGING=true
+- exec > "$1" 2>&1
++ rm -f "$1"
++ touch "$1"
++ exec >> "$1" 2>&1
+ }
+
+ check_suspend() { [ -n "$SUSPEND_MODULE" ]; }
diff --git a/log-line-spacing-fix.patch b/log-line-spacing-fix.patch
new file mode 100644
index 0000000..77d9649
--- /dev/null
+++ b/log-line-spacing-fix.patch
@@ -0,0 +1,15 @@
+# Fix line spacing in logs to be easier to read (#750755)
+diff -up pm-utils-1.4.1/pm/pm-functions.in.orig pm-utils-1.4.1/pm/pm-functions.in
+--- pm-utils-1.4.1/pm/pm-functions.in.orig 2011-11-02 11:43:24.000000000 +0100
++++ pm-utils-1.4.1/pm/pm-functions.in 2011-11-02 11:43:49.987116603 +0100
+@@ -199,9 +199,9 @@ _run_hook() {
+ log "Running hook $*:"
+ hook_ok "$1" && "$@"
+ hook_status=$?
+- log ""
+ log -n "$*: "
+ hook_exit_status $hook_status && LAST_HOOK="${1##*/}" || inhibit
++ log ""
+ }
+
+ if profiling; then
diff --git a/man-fix.patch b/man-fix.patch
new file mode 100644
index 0000000..cece8d5
--- /dev/null
+++ b/man-fix.patch
@@ -0,0 +1,62 @@
+# Patch sent upstream
+diff -up pm-utils-1.4.1/man/pm-action.8.orig pm-utils-1.4.1/man/pm-action.8
+--- pm-utils-1.4.1/man/pm-action.8.orig 2010-07-04 16:54:58.000000000 +0200
++++ pm-utils-1.4.1/man/pm-action.8 2013-07-01 15:44:34.000000000 +0200
+@@ -86,11 +86,21 @@ This option forces the video hardware to
+ This option forces the video hardware to turn off the screen when suspending\&. Most video adapters seem to do this correctly, but some do not, which wastes lots of power\&. If your screen is still on after successfully suspending you may need to use this option\&.
+ .RE
+ .PP
++\fB\-\-quirk\-none\fR
++.RS 4
++This option disables quirks.
++.RE
++.PP
+ \fB\-\-quirk\-radeon\-off\fR
+ .RS 4
+ This option forces Radeon hardware to turn off the display during suspend and turn it back on during resume\&. You only need to do this on some old ThinkPads of the \'30 series (T30, X31, R32,\&.\&.\&. ) with Radeon video hardware\&.
+ .RE
+ .PP
++\fB\-\-quirk\-reset\-brigthness\fR
++.RS 4
++This option resets display brightness during resume (i.e. sets the brightness to 0 and returns it to the previous value).
++.RE
++.PP
+ \fB\-\-quirk\-s3\-bios\fR
+ .RS 4
+ This option calls the video BIOS during S3 resume\&. Unfortunately, it is not always allowed to call the video BIOS at this point, so sometimes adding this option can actually break resume on some systems\&.
+diff -up pm-utils-1.4.1/man/pm-powersave.8.orig pm-utils-1.4.1/man/pm-powersave.8
+--- pm-utils-1.4.1/man/pm-powersave.8.orig 2010-07-04 16:54:56.000000000 +0200
++++ pm-utils-1.4.1/man/pm-powersave.8 2013-07-01 16:11:12.939103092 +0200
+@@ -22,7 +22,7 @@
+ pm-powersave \- Put your computer into low power mode
+ .SH "SYNOPSIS"
+ .HP \w'\fBpm\-powersave\fR\ 'u
+-\fBpm\-powersave\fR [{\fBtrue\fR\ |\ \fBfalse\fR}]
++\fBpm\-powersave\fR [{\fBtrue\fR\ |\ \fBfalse\fR}] [\fB\-\-help\fR]
+ .SH "DESCRIPTION"
+ .PP
+ This manual page documents briefly the
+@@ -43,6 +43,11 @@ Put the computer into low power mode to
+ .RS 4
+ Turn off low power mode\&.
+ .RE
++.PP
++\fB\-\-help\fR
++.RS 4
++Show the help.
++.RE
+ .SH "FILES"
+ .PP
+ /etc/pm/power\&.d/, /usr/lib/pm\-utils/power\&.d/
+diff -up pm-utils-1.4.1/src/pm-action.in.orig pm-utils-1.4.1/src/pm-action.in
+--- pm-utils-1.4.1/src/pm-action.in.orig 2010-07-04 16:42:51.000000000 +0200
++++ pm-utils-1.4.1/src/pm-action.in 2013-07-01 15:03:15.000000000 +0200
+@@ -37,6 +37,8 @@ help()
+ echo "${0##*/} [options]"
+ echo
+ echo "Options can change how suspend or hibernate is done."
++ echo
++ echo " --help"
+ run_hooks sleep help
+ sleep_module_help
+ exit 0
diff --git a/networkmanager-typo-fix.patch b/networkmanager-typo-fix.patch
new file mode 100644
index 0000000..9f089a4
--- /dev/null
+++ b/networkmanager-typo-fix.patch
@@ -0,0 +1,13 @@
+# Fix typo in 55NetworkManager (#722759)
+diff -up pm-utils-1.4.1/pm/sleep.d/55NetworkManager.old pm-utils-1.4.1/pm/sleep.d/55NetworkManager
+--- pm-utils-1.4.1/pm/sleep.d/55NetworkManager.old 2010-07-04 16:50:13.000000000 +0200
++++ pm-utils-1.4.1/pm/sleep.d/55NetworkManager 2011-07-19 11:51:47.107013726 +0200
+@@ -11,7 +11,7 @@
+ suspend_nm()
+ {
+ # Tell NetworkManager to shut down networking
+- printf "Having NetworkManager put all interaces to sleep..."
++ printf "Having NetworkManager put all interfaces to sleep..."
+ dbus_send --system \
+ --dest=org.freedesktop.NetworkManager \
+ /org/freedesktop/NetworkManager \
diff --git a/nm_method.patch b/nm_method.patch
new file mode 100644
index 0000000..d9af54f
--- /dev/null
+++ b/nm_method.patch
@@ -0,0 +1,40 @@
+# Fix NetworkManager dbus methods (fd.o #42500 / RH #740342)
+From: Michael Wild <themiwi at users.sourceforge.net>
+Date: Wed, 2 Nov 2011 09:27:34 +0100
+Subject: Use correct dbus sleep method for NetworkManager
+
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42500
+Bug-Debian: http://bugs.debian.org/647418
+
+The methods org.freedesktop.NetworkManager.{sleep,wake} have been
+replaced in post-6.x NetworkManager by
+org.freedesktop.NetworkManager.Sleep which takes a boolean argument.
+---
+ pm/sleep.d/55NetworkManager | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pm/sleep.d/55NetworkManager b/pm/sleep.d/55NetworkManager
+index a7fefd5..89cd817 100755
+--- a/pm/sleep.d/55NetworkManager
++++ b/pm/sleep.d/55NetworkManager
+@@ -15,7 +15,7 @@
+ dbus_send --system \
+ --dest=org.freedesktop.NetworkManager \
+ /org/freedesktop/NetworkManager \
+- org.freedesktop.NetworkManager.sleep && \
++ org.freedesktop.NetworkManager.Sleep boolean:true && \
+ echo Done. || echo Failed.
+ }
+
+@@ -26,7 +26,7 @@
+ dbus_send --system \
+ --dest=org.freedesktop.NetworkManager \
+ /org/freedesktop/NetworkManager \
+- org.freedesktop.NetworkManager.wake && \
++ org.freedesktop.NetworkManager.Sleep boolean:false && \
+ echo Done. || echo Failed.
+ }
+
+
+--
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/pm-utils.git/commitdiff/a47e60f6e5b3b2904474ea037f9d340ee5684b01
More information about the pld-cvs-commit
mailing list