mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-22 19:44:21 +01:00
system/hdapsd: Added to 12.2 repository
This commit is contained in:
parent
a4f48c6e20
commit
4db878070a
9 changed files with 328 additions and 0 deletions
16
system/hdapsd/README
Normal file
16
system/hdapsd/README
Normal file
|
@ -0,0 +1,16 @@
|
|||
This is a disk protection user-space daemon for IBM/Lenovo ThinkPads.
|
||||
It monitors the acceleration values through the HDAPS interface and
|
||||
automatically initiates disk head parking if a fall or sliding of the
|
||||
laptop is detected.
|
||||
|
||||
If you would like to use the latest source when building your
|
||||
hdapsd package, you will need to get it from their git server.
|
||||
In order to do that, use the included hdapsd-mksrctarball.sh
|
||||
script, which will download the source code and will create
|
||||
a compressed tarball using today's date (YYYYMMDD) as its version string.
|
||||
To use your newly download source, you will need to tell the SlackBuild
|
||||
to use it like so: VERSION=YYYYMMDD ./hdapsd.SlackBuild
|
||||
|
||||
Be sure to see README.SLACKWARE for usage information.
|
||||
|
||||
This requires tp_smapi.
|
17
system/hdapsd/README.SLACKWARE
Normal file
17
system/hdapsd/README.SLACKWARE
Normal file
|
@ -0,0 +1,17 @@
|
|||
hdapsd README.SLACKWARE - 20090329 <rworkman@slackbuilds.org>
|
||||
|
||||
We have added a custom /etc/hdapsd.conf file in which you can specify
|
||||
various details about your system without editing the installed init
|
||||
script; however, the init script has sane defaults for most systems.
|
||||
In particular, if your Thinkpad's primary disk drive is not /dev/sda,
|
||||
then you will need to edit the config file.
|
||||
|
||||
To run hdapsd at boot, add the following to /etc/rc.d/rc.local:
|
||||
|
||||
if [ -x /etc/rc.d/rc.hdapsd ]; then
|
||||
/etc/rc.d/rc.hdapsd start
|
||||
fi
|
||||
|
||||
Then you can simply start the HDAPS daemon without rebooting:
|
||||
/etc/rc.d/rc.hdapsd start
|
||||
|
23
system/hdapsd/doinst.sh
Normal file
23
system/hdapsd/doinst.sh
Normal file
|
@ -0,0 +1,23 @@
|
|||
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...
|
||||
}
|
||||
|
||||
# Keep same perms on rc.hdapsd.new:
|
||||
if [ -e etc/rc.d/rc.hdapsd ]; then
|
||||
cp -a etc/rc.d/rc.hdapsd etc/rc.d/rc.hdapsd.new.incoming
|
||||
cat etc/rc.d/rc.hdapsd.new > etc/rc.d/rc.hdapsd.new.incoming
|
||||
mv etc/rc.d/rc.hdapsd.new.incoming etc/rc.d/rc.hdapsd.new
|
||||
fi
|
||||
|
||||
config /etc/rc.d/rc.hdapsd.new
|
||||
config /etc/hdapsd.conf.new
|
||||
|
26
system/hdapsd/hdapsd-mksrctarball.sh
Normal file
26
system/hdapsd/hdapsd-mksrctarball.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This script helps you to download and compress the
|
||||
# sourcecode for ffmpeg from its svn server.
|
||||
# Copyright (c) 2008 alkos333 <me@alkos333.net>
|
||||
|
||||
# Based on ffmpeg-mksrctarball.sh (SlackBuilds.org, Slackware 12.0)
|
||||
|
||||
# Thanks to Antonio Hernández Blas for a suggestion on SBo mailing list
|
||||
|
||||
set -e
|
||||
|
||||
PRGNAM=hdapsd
|
||||
VERSION=$(date +"%Y%m%d")
|
||||
GITSERVER=git://repo.or.cz/hdapsd.git
|
||||
|
||||
echo "--> Downloading sourcecode from $GITSERVER"
|
||||
git clone $GITSERVER $PRGNAM-$VERSION 2>&1
|
||||
|
||||
echo "--> Making the sourcecode tarball: $PRGNAM-$VERSION.tar.bz2 "
|
||||
tar -c $PRGNAM-$VERSION/ | bzip2 -9 > $PRGNAM-$VERSION.tar.bz2
|
||||
|
||||
echo "--> Erasing the sourcecode directory: $PRGNAM-$VERSION/"
|
||||
rm -rf $PRGNAM-$VERSION/
|
||||
|
||||
echo "--> Sourcecode tarball for $PRGNAM: $PRGNAM-$VERSION.tar.bz2"
|
111
system/hdapsd/hdapsd.SlackBuild
Normal file
111
system/hdapsd/hdapsd.SlackBuild
Normal file
|
@ -0,0 +1,111 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Slackware build script for hdapsd
|
||||
|
||||
# Copyright (c) 2008 alkos333 <me@alkos333.net>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "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 COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS 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.
|
||||
|
||||
# Modified by Robby Workman <rworkman@slackbuilds.org>
|
||||
|
||||
PRGNAM=hdapsd
|
||||
VERSION=${VERSION:-20090328}
|
||||
ARCH=${ARCH:-i486}
|
||||
BUILD=${BUILD:-1}
|
||||
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" = "i686" ]; then
|
||||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||||
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.bz2
|
||||
cd $PRGNAM-$VERSION
|
||||
chown -R root:root .
|
||||
chmod -R u+w,go+r-w,a-s .
|
||||
|
||||
./autogen.sh
|
||||
|
||||
CFLAGS="$SLKCFLAGS" \
|
||||
CXXFLAGS="$SLKCFLAGS" \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var \
|
||||
--mandir=/usr/man \
|
||||
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
||||
--build=$ARCH-slackware-linux
|
||||
|
||||
make
|
||||
make install DESTDIR=$PKG
|
||||
|
||||
( cd $PKG
|
||||
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
|
||||
xargs strip --strip-unneeded 2> /dev/null || true
|
||||
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
|
||||
xargs strip --strip-unneeded 2> /dev/null
|
||||
)
|
||||
|
||||
( cd $PKG/usr/man
|
||||
find . -type f -exec gzip -9 {} \;
|
||||
for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
||||
)
|
||||
|
||||
# Install a sample config file and init script
|
||||
mkdir -p $PKG/etc/rc.d
|
||||
cat $CWD/hdapsd.conf > $PKG/etc/hdapsd.conf.new
|
||||
cat $CWD/rc.hdapsd > $PKG/etc/rc.d/rc.hdapsd.new
|
||||
chmod 0755 $PKG/etc/rc.d/rc.hdapsd.new
|
||||
|
||||
# Put udev rules in the right place and prefix them with a number
|
||||
# 51 is more or less arbitrary, but should be fine
|
||||
# If anyone has a link to what other distributions are doing, let us know
|
||||
#mkdir -p $PKG/lib
|
||||
#mv $PKG/etc/udev $PKG/lib
|
||||
#mv $PKG/lib/udev/rules.d/hdapsd.rules $PKG/lib/udev/rules.d/51-hdapsd.rules
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
# ChangeLog NEWS README are empty
|
||||
cp -a AUTHORS COPYING $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
|
||||
find $PKG/usr/doc -type f -exec chmod 644 {} \;
|
||||
|
||||
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.tgz
|
22
system/hdapsd/hdapsd.conf
Normal file
22
system/hdapsd/hdapsd.conf
Normal file
|
@ -0,0 +1,22 @@
|
|||
# This file contains system-specific variables for hdapsd
|
||||
# Edit it as needed for your system
|
||||
|
||||
# See also /etc/rc.d/rc.hdapsd
|
||||
|
||||
# Primary hard disk's device node
|
||||
# This defaults to "/dev/sda" in the init script if undefined here
|
||||
#HD_DEV="/dev/sda"
|
||||
|
||||
# Sensitivity
|
||||
# This defaults to "15" if undefined here
|
||||
#SENSITIVITY="15"
|
||||
|
||||
# Turn on logging to syslog instead of stdout
|
||||
# Default is yes if undefined here
|
||||
# 0=no 1=yes
|
||||
#USE_SYSLOG="1"
|
||||
|
||||
# Location of pid file
|
||||
# This defaults to /var/run/hdapsd.pid if undefined here
|
||||
#PIDFILE="/var/run/hdapsd.pid"
|
||||
|
8
system/hdapsd/hdapsd.info
Normal file
8
system/hdapsd/hdapsd.info
Normal file
|
@ -0,0 +1,8 @@
|
|||
PRGNAM="hdapsd"
|
||||
VERSION="20090328"
|
||||
HOMEPAGE="http://repo.or.cz/w/hdapsd.git"
|
||||
DOWNLOAD="http://slackbuilds.org/sources/12.2/hdapsd-20090328.tar.bz2"
|
||||
MD5SUM="1f70f3cc8f1d89dfa8b166f6dc4158a8"
|
||||
MAINTAINER="alkos333"
|
||||
EMAIL="me@alkso333.net"
|
||||
APPROVED="rworkman"
|
86
system/hdapsd/rc.hdapsd
Normal file
86
system/hdapsd/rc.hdapsd
Normal file
|
@ -0,0 +1,86 @@
|
|||
#!/bin/sh
|
||||
|
||||
# /etc/rc.d/rc.hdapsd
|
||||
# Start/stop the HDAPS deamon
|
||||
# Copyright (c) 2008 alkos333 <me@alkos333.net>
|
||||
|
||||
# Define a quick function to alert that the expected config file is bad
|
||||
bad_config() {
|
||||
printf "Error: /etc/hdapsd.conf either is not readable\n"
|
||||
printf " or contains a syntax error. Exiting...\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Source in the config file
|
||||
if [ -r /etc/hdapsd.conf ]; then
|
||||
. /etc/hdapsd.conf 2>/dev/null || bad_config
|
||||
fi
|
||||
|
||||
HD_DEV=${HD_DEV:-/dev/sda} # Defaults to /dev/sda
|
||||
SENSITIVITY=${SENSITIVITY:-15} # Defaults to 15
|
||||
PIDFILE=${PIDFILE:-"/var/run/hdapsd.pid"} # Default
|
||||
USE_SYSLOG=${USE_SYSLOG:-1} # 0=no 1=yes Defaults to yes
|
||||
|
||||
if [ "$USE_SYSLOG" = "1" ]; then
|
||||
ENABLESYSLOG="-l"
|
||||
else
|
||||
ENABLESYSLOG=""
|
||||
fi
|
||||
|
||||
hdapsd_start() {
|
||||
if [ -f ${PIDFILE} ]; then
|
||||
printf "HDAPS appears to already be running...\n"
|
||||
printf "If that's not the case, then remove $PIDFILE and try again...\n"
|
||||
exit 1
|
||||
else
|
||||
# Sanity check, just in case
|
||||
if [ ! -b ${HD_DEV} ]; then
|
||||
printf "${HD_DEV} either does not exist or is not a block device.\n"
|
||||
printf "Check your configuration. Exiting.\n"
|
||||
exit 1
|
||||
else
|
||||
printf "Starting HDAPS daemon... \n"
|
||||
/usr/sbin/hdapsd -v -d $(basename ${HD_DEV}) -s ${SENSITIVITY} ${ENABLESYSLOG} \
|
||||
-a -b --pidfile=${PIDFILE} 1> /dev/null
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
hdapsd_stop() {
|
||||
printf "Stopping HDAPS daemon...\n"
|
||||
if [ -f ${PIDFILE} ]; then
|
||||
kill $(cat ${PIDFILE}) 2> /dev/null
|
||||
rm -f ${PIDFILE}
|
||||
else
|
||||
killall hdapsd 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
hdapsd_status() {
|
||||
if [ -f ${PIDFILE} ]; then
|
||||
printf "HDAPS daemon is running...\n"
|
||||
else
|
||||
printf "HDAPS daemon is stopped...\n"
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
hdapsd_start
|
||||
;;
|
||||
stop)
|
||||
hdapsd_stop
|
||||
;;
|
||||
restart)
|
||||
hdapsd_stop
|
||||
hdapsd_start
|
||||
;;
|
||||
status)
|
||||
hdapsd_status
|
||||
;;
|
||||
*)
|
||||
printf "Usage $0 {start|stop|restart|status}\n"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
19
system/hdapsd/slack-desc
Normal file
19
system/hdapsd/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------------------------------------------------------|
|
||||
hdapsd: hdapsd (HDAPS Daemon for Thinkpad Laptops)
|
||||
hdapsd:
|
||||
hdapsd: This is a disk protection userspace daemon for IBM/Lenovo ThinkPads.
|
||||
hdapsd: It monitors the acceleration values through the HDAPS interface and
|
||||
hdapsd: automatically initiates disk head parking if a fall or sliding of the
|
||||
hdapsd: laptop is detected.
|
||||
hdapsd:
|
||||
hdapsd: Homepage: http://repo.or.cz/w/hdapsd.git
|
||||
hdapsd:
|
||||
hdapsd:
|
||||
hdapsd:
|
Loading…
Reference in a new issue