9c9d25136d
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
139 lines
2.5 KiB
Bash
Executable file
139 lines
2.5 KiB
Bash
Executable file
#!/bin/sh -x
|
|
|
|
# variables
|
|
TAG=cyco
|
|
OUTPUT=/tmp
|
|
TMP=/tmp/$TAG
|
|
CWD=$(pwd)
|
|
|
|
PRGNAM=i8kutils
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
VERSION=1.33
|
|
|
|
EXT=tar.gz
|
|
|
|
DOCS="AUTHORS ChangeLog COPYING INSTALL NEWS README* TODO examples patches"
|
|
|
|
ARCH=$(uname -m)
|
|
BUILD=2
|
|
|
|
|
|
PREFIX=/usr
|
|
|
|
SLCKFLAGS="-fPIC -O2"
|
|
|
|
# nettoyage préalable
|
|
rm -fr $PKG $TMP/$PRGNAM-$VERSION
|
|
|
|
mkdir -p $PKG
|
|
|
|
# mise en place
|
|
cd $TMP
|
|
tar xf $CWD/$PRGNAM-$VERSION.$EXT
|
|
cd $PRGNAM-$VERSION
|
|
|
|
# configuration
|
|
|
|
# compilation
|
|
make -j3 PREFIX=$PREFIX
|
|
|
|
# installation
|
|
mkdir -p $PKG$PREFIX/{sbin,bin,man}
|
|
make install DESTDIR=$PKG PREFIX=$PREFIX
|
|
cp *.1 $PKG$PREFIX/man
|
|
|
|
mkdir -p $PKG/etc/rc.d
|
|
cat <<EOF > $PKG/etc/rc.d/rc.i8kmon.new
|
|
#!/bin/sh
|
|
# Start/stop/restart i8kmon.
|
|
|
|
# Start i8kmon:
|
|
i8kmon_start() {
|
|
if [ -x /usr/bin/i8kmon -a -d /proc/i8k ]; then
|
|
echo "Starting i8k daemon: /usr/sbin/i8kmon"
|
|
/usr/bin/i8kmon
|
|
fi
|
|
}
|
|
|
|
# Stop i8kmon:
|
|
i8kmon_stop() {
|
|
killall i8kmon
|
|
}
|
|
|
|
# Restart i8kmon:
|
|
i8kmon_restart() {
|
|
i8kmon_stop
|
|
sleep 1
|
|
i8kmon_start
|
|
}
|
|
|
|
case "\$1" in
|
|
'start')
|
|
i8kmon_start
|
|
;;
|
|
'stop')
|
|
i8kmon_stop
|
|
;;
|
|
'restart')
|
|
i8kmon_restart
|
|
;;
|
|
*)
|
|
echo "usage \$0 start|stop|restart"
|
|
esac
|
|
EOF
|
|
chmod +x $PKG/etc/rc.d/rc.i8kmon.new
|
|
|
|
# correction
|
|
cd $PKG
|
|
chown -R root:root *
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cd $TMP/$PRGNAM-$VERSION
|
|
cp -R $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
mkdir $PKG/etc
|
|
cp i8kmon.conf $PKG/etc/i8kmon.conf.new
|
|
|
|
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
|
|
|
|
# Strip binaries
|
|
( cd $PKG
|
|
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
)
|
|
|
|
# embaumement
|
|
mkdir -p $PKG/install
|
|
cat <<EOF > $PKG/install/doinst.sh
|
|
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...
|
|
}
|
|
config etc/rc.d/rc.i8kmon.new
|
|
EOF
|
|
cat <<EOF > $PKG/install/slack-desc
|
|
$PRGNAM: $PRGNAM (user-space programs for accessing the SMM BIOS of Dell laptops.)
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM: http://packages.debian.org/i8kutils
|
|
$PRGNAM:
|
|
$PRGNAM: see /usr/doc/$PRGNAM-$VERSION for more details
|
|
$PRGNAM:
|
|
EOF
|
|
|
|
# empaquetage
|
|
cd $PKG
|
|
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz
|