#!/bin/sh
# Set initial variables:
CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-netkit-bootparamd
VERSION=0.17
ARCH=alpha
BUILD=1

rm -rf $PKG
mkdir -p $PKG
( cd $TMP
rm -rf netkit-bootparamd-$VERSION
tar xzf $CWD/netkit-bootparamd-$VERSION.tar.gz
cd netkit-bootparamd-$VERSION
chown -R root:root .
./configure \
 --prefix=/usr
make || exit 1
cd rpc.bootparamd
strip bootparamd callbootd
mkdir -p $PKG/usr/{bin,sbin}
cat bootparamd > $PKG/usr/sbin/rpc.bootparamd
chmod 755 $PKG/usr/sbin/rpc.bootparamd
cat callbootd > $PKG/usr/bin/callbootd
chmod 755 $PKG/usr/bin/callbootd
mkdir -p $PKG/usr/man/man8
gzip -9c bootparamd.8 > $PKG/usr/man/man8/rpc.bootparamd.8.gz
mkdir -p $PKG/usr/doc/netkit-bootparamd-$VERSION
cp -a README $PKG/usr/doc/netkit-bootparamd-$VERSION
chown root:root $PKG/usr/doc/netkit-bootparamd-$VERSION/*
chmod 644 $PKG/usr/doc/netkit-bootparamd-$VERSION/*
# Finish up the package:
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
# Build the package:
cd $PKG
makepkg -l y -c n $TMP/netkit-bootparamd-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/netkit-bootparamd.build.log
