From 9b5ac6d35ec072509865fe73ee5eaa96f48467f4ff358fe2f0768affcaf90f32 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Thu, 13 Nov 2014 12:48:19 +0000 Subject: [PATCH] Accepting request 261403 from home:gberh:branches:Base:System - Add pm-utils-hooks-compat.sh in order to run pm-utils sleep hooks from systemd (boo#904828) - Add pm-utils-hooks-compat.sh in order to run pm-utils sleep hooks from systemd (boo#904828) OBS-URL: https://build.opensuse.org/request/show/261403 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=814 --- pm-utils-hooks-compat.sh | 73 ++++++++++++++++++++++++++++++++++++++++ systemd-mini.changes | 6 ++++ systemd-mini.spec | 9 +++++ systemd.changes | 6 ++++ systemd.spec | 9 +++++ 5 files changed, 103 insertions(+) create mode 100644 pm-utils-hooks-compat.sh diff --git a/pm-utils-hooks-compat.sh b/pm-utils-hooks-compat.sh new file mode 100644 index 00000000..bbe2d99c --- /dev/null +++ b/pm-utils-hooks-compat.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# +# pm-utils-hooks-compat.sh - run pm-utils sleep hooks from systemd +# +# Copyright (C) 2014 Guido Berhoerster +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +shopt -s nullglob +export PATH=/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin +export LC_ALL=C + +PM_UTILS_SLEEP_D_PATH=/usr/lib/pm-utils/sleep.d +PM_UTILS_ETC_SLEEP_D_PATH=/etc/pm/sleep.d +export PM_FUNCTIONS=/usr/lib/pm-utils/functions + +function run_script { + if [[ -r ${1} && -x ${1} && -O ${1} && \ + ! -e ${PM_UTILS_ETC_SLEEP_D_PATH}/${1##*/} ]]; then + "$@" + fi +} + +[[ -r $PM_FUNCTIONS ]] || exit 1 + +scripts=( ${PM_UTILS_SLEEP_D_PATH}/*[!~] ) +if [[ $1 == "pre" ]]; then + for (( i = 0; i < ${#scripts[@]}; i++ )); do + case "$2" in + suspend) + run_script "${scripts[i]}" suspend suspend + ;; + hibernate) + run_script "${scripts[i]}" hibernate hibernate + ;; + hybrid-sleep) + run_script "${scripts[i]}" suspend suspend-hybrid + ;; + esac + done +else + for (( i = ${#scripts[@]}; i >= 0; i-- )); do + case "$2" in + suspend) + run_script "${scripts[i]}" resume suspend + ;; + hibernate) + run_script "${scripts[i]}" thaw hibernate + ;; + hybrid-sleep) + run_script "${scripts[i]}" resume suspend-hybrid + ;; + esac + done +fi diff --git a/systemd-mini.changes b/systemd-mini.changes index 62502738..f28ae0c7 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -5,6 +5,12 @@ Thu Nov 13 09:54:35 UTC 2014 - rmilasan@suse.com 'rotational' equals 0, usually SSDs (bnc#904517). Add 1095-set-ssd-disk-to-use-deadline-scheduler.patch +------------------------------------------------------------------- +Tue Nov 11 19:10:35 UTC 2014 - gber@opensuse.org + +- Add pm-utils-hooks-compat.sh in order to run pm-utils sleep hooks + from systemd (boo#904828) + ------------------------------------------------------------------- Mon Nov 10 12:39:35 UTC 2014 - werner@suse.de diff --git a/systemd-mini.spec b/systemd-mini.spec index cc3d51fe..42566a7e 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -188,6 +188,7 @@ Source8: systemd-journald.init Source9: nss-myhostname-config Source10: macros.systemd.upstream Source11: after-local.service +Source12: pm-utils-hooks-compat.sh Source1060: boot.udev Source1061: write_dev_root_rule @@ -2298,6 +2299,11 @@ mkdir -p %{buildroot}%{_prefix}/lib/systemd/ntp-units.d/ mkdir -p %{buildroot}%{_prefix}/lib/systemd/system-shutdown/ mkdir -p %{buildroot}%{_prefix}/lib/systemd/system-sleep/ +# run pm-utils sleep hooks (boo#904828) +%if 0%{?suse_version} > 1310 +install -m 755 %{S:12} %{buildroot}%{_prefix}/lib/systemd/system-sleep/pm-utils-hooks-compat +%endif + # Make sure these directories are properly owned mkdir -p %{buildroot}%{_prefix}/lib/systemd/system/default.target.wants mkdir -p %{buildroot}%{_prefix}/lib/systemd/system/dbus.target.wants @@ -2705,6 +2711,9 @@ exit 0 %dir %{_prefix}/lib/systemd/ntp-units.d/ %dir %{_prefix}/lib/systemd/system-shutdown/ %dir %{_prefix}/lib/systemd/system-sleep/ +%if 0%{?suse_version} > 1310 +%{_prefix}/lib/systemd/system-sleep/pm-utils-hooks-compat +%endif %dir %{_prefix}/lib/systemd/system/default.target.wants %dir %{_prefix}/lib/systemd/system/dbus.target.wants %dir %{_prefix}/lib/systemd/system/getty@tty1.service.d diff --git a/systemd.changes b/systemd.changes index 62502738..f28ae0c7 100644 --- a/systemd.changes +++ b/systemd.changes @@ -5,6 +5,12 @@ Thu Nov 13 09:54:35 UTC 2014 - rmilasan@suse.com 'rotational' equals 0, usually SSDs (bnc#904517). Add 1095-set-ssd-disk-to-use-deadline-scheduler.patch +------------------------------------------------------------------- +Tue Nov 11 19:10:35 UTC 2014 - gber@opensuse.org + +- Add pm-utils-hooks-compat.sh in order to run pm-utils sleep hooks + from systemd (boo#904828) + ------------------------------------------------------------------- Mon Nov 10 12:39:35 UTC 2014 - werner@suse.de diff --git a/systemd.spec b/systemd.spec index a06da517..2b3dcc5b 100644 --- a/systemd.spec +++ b/systemd.spec @@ -183,6 +183,7 @@ Source8: systemd-journald.init Source9: nss-myhostname-config Source10: macros.systemd.upstream Source11: after-local.service +Source12: pm-utils-hooks-compat.sh Source1060: boot.udev Source1061: write_dev_root_rule @@ -2293,6 +2294,11 @@ mkdir -p %{buildroot}%{_prefix}/lib/systemd/ntp-units.d/ mkdir -p %{buildroot}%{_prefix}/lib/systemd/system-shutdown/ mkdir -p %{buildroot}%{_prefix}/lib/systemd/system-sleep/ +# run pm-utils sleep hooks (boo#904828) +%if 0%{?suse_version} > 1310 +install -m 755 %{S:12} %{buildroot}%{_prefix}/lib/systemd/system-sleep/pm-utils-hooks-compat +%endif + # Make sure these directories are properly owned mkdir -p %{buildroot}%{_prefix}/lib/systemd/system/default.target.wants mkdir -p %{buildroot}%{_prefix}/lib/systemd/system/dbus.target.wants @@ -2700,6 +2706,9 @@ exit 0 %dir %{_prefix}/lib/systemd/ntp-units.d/ %dir %{_prefix}/lib/systemd/system-shutdown/ %dir %{_prefix}/lib/systemd/system-sleep/ +%if 0%{?suse_version} > 1310 +%{_prefix}/lib/systemd/system-sleep/pm-utils-hooks-compat +%endif %dir %{_prefix}/lib/systemd/system/default.target.wants %dir %{_prefix}/lib/systemd/system/dbus.target.wants %dir %{_prefix}/lib/systemd/system/getty@tty1.service.d