mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-21 19:42:24 +01:00
system/pm-utils: Added to 12.1 repository
This commit is contained in:
parent
ac86efbc48
commit
692d3b71e7
7 changed files with 308 additions and 0 deletions
9
system/pm-utils/README
Normal file
9
system/pm-utils/README
Normal file
|
@ -0,0 +1,9 @@
|
|||
The pm-utils package provides simple shell command line tools
|
||||
to suspend and hibernate computers that can be used to run
|
||||
vendor or distro supplied scripts on suspend and resume.
|
||||
|
||||
See the installed documentation, especially README.SLACKWARE,
|
||||
for usage hints and such.
|
||||
|
||||
vbetool and radeontool are not required, but you should probably
|
||||
install them just in case your hardware needs them.
|
114
system/pm-utils/README.SLACKWARE
Normal file
114
system/pm-utils/README.SLACKWARE
Normal file
|
@ -0,0 +1,114 @@
|
|||
README.SLACKWARE
|
||||
20081130 - rworkman@slackware.com
|
||||
|
||||
===============================================================================
|
||||
PLEASE READ THIS ENTIRE FILE BEFORE REPORTING PROBLEMS OR ASKING FOR HELP!
|
||||
===============================================================================
|
||||
|
||||
One of these routines should tell you whether any of the operations
|
||||
are supported by your current kernel/userspace at all:
|
||||
|
||||
for i in hibernate suspend suspend-hybrid ; do
|
||||
pm-is-supported --$i \
|
||||
&& echo "$i is supported" \
|
||||
|| echo "$i is not supported" ;
|
||||
done
|
||||
|
||||
*OR*
|
||||
|
||||
cat /sys/power/state
|
||||
|
||||
Assuming they are supported, running "pm-suspend" as root should do a suspend
|
||||
to ram, and "pm-hibernate" should suspend to disk. Note that you must have a
|
||||
swap partition (or file, but partition is easier) which is large enough
|
||||
(2x ram is good here) and the relevant initrd lines and such for this to work.
|
||||
If you're not familiar with all of that, don't test pm-hibernate.
|
||||
I don't have hardware which supports suspend-hybrid, so I have no idea if/how
|
||||
it works at all.
|
||||
|
||||
Here's the short version of using suspend to disk:
|
||||
|
||||
Stanza in /etc/lilo.conf should look something like this:
|
||||
image = /boot/vmlinuz-generic-smp-2.6.26.7-smp
|
||||
initrd = /boot/initrd.gz
|
||||
append = "resume=/dev/hda2"
|
||||
root = /dev/hda1
|
||||
label = Slackware
|
||||
read-only
|
||||
|
||||
/etc/mkinitrd.conf should look something like this:
|
||||
MODULE_LIST="jfs"
|
||||
ROOTDEV="/dev/hda1"
|
||||
ROOTFS="jfs"
|
||||
RESUMEDEV="/dev/hda2"
|
||||
|
||||
mkinitrd command invocation would be this:
|
||||
mkinitrd -c -k 2.6.26.7-smp -F
|
||||
|
||||
All of the above assumes at least a cursory understanding of what those
|
||||
commands and parameters do. If it's not clear, don't attempt it on a
|
||||
system that you can't easily reinstall without concern.
|
||||
|
||||
==============================================================================
|
||||
|
||||
If it works for you, and/or you want to automate it a bit, you'll find
|
||||
some sample acpi event declarations and scripts here:
|
||||
http://rlworkman.net/conf/acpi/
|
||||
A better option is to use a power manager daemon, but unless you happen to be
|
||||
running gnome or one of the pre-release xfce-4.6 builds, that's not an option.
|
||||
I'm not sure whether kde's klaptop supports pm-utils or not, so feedback in
|
||||
this area is encouraged.
|
||||
|
||||
==============================================================================
|
||||
|
||||
If it doesn't work by default for you, consider having a look at
|
||||
http://people.freedesktop.org/~hughsient/quirk/quirk-suspend-index.html
|
||||
for some debugging hints. Pay particular attention to this page:
|
||||
http://people.freedesktop.org/~hughsient/quirk/quirk-suspend-try.html
|
||||
If you are able to get your machine to suspend/resume correctly by passing
|
||||
additional quirks on the command line, then I would like to know about it so
|
||||
that upstream hal-info can get the correct information to use. Please email
|
||||
the make/model and other relevant information about your machine along with
|
||||
the full output of "lshal" and "lspci" attached, and what extra quirks you
|
||||
needed to add for successful suspend/resume to rworkman@slackware.com
|
||||
|
||||
==============================================================================
|
||||
|
||||
If you need the system to do certain operations before going to sleep and
|
||||
then undo them (or perhaps do something new) when waking back up, pm-utils
|
||||
supports something called "hooks." The hooks installed by packages (not only
|
||||
pm-utils itself) should be in /usr/lib/pm-utils/sleep.d/, while any hooks
|
||||
installed by the local system administrator (e.g. things that are only an
|
||||
issue on that one machine) should be in /etc/pm/sleep.d/.
|
||||
|
||||
Looking at some of the existing hooks should give you a decent idea of their
|
||||
capabilities; as a head start, the functions used in the hooks are declared
|
||||
in /usr/lib/pm-utils/functions, which is inherited elsewhere by
|
||||
/usr/lib/pm-utils/pm-functions
|
||||
|
||||
One way to contribute to pm-utils indirectly is by writing and sending any
|
||||
needed hooks scripts to upstream projects; as an example, the hook that
|
||||
ships with wicd was contributed by me. Ideally, the pm-utils package should
|
||||
have a very minimum number of hooks shipped with it, as they should ship with
|
||||
the package to which the hook pertains; for example, the grub package would
|
||||
ship its own hook.
|
||||
|
||||
==============================================================================
|
||||
|
||||
We have removed several hooks from the default upstream package in response
|
||||
to a discussion on the pm-utils mailing list; see the source directory of
|
||||
pm-utils for details, and if you happen to need any of the removed hooks,
|
||||
most of them are in /usr/doc/pm-utils-*/extra_hooks/
|
||||
|
||||
==============================================================================
|
||||
|
||||
KNOWN BUGS
|
||||
|
||||
If your alsa drivers don't correctly save and restore state across a sleep /
|
||||
resume cycle (due to a buggy driver), then you will need to add the drivers
|
||||
to a custom file named /etc/pm/config.d/defaults (create the file if it does
|
||||
not exist already) in a variable named "SUSPEND_MODULES" - see the file at
|
||||
/usr/lib/pm-utils/defaults for proper format.
|
||||
|
||||
==============================================================================
|
||||
|
20
system/pm-utils/patches/99video.diff
Normal file
20
system/pm-utils/patches/99video.diff
Normal file
|
@ -0,0 +1,20 @@
|
|||
--- a/pm/sleep.d/99video
|
||||
+++ b/pm/sleep.d/99video
|
||||
@@ -144,7 +144,7 @@ suspend_video()
|
||||
local acpi_flag=0
|
||||
quirk "${QUIRK_S3_BIOS}" && acpi_flag=$(($acpi_flag + 1))
|
||||
quirk "${QUIRK_S3_MODE}" && acpi_flag=$(($acpi_flag + 2))
|
||||
- [ 0 -ne $acpi_flag ] && sysctl -w kernel.acpi_video_flags=$acpi_flag
|
||||
+ sysctl -w kernel.acpi_video_flags=$acpi_flag
|
||||
|
||||
quirk "${QUIRK_NOFB}" && die_if_framebuffer
|
||||
quirk "${QUIRK_VBESTATE_RESTORE}" && vbe_savestate
|
||||
@@ -166,8 +166,6 @@ resume_video()
|
||||
quirk "${QUIRK_RADEON_OFF}" && radeon_on
|
||||
quirk "${QUIRK_DPMS_ON}" && vbe dpms on
|
||||
quirk "${QUIRK_RESET_BRIGHTNESS}" && reset_brightness
|
||||
- # always reset acpi_video_flag -- makes quirk testing more reliable.
|
||||
- sysctl -w kernel.acpi_video_flags=0
|
||||
return 0 # avoid spurious hook exit failure message.
|
||||
}
|
||||
|
25
system/pm-utils/patches/pm-utils-functions.in.patch
Normal file
25
system/pm-utils/patches/pm-utils-functions.in.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
diff -Nur pm-utils-1.2.2.1.orig/pm/functions.in pm-utils-1.2.2.1/pm/functions.in
|
||||
--- pm-utils-1.2.2.1.orig/pm/functions.in 2008-10-05 20:49:09.000000000 -0500
|
||||
+++ pm-utils-1.2.2.1/pm/functions.in 2008-10-24 14:49:56.911161730 -0500
|
||||
@@ -124,15 +124,19 @@
|
||||
done
|
||||
}
|
||||
|
||||
-# Service management is sysv dependent.
|
||||
-# TODO: modularize this to make it work with other init systems.
|
||||
if ! command_exists service; then
|
||||
service()
|
||||
{
|
||||
+ # Pure SysV init
|
||||
if [ -x "/etc/init.d/$1" ]; then
|
||||
svc="$1"
|
||||
shift
|
||||
"/etc/init.d/$svc" "$@"
|
||||
+ # Slackware's BSD-style SysV init
|
||||
+ elif [ -x "/etc/rc.d/rc.${1}" ]; then
|
||||
+ svc="$1"
|
||||
+ shift
|
||||
+ "/etc/rc.d/rc.${1}" "$@"
|
||||
else
|
||||
log "${1}: unrecognized service"
|
||||
return 1
|
113
system/pm-utils/pm-utils.SlackBuild
Normal file
113
system/pm-utils/pm-utils.SlackBuild
Normal file
|
@ -0,0 +1,113 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Slackware build script for pm-utils
|
||||
|
||||
# Copyright 2008 Robby Workman, Northport, Alabama, USA
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this script, with or without modification, is
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of this script must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=pm-utils
|
||||
VERSION=1.2.2.1
|
||||
ARCH=${ARCH:-i486}
|
||||
BUILD=${BUILD:-2}
|
||||
TAG=${TAG:-_SBo}
|
||||
|
||||
CWD=$(pwd)
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i486" ]; then
|
||||
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
||||
elif [ "$ARCH" = "s390" ]; then
|
||||
SLKCFLAGS="-O2"
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf $PRGNAM-$VERSION
|
||||
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
||||
cd $PRGNAM-$VERSION
|
||||
chown -R root:root .
|
||||
find . \
|
||||
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
||||
-exec chmod 755 {} \; -o \
|
||||
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
||||
-exec chmod 644 {} \;
|
||||
|
||||
# Fix up some SysV init hardcoding
|
||||
patch -p1 < $CWD/patches/pm-utils-functions.in.patch
|
||||
|
||||
# Fix a bug where acpi video flags aren't properly reset after a resume,
|
||||
# causing subsequent resumes to fail
|
||||
patch -p1 < $CWD/patches/99video.diff
|
||||
|
||||
CFLAGS="$SLKCFLAGS" \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
||||
--mandir=/usr/man \
|
||||
--build=$ARCH-slackware-linux
|
||||
|
||||
make
|
||||
make install DESTDIR=$PKG
|
||||
|
||||
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
( cd $PKG/usr/man || exit 1
|
||||
find . -type f -exec gzip -9 {} \;
|
||||
for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
|
||||
)
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README* TODO \
|
||||
$PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||||
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
|
||||
|
||||
# According to this thread, these hooks should not be needed:
|
||||
# http://lists.freedesktop.org/archives/pm-utils/2008-November/001753.html
|
||||
# ##### MOVED HOOKS
|
||||
# 1. 50ntpd: ntp gracefully handles disappearing net on its own
|
||||
# 2. 55battery: hal >0.5.10 handles this on its own
|
||||
# 3. 90clock: Most systems should keep the hwclock in sync over a suspend /
|
||||
# resume cycle, and since this hook is a severe time waster otherwise,
|
||||
# we'll kill it.
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/extra_hooks
|
||||
mv $PKG/usr/lib/pm-utils/sleep.d/{50ntpd,55battery,90clock} \
|
||||
$PKG/usr/doc/$PRGNAM-$VERSION/extra_hooks
|
||||
# ##### REMOVED HOOKS
|
||||
# 4. 65alsa: According to the alsa devs, this hook is useless. Correct
|
||||
# way to workaround buggy alsa drivers is documented in README.SLACKWARE
|
||||
# http://lists.freedesktop.org/archives/pm-utils/2008-November/001808.html
|
||||
# 5. 94cpufreq: all cpufreq governors are "sane" now, so this isn't needed
|
||||
rm -f $PKG/usr/lib/pm-utils/sleep.d/{65alsa,94cpufreq}
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
|
8
system/pm-utils/pm-utils.info
Normal file
8
system/pm-utils/pm-utils.info
Normal file
|
@ -0,0 +1,8 @@
|
|||
PRGNAM="pm-utils"
|
||||
VERSION="1.2.2.1"
|
||||
HOMEPAGE="http://pm-utils.freedesktop.org/"
|
||||
DOWNLOAD="http://pm-utils.freedesktop.org/releases/pm-utils-1.2.2.1.tar.gz"
|
||||
MD5SUM="dcc7bde623d0bae207158e153b7394a8"
|
||||
MAINTAINER="Robby Workman"
|
||||
EMAIL="rw@rlworkman.net"
|
||||
APPROVED="dsomero"
|
19
system/pm-utils/slack-desc
Normal file
19
system/pm-utils/slack-desc
Normal file
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description. Line
|
||||
# up the first '|' above the ':' following the base package name, and the '|'
|
||||
# on the right side marks the last column you can put a character in. You must
|
||||
# make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':'.
|
||||
|
||||
|-----handy-ruler----------------------------------------------------|
|
||||
pm-utils: pm-utils (Power Management Utilities)
|
||||
pm-utils:
|
||||
pm-utils: The pm-utils package provides simple shell command line tools
|
||||
pm-utils: to suspend and hibernate computers that can be used to run
|
||||
pm-utils: vendor or distro supplied scripts on suspend and resume.
|
||||
pm-utils:
|
||||
pm-utils: Homepage: http://pm-utils.freedesktop.org
|
||||
pm-utils:
|
||||
pm-utils:
|
||||
pm-utils:
|
||||
pm-utils:
|
Loading…
Reference in a new issue