#!/bin/sh # Heavily based on the Slackware 13.0 SlackBuild # chkrootkit # http://www.chkrootkit.org/ # The Italian Slackware Community # http://www.slacky.eu/ # Packager ulisse89 (riccardo.trebbi89 AT gmail DOT com) NAME=chkrootkit VERSION=${VERSION:-0.49} ARCH=${ARCH:-i486} BUILD=${BUILD:-2} TAG=${TAG:-uls} CWD=$(pwd) TMP=${TMP:-/tmp/txz} PKG=$TMP/package-$NAME if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" fi set -e # Exit on most errors rm -rf $PKG mkdir -p $TMP $PKG cd $TMP rm -rf $NAME-$VERSION tar xvf $CWD/$NAME.tar.gz cd $NAME-$VERSION chown -R root:root . find . \ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ -exec chmod 755 {} \; -o \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; # Since it is a really simple program, it does not need the configure command make sense # Since it does not have a 'make install' option, we have to copy files manually mkdir -p $PKG/usr/sbin/ mkdir -p $PKG/usr/lib/$NAME find $TMP/$NAME-$VERSION -executable -type f -exec cp -a {} $PKG/usr/lib/$NAME \; cat > $PKG/usr/sbin/$NAME << EOF #!/bin/sh # This script simply move to chkrootkit directory and executes it # Exit on most errors set -e # Execute the program in his base directory cd /usr/lib/$NAME ./$NAME EOF chmod 755 $PKG/usr/sbin/$NAME # Strip binaries and libraries ( 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 || true ) # Copy program documentation into the package mkdir -p $PKG/usr/doc/$NAME-$VERSION cp -a \ ACKNOWLEDGMENTS COPYRIGHT README.* README \ $PKG/usr/doc/$NAME-$VERSION cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild # Copy the slack-desc into ./install mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc # Call requiredbuilder requiredbuilder -v -y -s $CWD $PKG # Make the package cd $PKG /sbin/makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD$TAG.txz if [ "$1" = "--cleanup" ]; then rm -rf $TMP fi