#!/bin/sh
#
# kTm port by Juzer
#
#       regards to hns & psych
#

# local config:
BUILD="1"
PACKAGE="p0f"

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE-|cut -d "-" -f 1,2`"
$WGET -q http://lcamtuf.coredump.cx/p0f/
NEW=`grep $PACKAGE index.html|grep .tgz|cut -d '"' -f 6|sort -t . -k +3|sed -e s/.tgz//|tail -1`
#Checking for new version
    checkpkg
# clean
rm index.html
}

download() {
# Downloading version from "${VERFILE}"
$WGET -P $DOWNL http://lcamtuf.coredump.cx/p0f/$SRC.tgz
}

build() {
# Creating new
tar zxvf $DOWNL/$SRC.tgz
cd p0f
make || exit
make p0fq || exit
mkdir -p $PKG/etc/p0f
mkdir -p $PKG/etc/rc.d
mkdir -p $PKG/usr/man/man1
mkdir -p $PKG/usr/sbin
cp -f p0f $PKG/usr/sbin/
cp -f p0frep $PKG/usr/sbin/
cp -f p0f.fp p0fa.fp p0fr.fp $PKG/etc/p0f/
cp -f p0f.1 $PKG/usr/man/man1/
mkdir $PKG/etc/rc.d/
cp $CWD/rc.pof $PKG/etc/rc.d/
if [ -r /etc/rc.d/rc.pof ];then
mv $PKG/etc/rc.d/rc.pof $PKG/etc/rc.d/rc.pof.new
fi
    postbuild
}

source "${DATA:-/usr/lib/ktm}/ktm.ports.sh"

