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

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

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE|cut -d "-" -f 1,2`"
$WGET -q ftp://ftp.proftpd.org/distrib/source/
NEW=`grep $PACKAGE index.html|grep .tar|cut -d / -f 6|cut -d '"' -f 1|sed -e s/.tar.*//|grep -v rc|tail -1`
#Checking for new version
    checkpkg
# clean
rm index.html
}

download() {
# Downloading version from "${VERFILE}"
$WGET -P $DOWNL ftp://ftp.proftpd.org/distrib/source/$SRC.tar.bz2
}

build() {
# Creating new
tar jxvf $DOWNL/$SRC.tar.bz2
cd $SRC
./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --enable-ipv6 \
    --enable-autoshadow \
    --localstatedir=/var/run \
    --with-modules=mod_readme:mod_ratio:mod_tls \
    $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
if [ -r /etc/proftpd.conf ];then
mv $PKG/etc/proftpd.conf $PKG/etc/proftpd.conf.new
fi
    postbuild
}

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

