diff options
author | V'yacheslav Stetskevych <slava18@gmail.com> | 2010-07-02 07:54:20 -0500 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-07-02 07:54:20 -0500 |
commit | 188355e7db3e109e638d4959c7fc422890f3d65d (patch) | |
tree | 1466748c0298090a4fd02bdbecc653a569dc0c76 /system | |
parent | e59713189d604d5a294fc7e417a5ed68b809f34e (diff) |
system/laptop-mode-tools: Added (laptop power saving package)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r-- | system/laptop-mode-tools/README | 10 | ||||
-rw-r--r-- | system/laptop-mode-tools/doinst.sh | 32 | ||||
-rw-r--r-- | system/laptop-mode-tools/laptop-mode-tools.SlackBuild | 89 | ||||
-rw-r--r-- | system/laptop-mode-tools/laptop-mode-tools.info | 10 | ||||
-rw-r--r-- | system/laptop-mode-tools/slack-desc | 19 |
5 files changed, 160 insertions, 0 deletions
diff --git a/system/laptop-mode-tools/README b/system/laptop-mode-tools/README new file mode 100644 index 000000000000..5e4d8e0bac4c --- /dev/null +++ b/system/laptop-mode-tools/README @@ -0,0 +1,10 @@ +Laptop Mode Tools is a laptop power saving package for Linux systems. +It allows you to extend the battery life of your laptop in several ways. +It is the primary way to enable the Laptop Mode feature of the Linux kernel, +which lets your hard drive spin down. In addition, it allows you to tweak +a number of other power-related settings using a simple configuration file. + +To launch laptop-mode-tools on system start, add the following to rc.local: +if [ -x /etc/rc.d/rc.laptop-mode ]; then + /etc/rc.d/rc.laptop-mode start +fi diff --git a/system/laptop-mode-tools/doinst.sh b/system/laptop-mode-tools/doinst.sh new file mode 100644 index 000000000000..2e40b106cf96 --- /dev/null +++ b/system/laptop-mode-tools/doinst.sh @@ -0,0 +1,32 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +for conf in etc/laptop-mode/*.conf.new etc/laptop-mode/conf.d/*.conf.new; do + config "$conf" +done + +preserve_perms etc/rc.d/rc.laptop-mode.new + +killall -SIGHUP acpid 2>/dev/null +killall -SIGHUP apmd 2>/dev/null diff --git a/system/laptop-mode-tools/laptop-mode-tools.SlackBuild b/system/laptop-mode-tools/laptop-mode-tools.SlackBuild new file mode 100644 index 000000000000..a4396f35ba89 --- /dev/null +++ b/system/laptop-mode-tools/laptop-mode-tools.SlackBuild @@ -0,0 +1,89 @@ +#!/bin/sh + +# Slackware build script for laptop-mode-tools +# Copyright 2010 V'yacheslav Stetskevych <slava18@gmail.com> +# 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=laptop-mode-tools +VERSION=${VERSION:-1.55} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + LIBDIRSUFFIX="64" +else + LIBDIRSUFFIX="" +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 {} \; + +DESTDIR=$PKG INIT_D=$PKG/etc/rc.d MAN_D=/usr/man ./install.sh +install -d $PKG/var/run/laptop-mode-tools + +[ "$LIBDIRSUFFIX" = "64" ] && mv $PKG/usr/lib $PKG/usr/lib64 + +find $PKG/usr/man -type f -exec gzip -9 {} \; + +mv $PKG/etc/rc.d/laptop-mode $PKG/etc/rc.d/rc.laptop-mode.new + +find $PKG/etc/laptop-mode -name '*.conf' -exec mv {} {}.new \; + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + README COPYING \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/laptop-mode-tools/laptop-mode-tools.info b/system/laptop-mode-tools/laptop-mode-tools.info new file mode 100644 index 000000000000..675611b8db42 --- /dev/null +++ b/system/laptop-mode-tools/laptop-mode-tools.info @@ -0,0 +1,10 @@ +PRGNAM="laptop-mode-tools" +VERSION="1.55" +HOMEPAGE="http://www.samwel.tk/laptop_mode/" +DOWNLOAD="http://samwel.tk/laptop_mode/tools/downloads/laptop-mode-tools_1.55.tar.gz" +MD5SUM="fda9255375de2dd3b86526da39160cf0" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="V'yacheslav Stetskevych" +EMAIL="slava18@gmail.com" +APPROVED="rworkman" diff --git a/system/laptop-mode-tools/slack-desc b/system/laptop-mode-tools/slack-desc new file mode 100644 index 000000000000..4644a820c6b2 --- /dev/null +++ b/system/laptop-mode-tools/slack-desc @@ -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------------------------------------------------------| +laptop-mode-tools: laptop-mode-tools (Linux laptop power saving package) +laptop-mode-tools: +laptop-mode-tools: Laptop Mode Tools is a laptop power saving package for Linux systems. +laptop-mode-tools: It allows you to extend the battery life of your laptop, in several +laptop-mode-tools: ways. It is the primary way to enable the Laptop Mode feature +laptop-mode-tools: of the Linux kernel, which lets your hard drive spin down. +laptop-mode-tools: In addition, it allows you to tweak a number of other power-related +laptop-mode-tools: settings using a simple configuration file. +laptop-mode-tools: +laptop-mode-tools: Homepage: http://www.samwel.tk/laptop_mode/ +laptop-mode-tools: |