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

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

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE-2|cut -d "-" -f 1,2`"
$WGET -q http://ftp.gnu.org/gnu/bash/
NEW="`grep $PACKAGE-2 index.html|grep .tar |cut -d ">" -f 3|cut -d "<" -f 1|sed -e s/.tar.gz//|tail -1`"
#Checking for new version
    checkpkg
# clean
rm index.html
}

download() {
# Downloading version from "${VERFILE}"
$WGET -P $DOWNL http://ftp.gnu.org/gnu/bash/$SRC.tar.gz
}

build() {
# Creating new
tar zxvf $DOWNL/$SRC.tar.gz
cd $SRC
for patch in $CWD/patches/bash* ; do
    zcat $patch | patch -p0 --verbose || exit
done
./configure \
    --prefix=/usr \
    $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
mkdir $PKG/bin
mkdir -p $PKG/var/log/history
chown root.root $PKG/var/log/history
chmod 733 $PKG/var/log/history
mv $PKG/usr/bin/bash $PKG/bin
    postbuild
}

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

