#!/bin/sh
CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-rppppoe
VERSION=3.5
ARCH=alpha
BUILD=2

( cd $TMP
tar xzf $CWD/rp-pppoe-$VERSION.tar.gz
cd rp-pppoe-$VERSION/src
./configure --prefix=/usr
make
mkdir -p $PKG/etc/ppp/plugins $PKG/usr/doc/rp-pppoe-$VERSION $PKG/usr/sbin $PKG/usr/man/man5 $PKG/usr/man/man8
cp -a ../SERVPOET ../README ../configs/pap-secrets ../doc/* $PKG/usr/doc/rp-pppoe-$VERSION
cp -a ../man/*.8 $PKG/usr/man/man8 ; cp -a ../man/*.5 $PKG/usr/man/man5
cd ../scripts
cp -a adsl-connect adsl-setup adsl-start adsl-status adsl-stop $PKG/usr/sbin
cd ../src
cp -a pppoe pppoe-relay pppoe-server pppoe-sniff $PKG/usr/sbin
cd ../configs
cp -a firewall-masq firewall-standalone pppoe-server-options pppoe.conf $PKG/etc/ppp
( cd $PKG
( cd usr/man ; gzip -9 man?/* )
( cd usr/sbin ; chmod 755 * ; chown root.bin * )
)
cat << EOF > $PKG/etc/ppp/plugins/README
# Directory created by rp-pppoe for kernel-mode plugin

EOF
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n $TMP/rp-pppoe-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/rp-pppoe.build.log
