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

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

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE|cut -d "-" -f 1,2`"
$WGET -q http://download.mks.com.pl/download/linux/
NEW=`grep $PACKAGE index.html |cut -d '"' -f 6|sed -e s/.tgz//|tail -1`
#Checking for new version
    checkpkg
# clean
rm index.html
}

download() {
# Downloading version from "${VERFILE}"
$WGET -P $DOWNL http://download.mks.com.pl/download/linux/$SRC.tgz || exit
}

build() {
# Creating new
tar zxvf $DOWNL/$SRC.tgz || exit
cd `echo $SRC|sed -e s/Linux//`
mkdir -p $PKG/var/run/mksd
mkdir -p $PKG/usr/bin
mkdir -p $PKG/usr/sbin
chown mks.mks $PKG/var/run/mksd
chmod 710 $PKG/var/run/mksd
cp mksd.static $PKG/usr/sbin/mksd
cp mksscan.static $PKG/usr/bin/mksscan
if [ -r /etc/rc.d/rc.mksd ];then
mv $PKG/etc/rc.d/rc.mksd $PKG/etc/rc.d/rc.mksd.new
fi
    postbuild
    rm -rf $TMP/`echo $SRC|sed -e s/Linux//`
}

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

