forked from pool/systemd
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
This commit is contained in:
parent
ed7abf1967
commit
9b5ac6d35e
73
pm-utils-hooks-compat.sh
Normal file
73
pm-utils-hooks-compat.sh
Normal file
@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# pm-utils-hooks-compat.sh - run pm-utils sleep hooks from systemd
|
||||
#
|
||||
# Copyright (C) 2014 Guido Berhoerster <gber@opensuse.org>
|
||||
#
|
||||
# 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
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user