From 8bf207875a236641cc8ec3121eef4d9f04a317fc Mon Sep 17 00:00:00 2001 From: aaditya Date: Sat, 30 Nov 2013 16:32:56 +0700 Subject: [PATCH] system/TLP: Added (Advanced Power Management Tool). Signed-off-by: Willy Sudiarto Raharjo --- system/TLP/README | 13 +++++ system/TLP/README.SLACKWARE | 27 +++++++++ system/TLP/TLP.SlackBuild | 111 ++++++++++++++++++++++++++++++++++++ system/TLP/TLP.info | 10 ++++ system/TLP/slack-desc | 19 ++++++ 5 files changed, 180 insertions(+) create mode 100644 system/TLP/README create mode 100644 system/TLP/README.SLACKWARE create mode 100755 system/TLP/TLP.SlackBuild create mode 100644 system/TLP/TLP.info create mode 100644 system/TLP/slack-desc diff --git a/system/TLP/README b/system/TLP/README new file mode 100644 index 0000000000..3430cb7ecc --- /dev/null +++ b/system/TLP/README @@ -0,0 +1,13 @@ +TLP implements advanced power management for Linux. +TLP is a pure command line tool with automated background tasks. +It does not contain a GUI. + +Notes: +Remove any power saving settings/scripts (e.g.: in /etc/rc.local) or +laptop-mode-tools prior installing or TLP may not work properly + +See README.SLACKWARE for more information about post-installation script + +An additional configuration is available for Thinkpads. +See the website for more details. +http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html diff --git a/system/TLP/README.SLACKWARE b/system/TLP/README.SLACKWARE new file mode 100644 index 0000000000..74e422cf2e --- /dev/null +++ b/system/TLP/README.SLACKWARE @@ -0,0 +1,27 @@ +Some post installation tasks need to be done like the autostarting of tlp +via an entry /etc/rc.d/rc.local, and a post-installation script mentioned +at http://linrunner.de/en/tlp/docs/tlp-developer-documentation.html. + +# Disable conflicting pm-utils hooks +for i in 95hdparm-apm disable_wol hal-cd-polling intel-audio-powersave \ + harddrive laptop-mode journal-commit pci_devices pcie_aspm readahead \ + sata_alpm sched-powersave usb_bluetooth wireless xfs_buffer; do + if [ -x /usr/lib/pm-utils/power.d/$i ]; then + ln -sf /usr/lib/tlp-pm/tlp-nop /etc/pm/power.d/$i + fi +done + +#Configure tlp to be run at startup +echo "/etc/rc.d/rc.tlp start" >> /etc/rc.d/rc.local + +# Give execute permission to rc.tlp +chmod +x /etc/rc.d/rc.tlp + +#Start the tlp service +/etc/rc.d/rc.tlp start + +# Restart acpid +/etc/rc.d/rc.acpid restart + +After removal of this package you need to revert the above changes. +Please make sure you stopped TLP service before removing TLP. diff --git a/system/TLP/TLP.SlackBuild b/system/TLP/TLP.SlackBuild new file mode 100755 index 0000000000..64b355a532 --- /dev/null +++ b/system/TLP/TLP.SlackBuild @@ -0,0 +1,111 @@ +#!/bin/sh + +# Slackware build script for TLP + +# Copyright 2013 Aaditya Bagga +# 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=TLP +VERSION=${VERSION:-0.4} +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/$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +if [ -e $CWD/$VERSION.tar.gz ]; then + tar xvf $CWD/$VERSION.tar.gz +else + tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +fi +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Switch to rc.d +sed -i -e "s/init.d/rc.d/" Makefile + +# Fix for x86_64 +sed -i -e "s/usr\/lib/usr\/lib${LIBDIRSUFFIX}/" Makefile + +make install-tlp DESTDIR=$PKG + +# move to rc.tlp +mv $PKG/etc/rc.d/tlp $PKG/etc/rc.d/rc.tlp + +# install man files +mkdir -p $PKG/usr/man/man{1,8} +install -m 644 man/bluetooth.1 $PKG/usr/man/man1/ +install -m 644 man/run-on-ac.1 $PKG/usr/man/man1/ +install -m 644 man/run-on-bat.1 $PKG/usr/man/man1/ +install -m 644 man/wifi.1 $PKG/usr/man/man1/ +install -m 644 man/wwan.1 $PKG/usr/man/man1/ +install -m 644 man/tlp.8 $PKG/usr/man/man8/ +install -m 644 man/tlp-stat.8 $PKG/usr/man/man8/ + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp COPYING LICENSE README $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 + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/TLP/TLP.info b/system/TLP/TLP.info new file mode 100644 index 0000000000..2e6435e1f4 --- /dev/null +++ b/system/TLP/TLP.info @@ -0,0 +1,10 @@ +PRGNAM="TLP" +VERSION="0.4" +HOMEPAGE="http://linrunner.de/en/tlp/tlp.html" +DOWNLOAD="https://github.com/linrunner/TLP/archive/0.4.tar.gz" +MD5SUM="a5de421499dc219e65678e39e291806d" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="aaditya" +EMAIL="aaditya_gnulinux@zoho.com" diff --git a/system/TLP/slack-desc b/system/TLP/slack-desc new file mode 100644 index 0000000000..7a9b772bab --- /dev/null +++ b/system/TLP/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 ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +TLP: TLP (Advanced Power Management Tool) +TLP: +TLP: TLP brings you the benefits of advanced power management for Linux +TLP: without the need to understand every technical detail. +TLP: TLP comes with a default configuration already optimized for battery +TLP: life, so you may just install and forget it. +TLP: Nevertheless TLP is highly customizable to fulfil your specific +TLP: requirements. +TLP: +TLP: Website - http://linrunner.de/en/tlp/tlp.html +TLP: