Browse Source

ap/laptop-mode-tools: Upgraded to laptop-mode-tools-1.52.

slackware-14.2
Damien Goutte-Gattat 12 years ago
parent
commit
d25adfadeb
  1. 52
      ap/laptop-mode-tools/doinst.sh
  2. 147
      ap/laptop-mode-tools/laptop-mode-tools.SlackBuild
  3. 1
      ap/laptop-mode-tools/laptop-mode-tools_1.45.tar.gz.sha1
  4. 1
      ap/laptop-mode-tools/laptop-mode-tools_1.52.tar.gz.sha1
  5. 80
      ap/laptop-mode-tools/rc.laptop-mode
  6. 25
      ap/laptop-mode-tools/slack-desc

52
ap/laptop-mode-tools/doinst.sh

@ -1,56 +1,18 @@
#!/bin/sh
#!/bin/bash
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
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
for i in ac97-powersave.conf auto-hibernate.conf bluetooth.conf \
configuration-file-control.conf cpufreq.conf dpms-standby.conf \
ethernet.conf hal-polling.conf intel-sata-powermgmt.conf \
lcd-brightness.conf sched-mc-power-savings.conf \
start-stop-programs.conf terminal-blanking.conf video-out.conf \
wireless-ipw-power.conf wireless-iwl-power.conf ; \
do config etc/laptop-mode/conf.d/$i.new ; \
for CONF in etc/laptop-mode/*.new \
etc/laptop-mode/conf.d/*.new \
etc/rc.d/rc.laptop-mode.new
do
config $CONF
done
config etc/laptop-mode/laptop-mode.conf.new
config etc/laptop-mode/lm-profiler.conf.new
# We want to run laptop-mode-tools on boot
exist_local=$(grep "/etc/rc.d/rc.laptop-mode" etc/rc.d/rc.local)
if [[ "${exist_local}" == "" ]]; then
cat << EOF >> etc/rc.d/rc.local
# Run laptop-mode-tools:
if [ -x /etc/rc.d/rc.laptop-mode ]; then
/etc/rc.d/rc.laptop-mode start
fi
EOF
fi
# If rc.local_shutdown doesn't exist (like on a stock Slackware 12.1 install), create it
if [ ! -e etc/rc.d/rc.local_shutdown ]; then
echo "#!/bin/sh" > etc/rc.d/rc.local_shutdown
echo "" >> etc/rc.d/rc.local_shutdown
chmod 755 etc/rc.d/rc.local_shutdown
fi
# We want to stop laptop-mode-tools on shutdown
exist_local_shutdown=$(grep "/etc/rc.d/rc.laptop-mode" etc/rc.d/rc.local_shutdown)
if [[ "${exist_local_shutdown}" == "" ]]; then
cat << EOF >> etc/rc.d/rc.local_shutdown
# Stop laptop-mode-tools:
if [ -x /etc/rc.d/rc.laptop-mode ]; then
/etc/rc.d/rc.laptop-mode stop
fi
EOF
fi

147
ap/laptop-mode-tools/laptop-mode-tools.SlackBuild

@ -1,111 +1,112 @@
#!/bin/sh
#!/bin/bash
# Build script for Slackware
# by: Parein Nicolas "_Hitek_" http://www.slackbuilds.net < hitek at slackbuilds dot net >
# Copyright (C) 2009 Damien Goutte-Gattat
#
# Copyright: See COPYING file at http://www.slackbuilds.net/COPYING
# Redistribution and use of this script, with or without modifications,
# 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.
#
# Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org>
#
# Latest laptop-mode-tools sourcecode is available at:
# http://samwel.tk/laptop_mode/
# <http://samwel.tk/laptop_mode/>.
## Fill these variables to your needs ##
# Source package infos
NAMESRC=${NAMESRC:-laptop-mode-tools}
VERSION=${VERSION:-1.45}
EXT=${EXT:-tar.gz}
NAMETGZ=${NAMETGZ:-laptop-mode-tools}
BUILD=${BUILD:-1_SBn}
VERSION=${VERSION:-1.52}
ARCHIVE=${ARCHIVE:-${NAMESRC}_$VERSION.tar.gz}
WGET=${WGET:-http://samwel.tk/laptop_mode/tools/downloads/$ARCHIVE}
# Build infos
NAMEPKG=${NAMEPKG:-laptop-mode-tools}
BUILD=${BUILD:-1GGD}
ARCH=${ARCH:-i486}
EXT=${EXT:-txz}
# Directories
TMP=${TMP:-/tmp}
OUT=${OUT:-$TMP/build}
ARCH=${ARCH:-i486}
TARGET=${TARGET:-i486}
WGET=${WGET:-http://samwel.tk/laptop_mode/tools/downloads/${NAMESRC}_${VERSION}.$EXT}
########################################
PKG=${PKG:-$OUT/$NAMEPKG}
CWD=$(pwd)
set -e
set -e # Quit if a command returns non-zero
if [ ! -r ${NAMESRC}_${VERSION}.$EXT ]; then
rm -f ${NAMESRC}_${VERSION}.$EXT.part
wget -vc $WGET -O ${NAMESRC}_${VERSION}.$EXT.part
mv ${NAMESRC}_${VERSION}.$EXT.part ${NAMESRC}_${VERSION}.$EXT
# Sanity checks
if [ $UID -eq 0 ]; then
echo "You should NOT run this script as ROOT!"
exit 1
fi
sha1sum -c ${NAMESRC}_${VERSION}.$EXT.sha1
CWD=$(pwd)
PKG=$TMP/build/$NAMETGZ
NAME=$(tar ft ${NAMESRC}_${VERSION}.$EXT | head -n 1 | awk -F/ '{ print $1 }')
if [ "$(id -u)" = "0" ]; then
echo "You shouldn't run this SlackBuild as ROOT !"
exit 1
if [ ! -d $TMP ]; then
echo "$TMP does not exist or is not a directory!"
exit 1
fi
if [ ! -d $TMP ]; then
echo "$TMP doesn't exist or is not a directory !"
exit 1
# Get and verify the source archive
if [ ! -r $ARCHIVE ]; then
wget -c -O $ARCHIVE.part $ARCHIVE
mv $ARCHIVE.part $ARCHIVE
fi
sha1sum -c $ARCHIVE.sha1
NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
# Build the software
# Build
cd $TMP
echo "Building ${NAMESRC}_${VERSION}.$EXT..."
tar xf $CWD/${NAMESRC}_${VERSION}.$EXT
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
mkdir -p $PKG/etc
mkdir -p $PKG/etc/rc.d
mkdir -p $PKG/usr/man/man8
cp -R usr $PKG
if [ "x$ARCH" = 'xx86_64' -a -d $PKG/usr/lib ]; then
mv $PKG/usr/lib $PKG/usr/lib64
fi
cp -R etc/acpi $PKG/etc
#cp -R etc/apm $PKG/etc
cp -R etc/laptop-mode $PKG/etc
cp -R usr $PKG
cp -R man/* $PKG/usr/man/man8
cat $CWD/rc.laptop-mode > $PKG/etc/rc.d/rc.laptop-mode
for i in ac97-powersave.conf auto-hibernate.conf bluetooth.conf \
configuration-file-control.conf cpufreq.conf dpms-standby.conf \
ethernet.conf hal-polling.conf intel-sata-powermgmt.conf \
lcd-brightness.conf sched-mc-power-savings.conf \
start-stop-programs.conf terminal-blanking.conf video-out.conf \
wireless-ipw-power.conf wireless-iwl-power.conf ; \
do mv $PKG/etc/laptop-mode/conf.d/$i $PKG/etc/laptop-mode/conf.d/$i.new ; \
done
mv $PKG/etc/laptop-mode/laptop-mode.conf $PKG/etc/laptop-mode/laptop-mode.conf.new
mv $PKG/etc/laptop-mode/lm-profiler.conf $PKG/etc/laptop-mode/lm-profiler.conf.new
chmod 755 $PKG/etc/acpi/actions/*
chmod 755 $PKG/etc/rc.d/rc.laptop-mode
install -m 644 etc/init.d/laptop-mode $PKG/etc/rc.d/rc.laptop-mode.new
# Install a slack-desc
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
# Prevent overwritting of existing configuration files
for CONF in $PKG/etc/laptop-mode/conf.d/*.conf $PKG/etc/laptop-mode/*.conf
do
mv $CONF $CONF.new
done
# Install a doinst.sh, if it exists
if [ -r $CWD/doinst.sh ]; then
cat $CWD/doinst.sh > $PKG/install/doinst.sh
fi
# Install and compress man pages
mkdir -p $PKG/usr/man/man8
install -m 644 man/* $PKG/usr/man/man8
find $PKG/usr/man -type f -exec gzip -9 {} \;
# Install the documentation
mkdir -p $PKG/usr/doc/$NAMETGZ-$VERSION
install -p -m 644 \
Documentation/* COPYING README \
$PKG/usr/doc/$NAMETGZ-$VERSION
mkdir -p $PKG/usr/doc/$NAMEPKG-$VERSION
install -m 644 Documentation/* COPYING README $PKG/usr/doc/$NAMEPKG-$VERSION
# Compress the man pages
if [ -d $PKG/usr/man ]; then
find $PKG/usr/man -type f -name "*.?" -exec gzip -9 {} \;
for manpage in $(find $PKG/usr/man -type l) ; do
ln -s $(readlink $manpage).gz $manpage.gz
rm -f $manpage
done
fi
# Copy slack-desc and doinst.sh files
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh
# Build the package
# Package the tree
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
/sbin/makepkg -l y -c n $OUT/$NAMETGZ-$VERSION-$ARCH-$BUILD.tgz
/sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
rm -rf $PKG
rm -rf $TMP/$NAME
"
if [ "$(which fakeroot 2> /dev/null)" ]; then
if type -p fakeroot ; then
echo "$PACKAGING" | fakeroot
else
su -c "$PACKAGING"

1
ap/laptop-mode-tools/laptop-mode-tools_1.45.tar.gz.sha1

@ -1 +0,0 @@
776537b8052086163961c2c831eddf9f3cc682ad ./laptop-mode-tools_1.45.tar.gz

1
ap/laptop-mode-tools/laptop-mode-tools_1.52.tar.gz.sha1

@ -0,0 +1 @@
80fcb3600315ec6f60cad52c6c7166cccc4ca4fc laptop-mode-tools_1.52.tar.gz

80
ap/laptop-mode-tools/rc.laptop-mode

@ -1,80 +0,0 @@
#! /bin/sh
#
# chkconfig: - 90 90
# description: Starts and stops "laptop-mode" - tweaks system behavior
# to extend battery life.
#
# config: /etc/laptop-mode/laptop-mode.conf
test -f /usr/sbin/laptop_mode || exit 0
if [ -f /lib/lsb/init-functions ] ; then
. /lib/lsb/init-functions
else
log_success_msg()
{
logger -t LAPTOP-MODE -p daemon.info -- $*
echo "$*"
}
log_failure_msg()
{
logger -t LAPTOP-MODE -p daemon.notice -- $*
echo "$*"
}
fi
# Enable laptop mode when the system is booted when running on battery.
case $1 in
start)
mkdir -p /var/run/laptop-mode-tools
touch /var/run/laptop-mode-tools/enabled
if RESULT=`/usr/sbin/laptop_mode auto` ; then
log_success_msg "$RESULT"
else
log_failure_msg "$RESULT"
fi
;;
restart|reload|force-reload)
# Full restart: first stop laptop mode completely (to restore default mount options etc.)
mkdir -p /var/run/laptop-mode-tools
rm -f /var/run/laptop-mode-tools/enabled
if RESULT=`/usr/sbin/laptop_mode stop` ; then
log_success_msg "$RESULT"
else
log_failure_msg "$RESULT"
fi
# Now remove files containing stored status, re-enable, and start it up again.
rm -f /var/run/laptop-mode-tools/*
touch /var/run/laptop-mode-tools/enabled
if RESULT=`/usr/sbin/laptop_mode auto force` ; then
log_success_msg "$RESULT"
else
log_failure_msg "$RESULT"
fi
;;
stop)
rm -f /var/run/laptop-mode-tools/enabled
if RESULT=`/usr/sbin/laptop_mode stop` ; then
log_success_msg "$RESULT"
else
log_failure_msg "$RESULT"
fi
;;
status)
echo "Laptop mode status:"
echo
/usr/sbin/laptop_mode status
;;
*)
echo "Usage: $0 {stop|start|restart|reload|force-reload|status}" >&2
exit 2
;;
esac
exit 0

25
ap/laptop-mode-tools/slack-desc

@ -1,19 +1,12 @@
# 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 (Tools for power savings)
laptop-mode-tools:
laptop-mode-tools: Laptop mode is a Linux kernel feature that allows your laptop to save
laptop-mode-tools: considerable power, by allowing the hard drive to spin down for longer
laptop-mode-tools: periods of time. This package contains the userland scripts that are
laptop-mode-tools: needed to enable laptop mode. It includes support for automatically
laptop-mode-tools: enabling laptop mode when the computer is working on batteries.
laptop-mode-tools:
laptop-mode-tools:
laptop-mode-tools:
laptop-mode-tools:
laptop-mode-tools: Laptop mode is a Linux kernel feature that allows your
laptop-mode-tools: laptop to save considerable power, by allowing the hard
laptop-mode-tools: drive to spin down for longer periods of time. This package
laptop-mode-tools: contains the userland scripts that are needed to enable
laptop-mode-tools: laptop mode. It includes support for automatically enabling
laptop-mode-tools: laptop mode when the computer is working on batteries.
laptop-mode-tools:
laptop-mode-tools:
laptop-mode-tools:

Loading…
Cancel
Save