Some SlackBuild scripts for Slackware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.1 KiB

#!/bin/sh
# Build script for Slackware
# by: Parein Nicolas "_Hitek_" http://www.slackbuilds.net < hitek at slackbuilds dot net >
#
# Copyright: See COPYING file at http://www.slackbuilds.net/COPYING
#
# Latest laptop-mode-tools sourcecode is available at:
# http://samwel.tk/laptop_mode/
## Fill these variables to your needs ##
NAMESRC=${NAMESRC:-laptop-mode-tools}
VERSION=${VERSION:-1.45}
EXT=${EXT:-tar.gz}
NAMETGZ=${NAMETGZ:-laptop-mode-tools}
BUILD=${BUILD:-1_SBn}
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}
########################################
set -e
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
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
fi
if [ ! -d $TMP ]; then
echo "$TMP doesn't exist or is not a directory !"
exit 1
fi
# Build the software
cd $TMP
echo "Building ${NAMESRC}_${VERSION}.$EXT..."
tar xf $CWD/${NAMESRC}_${VERSION}.$EXT
cd $NAME
mkdir -p $PKG/etc
mkdir -p $PKG/etc/rc.d
mkdir -p $PKG/usr/man/man8
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 a slack-desc
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
# Install a doinst.sh, if it exists
if [ -r $CWD/doinst.sh ]; then
cat $CWD/doinst.sh > $PKG/install/doinst.sh
fi
# Install the documentation
mkdir -p $PKG/usr/doc/$NAMETGZ-$VERSION
install -p -m 644 \
Documentation/* COPYING README \
$PKG/usr/doc/$NAMETGZ-$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
# Build the package
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
/sbin/makepkg -l y -c n $OUT/$NAMETGZ-$VERSION-$ARCH-$BUILD.tgz
rm -rf $PKG
rm -rf $TMP/$NAME
"
if [ "$(which fakeroot 2> /dev/null)" ]; then
echo "$PACKAGING" | fakeroot
else
su -c "$PACKAGING"
fi