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

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

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

download() {
# Downloading version from "${VERFILE}"
$WGET -P $DOWNL http://www.zsh.org/pub/$SRC.tar.bz2
}

build() {
# Creating new
tar jxvf $DOWNL/$SRC.tar.bz2
cd $SRC
./configure \
    --prefix=/usr \
    $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
mkdir -p $PKG/etc
mkdir -p $PKG/bin
( cd $PKG/etc ; ln -sf  profile zprofile )
mv $PKG/usr/bin/$SRC $PKG/bin/
cd $PKG/bin ; ln -sf $SRC zsh
rm $PKG/usr/bin/zsh
rm -r $PKG/usr/bin/
    postbuild
}

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

