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

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

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE|cut -d "-" -f 1,2`"
$WGET -q ftp://ftp.kde.org/pub/kde/stable/
VER=`cat index.html |cut -d '/' -f 7|sort -n|tail -1`
rm index.html
$WGET -q ftp://ftp.kde.org/pub/kde/stable/$VER/src/
NEW=`grep $PACKAGE index.html|grep .tar|cut -d / -f 9|cut -d '"' -f 1|sed -e s/.tar.*//|tail -1`
#Checking for new version
    checkpkg
# clean
rm index.html
}

download() {
# Downloading version from "${VERFILE}"
$WGET -q ftp://ftp.kde.org/pub/kde/stable/
VER=`cat index.html |cut -d '/' -f 7|sort -n|tail -1`
rm index.html
$WGET -P $DOWNL ftp://ftp.kde.org/pub/kde/stable/$VER/src/$SRC.tar.bz2
}
build() {
# Creating new
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/opt/kde/bin:/usr/sbin:/sbin"
tar jxvf $DOWNL/$SRC.tar.bz2
cd $SRC
./configure \
    --prefix=/opt/kde \
    --host=$TARGET --build=$TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
    postbuild
}

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

