slackbuilds_ponce/network/barnyard2/barnyard2.SlackBuild
Niels Horn 3ecfa23e5c network/barnyard2: Added (log parser for snort)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
2010-10-15 22:16:57 -05:00

102 lines
2.5 KiB
Bash

#!/bin/sh
# Slackware build script for barnyard2
# Snort binary log processor
# Written by Niels Horn <niels.horn@gmail.com>
# Revision date 2010/09/21
PRGNAM=barnyard2
VERSION=${VERSION:-1.8}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
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"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$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 {} \;
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--mandir=/usr/man \
--localstatedir=/var \
--with-mysql-libraries=/usr/lib${LIBDIRSUFFIX}/mysql \
--with-mysql-includes=/usr/include/mysql \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new
# Include rc.barnyard2 file
mkdir -p $PKG/etc/rc.d
cat $CWD/rc.barnyard2 > $PKG/etc/rc.d/rc.barnyard2.new
chmod 0755 $PKG/etc/rc.d/rc.barnyard2.new
# Create directory for log
mkdir -p $PKG/var/log/$PRGNAM
# Copy database schemas and docs
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/schemas
for sc in schemas/create_*; do
cat $sc > $PKG/usr/doc/$PRGNAM-$VERSION/$sc
done
cp -a \
COPYING LICENSE RELEASE.NOTES doc/* \
$PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc/$PRGNAM-$VERSION -name "Makefile*" -exec rm -f {} \;
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
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.${PKGTYPE:-tgz}