diff options
Diffstat (limited to 'pm')
-rw-r--r-- | pm/pm-functions.in | 35 | ||||
-rw-r--r-- | pm/sleep.d/00powersave | 13 | ||||
-rw-r--r-- | pm/sleep.d/Makefile.am | 1 |
3 files changed, 28 insertions, 21 deletions
diff --git a/pm/pm-functions.in b/pm/pm-functions.in index 9c1c297..ce79619 100644 --- a/pm/pm-functions.in +++ b/pm/pm-functions.in @@ -19,10 +19,10 @@ PM_UTILS_ETCDIR="@PM-UTILS-SYSCONFDIR@" PM_UTILS_RUNDIR="/var/run/pm-utils" PATH=/sbin:/usr/sbin:/bin:/usr/bin:"${PM_UTILS_LIBDIR}"/bin -PM_LOGFILE="${PM_LOGFILE:=/var/log/pm-suspend.log}" +PM_LOGFILE="/var/log/${STASHNAME}.log" TEMPORARY_CPUFREQ_GOVERNOR="performance" LOCKDIR="${PM_UTILS_RUNDIR}/locks" -STORAGEDIR="${PM_UTILS_RUNDIR}/storage" +STORAGEDIR="${PM_UTILS_RUNDIR}/${STASHNAME}/storage" NA=254 NX=253 DX=252 @@ -45,11 +45,15 @@ PARAMETERS="${STORAGEDIR}/parameters" INHIBIT="${STORAGEDIR}/inhibit" PM_CMDLINE="$*" +# when loading configuration files, allow stash-specific ones +# to override the pm-utils global ones. [ -f "${PM_UTILS_LIBDIR}"/defaults ] && . "${PM_UTILS_LIBDIR}"/defaults - +[ -f "${PM_UTILS_LIBDIR}/${STASHNAME}.defaults" ] && \ + . "${PM_UTILS_LIBDIR}/${STASHNAME}.defaults" set +a -for cfg in "${PM_UTILS_ETCDIR}"/config.d/*[!~] ; do +for cfg in "${PM_UTILS_ETCDIR}"/config.d/*[!~] \ + "${PM_UTILS_ETCDIR}/${STASHNAME}.config.d"/*[!~]; do [ -f "$cfg" ] || continue # Ugly, I know. The goal here is to allow multiple files in # /etc/pm/config.d declare these variables and have those @@ -70,6 +74,12 @@ done . "${PM_FUNCTIONS}" +if [ "$(id -u)" = "0" ] && command_exists dmidecode; then + export CHASSIS_TYPE="$(dmidecode -s chassis-type)" +else + export CHASSIS_TYPE=Unknown +fi + # Simple little logging function. # We do it this way because 'echo -n' is not posix. log() @@ -106,23 +116,6 @@ load_hook_parameters() update_parameters } -take_suspend_lock() -{ - try_lock "pm-utils.lock" || return 1 - # clean up from the last run - rm -rf "${STORAGEDIR}" - mkdir -p "${STORAGEDIR}" - # save our parameter list. - [ -f "$PARAMETERS" ] || echo '' >"$PARAMETERS" - add_parameters $PM_CMDLINE - update_parameters - return 0 -} - -remove_suspend_lock() -{ - release_lock "pm-utils.lock" -} hook_exit_status(){ case $1 in diff --git a/pm/sleep.d/00powersave b/pm/sleep.d/00powersave new file mode 100644 index 0000000..bf0f98b --- /dev/null +++ b/pm/sleep.d/00powersave @@ -0,0 +1,13 @@ +#!/bin/sh + +. "${PM_FUNCTIONS}" + +command_exists pm-powersave || exit $NA + +case $1 in + suspend|hibernate) pm-powersave false ;; + resume|thaw) pm-powersave ;; + *) exit $NA ;; +esac +exit 0 +
\ No newline at end of file diff --git a/pm/sleep.d/Makefile.am b/pm/sleep.d/Makefile.am index d47b799..a2f31cc 100644 --- a/pm/sleep.d/Makefile.am +++ b/pm/sleep.d/Makefile.am @@ -2,6 +2,7 @@ sleepdir = $(libdir)/pm-utils/sleep.d sleep_SCRIPTS = \ 00logging \ + 00powersave \ 01grub \ 49bluetooth \ 50ntpd \ |