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

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

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE|cut -d "-" -f 1,2`"
$WGET -q http://ftp.gnu.org/gnu/tar/
NEW="`grep $PACKAGE index.html|grep .tar |cut -d ">" -f 3|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 -P $DOWNL http://ftp.gnu.org/gnu/tar/$SRC.tar.bz2
}

build() {
# Creating new
tar jxvf $DOWNL/$SRC.tar.bz2
cd $SRC
./configure \
    --prefix=/usr \
    --enable-backup-scripts \
    $TARGET || exit
#zcat $CWD/bzip2-tar.diff.gz | patch -E -p1 --verbose
make || exit
make install DESTDIR=$PKG || exit
mkdir $PKG/bin
mv $PKG/usr/bin/tar $PKG/bin/tar
rm $PKG/usr/info/dir
    postbuild
}

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