#!/bin/sh
# Set initial variables:
CWD=`pwd`
if [ "$TMP" = "" ]; then
TMP=/tmp
fi
PKG=$TMP/package-checkinstall
VERSION=1.5.3
ARCH=i486
BUILD=2
if [ ! -d $TMP ]; then
mkdir -p $TMP # location to build the source
fi
if [ ! -d $PKG ]; then
mkdir -p $PKG # place for the package to be built
fi
cd $TMP
tar xzvf $CWD/checkinstall-$VERSION.tar.gz
cd checkinstall-$VERSION
chown -R root.root .
find . -perm 664 | xargs chmod 644
find . -perm 775 | xargs chmod 755
# Even with the patch below, checkinstall does not do a perfect job building
# Slackware packages. For example, bin directories (and binaries in them) aren't
# chowned root:bin as the FSSTND recommends. Of course, this is purely cosmetic
# anyway. This patch causes checkinstall to use the native Slackware package
# building tool, though, and allows us to meet the "good enough" standard of
# excellence. ;-)
zcat $CWD/checkinstall.followspecsbetter.diff.gz | patch -p1 --verbose
make
make install
# Our patch also places the config file in /etc since Linux standards say config
# files must not go under /usr:
mkdir -p $PKG/etc/checkinstall
cat /etc/checkinstall/checkinstallrc > $PKG/etc/checkinstall/checkinstallrc
mkdir -p $PKG/usr/sbin
cat /usr/sbin/checkinstall > $PKG/usr/sbin/checkinstall
chmod 755 $PKG/usr/sbin/checkinstall
chown -R root.bin $PKG/usr/sbin/checkinstall
# Note that we DO NOT install "makepak". Don't use that -- it's completely broken.
mkdir -p $PKG/usr/doc/checkinstall-$VERSION
cp -a \
BUGS COPYING CREDITS Changelog FAQ INSTALL README RELNOTES TODO \
$PKG/usr/doc/checkinstall-$VERSION
# Now install the installwatch components:
cd installwatch-0.6.3
mkdir -p $PKG/usr/bin
cat /usr/bin/installwatch > $PKG/usr/bin/installwatch
chmod 755 $PKG/usr/bin/installwatch
chown -R root.bin $PKG/usr/bin
mkdir -p $PKG/usr/lib
strip --strip-unneeded installwatch.so
cat installwatch.so > $PKG/usr/lib/installwatch.so
chmod 755 $PKG/usr/lib/installwatch.so
mkdir -p $PKG/usr/doc/checkinstall-$VERSION/installwatch-0.6.3
cp -a \
BUGS CHANGELOG COPYING INSTALL README TODO VERSION \
$PKG/usr/doc/checkinstall-$VERSION/installwatch-0.6.3
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
# Build the package:
cd $PKG
makepkg -l y -c n $TMP/checkinstall-$VERSION-$ARCH-$BUILD.tgz
# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
rm -rf $TMP/checkinstall-$VERSION
rm -rf $PKG
fi