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

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

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

build() {
# Creating new
tar jxvf $DOWNL/$SRC.tar.bz2
cd $SRC
./configure \
    --prefix=/usr \
    --disable-shared \
    --disable-desrpc \
    $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
cd $PKG
mkdir -p $PKG/etc
cp etc/login.defs.linux $PKG/etc/login.defs.new
cp etc/login.access $PKG/etc/login.access.new
cp $CWD/adduser $PKG/usr/sbin/adduser
chmod 755 $PKG/usr/sbin/adduser
mkdir -p $PKG/sbin
cp contrib/adduser.sh $PKG/sbin/adduser
chmod 755 $PKG/sbin/adduser
mv $PKG/usr/share/man/ $PKG/usr/
mv $PKG/bin/su $PKG/usr/bin/
strip --strip-unneeded $PKG/bin/* $PKG/sbin/* $PKG/usr/bin/* $PKG/usr/sbin/*
rm $PKG/bin/sg
    postbuild
}

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

