Here are a few more patches in this series that add a
/usr/lib/pm-utils/config.d to go along with /etc/pm/config.d, the
needed changes to make functions aware of this, some modifications to
push certian generic environment variables into the new per-hook
configuration scheme, and how to override a suspend/resume method to
use something besides the default kernel methods without having to
patch the source to pm-utils.
These patches apply on top of the last set of patches, or you can just
pull the (misnamed now) vlowther-security-audit branch from
git://fnordovax.org/pm-utils/
From ea1e7435f76176c23d218649faa8b0b3ca683084 Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Fri, 1 Feb 2008 13:39:39 -0600
Subject: [PATCH] Allow config files to reside in /usr/lib/pm-utils/config.d
as well as /etc/pm/config.d
---
pm/functions | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/pm/functions b/pm/functions
index b7240c9..3ea3c77 100755
--- a/pm/functions
+++ b/pm/functions
@@ -19,15 +19,17 @@ readonly INHIBIT="${PM_UTILS_DIR}/inhibit"
readonly STORAGEDIR="${PM_UTILS_DIR}/storage"
readonly LC_COLLATE=C
readonly PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/pm-utils/bin
-readonly CONFDIR="/etc/pm/config.d"
# Try to source a config file for this script.
# Allow for a few name variants, first match wins.
-for f in "${SCRIPT}" "${SCRIPT#[0-9][0-9]}" "${SCRIPT#[0-9][0-9]-}"; do
- if [ -O "${CONFDIR}/$f" ]; then
- . "${CONFDIR}/$f"
- break
- fi
+# Allow config files in /etc/pm/config.d to override package-supplied ones.
+for confdir in /usr/lib/pm-utils/config.d /etc/pm/config.d; do
+ for f in "${SCRIPT}" "${SCRIPT#[0-9][0-9]}" "${SCRIPT#[0-9][0-9]-}"; do
+ if [ -O "${confdir}/$f" ]; then
+ . "${confdir}/$f"
+ break
+ fi
+ done
done
# try to take the lock. Fail if we cannot get it.
--
1.5.3.8
From 6e64bdc18ac6f784e41ec788dae9837a4c332f2e Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Fri, 1 Feb 2008 13:47:25 -0600
Subject: [PATCH] Add autotools infrastructure for config.d
---
configure.in | 1 +
pm/Makefile.am | 2 +-
pm/config.d/Makefile.am | 11 +++++++++++
3 files changed, 13 insertions(+), 1 deletions(-)
create mode 100644 pm/config.d/Makefile.am
diff --git a/configure.in b/configure.in
index b59ad9d..47c83bb 100644
--- a/configure.in
+++ b/configure.in
@@ -36,6 +36,7 @@ src/Makefile
pm/Makefile
pm/sleep.d/Makefile
pm/power.d/Makefile
+pm/config.d/Makefile
])
dnl ==========================================================================
diff --git a/pm/Makefile.am b/pm/Makefile.am
index ba5113a..0e9c206 100644
--- a/pm/Makefile.am
+++ b/pm/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = sleep.d power.d
+SUBDIRS = sleep.d power.d config.d
extradir = $(libdir)/pm-utils
diff --git a/pm/config.d/Makefile.am b/pm/config.d/Makefile.am
new file mode 100644
index 0000000..e2f4ec4
--- /dev/null
+++ b/pm/config.d/Makefile.am
@@ -0,0 +1,11 @@
+configdir = $(libdir)/pm-utils/config.d
+
+config_DATA =
+
+EXTRA_DIST=$(config_DATA)
+
+install-exec-local:
+ -mkdir -p $(DESTDIR)$(sysconfdir)/pm/config.d
+
+clean-local :
+ rm -f *~
--
1.5.3.8
From d890bd7f54e8d89020df60f107b2b4fdbd47d73c Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Fri, 1 Feb 2008 13:55:11 -0600
Subject: [PATCH] Move some hook-specific configuration into hook-specific config files.
Also demonstrate how to override the do_hibernate function.
---
pm/config.d/cpufreq | 1 +
pm/config.d/modules | 1 +
pm/config.d/pm-hibernate | 10 ++++++++++
pm/config.d/video | 1 +
pm/pm-functions | 4 ----
5 files changed, 13 insertions(+), 4 deletions(-)
create mode 100644 pm/config.d/cpufreq
create mode 100644 pm/config.d/modules
create mode 100644 pm/config.d/pm-hibernate
create mode 100644 pm/config.d/video
diff --git a/pm/config.d/cpufreq b/pm/config.d/cpufreq
new file mode 100644
index 0000000..b155c04
--- /dev/null
+++ b/pm/config.d/cpufreq
@@ -0,0 +1 @@
+TEMPORARY_CPUFREQ_GOVERNOR="performance"
diff --git a/pm/config.d/modules b/pm/config.d/modules
new file mode 100644
index 0000000..6f406d0
--- /dev/null
+++ b/pm/config.d/modules
@@ -0,0 +1 @@
+SUSPEND_MODULES=""
diff --git a/pm/config.d/pm-hibernate b/pm/config.d/pm-hibernate
new file mode 100644
index 0000000..c983990
--- /dev/null
+++ b/pm/config.d/pm-hibernate
@@ -0,0 +1,10 @@
+#!/bin/sh
+HIBERNATE_MODE="platform"
+do_hibernate() {
+ if inhibited; then :;
+ else
+ echo -n "${HIBERNATE_MODE}" > /sys/power/disk
+ echo -n "disk" > /sys/power/state
+ fi
+ echo thaw
+}
diff --git a/pm/config.d/video b/pm/config.d/video
new file mode 100644
index 0000000..300f146
--- /dev/null
+++ b/pm/config.d/video
@@ -0,0 +1 @@
+HIBERNATE_RESUME_POST_VIDEO=no
diff --git a/pm/pm-functions b/pm/pm-functions
index 228ec10..7299fac 100755
--- a/pm/pm-functions
+++ b/pm/pm-functions
@@ -7,11 +7,7 @@
# export all these variables
set -a
-HIBERNATE_MODE="platform"
-HIBERNATE_RESUME_POST_VIDEO=no
PM_LOGFILE="${PM_LOGFILE:=/var/log/pm-suspend.log}"
-SUSPEND_MODULES=""
-TEMPORARY_CPUFREQ_GOVERNOR="performance"
# now, the distro-configurable defaults
[ -O /usr/lib/pm-utils/defaults ] && . /usr/lib/pm-utils/defaults
--
1.5.3.8
From e5ad4e7f0f1b18bd07246ccd6b2be63d0ac7541a Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Fri, 1 Feb 2008 14:04:04 -0600
Subject: [PATCH] Add package-specific files to automake, clean out defaults and explain
where the new location for default information is.
---
pm/Makefile.am | 3 ---
pm/config.d/Makefile.am | 2 +-
pm/defaults | 14 +++++---------
3 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/pm/Makefile.am b/pm/Makefile.am
index 0e9c206..e82a53e 100644
--- a/pm/Makefile.am
+++ b/pm/Makefile.am
@@ -10,8 +10,5 @@ extra_SCRIPTS = \
EXTRA_DIST = \
$(extra_SCRIPTS)
-install-exec-local:
- -mkdir $(DESTDIR)$(sysconfdir)/pm/config.d
-
clean-local :
rm -f *~
diff --git a/pm/config.d/Makefile.am b/pm/config.d/Makefile.am
index e2f4ec4..c02b392 100644
--- a/pm/config.d/Makefile.am
+++ b/pm/config.d/Makefile.am
@@ -1,6 +1,6 @@
configdir = $(libdir)/pm-utils/config.d
-config_DATA =
+config_DATA = cpufreq pm-hibernate video modules
EXTRA_DIST=$(config_DATA)
diff --git a/pm/defaults b/pm/defaults
index d5b6447..8cafd7a 100644
--- a/pm/defaults
+++ b/pm/defaults
@@ -1,9 +1,5 @@
-
-##########################################################
-# DO NOT EDIT THIS FILE, edit /etc/pm/config.d/ instead! #
-##########################################################
-
-HIBERNATE_RESUME_POST_VIDEO="no"
-
-SUSPEND_MODULES=""
-
+######################################################################
+# DO NOT EDIT THIS FILE, edit /etc/pm/config.d/ instead! #
+# Package defaults have been split out to /usr/lib/pm-utils/config.d #
+# This file is for BACKWARDS COMPATIBILITY ONLY #
+######################################################################
--
1.5.3.8
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils