#!/bin/sh
#
# Description: Script for generation .deb package
# Author: Gijs Molenaar <gijs@sara.nl>
#
# Changed: Bas van der Vlies <basv@sara.nl>
# Added some variables
#
# SVN Info:
# 	$Id: make_deb_pkg.sh 41 2004-07-09 08:48:21Z bas $	

TOPDIR=tmp
DEST_BIN=$TOPDIR/usr/bin
DEST_SBIN=$TOPDIR/usr/sbin
DEST_DOC=$TOPDIR/usr/share/doc/beo-pxeconfig

PKG_NAME=`grep Package DEBIAN/control | cut -d: -f2`
VERSION=`grep Version DEBIAN/control  | cut -d: -f2`
VERSION=`echo $VERSION | sed 's/ //g'`



echo ""
echo "making tree"
echo "-----------"
mkdir -vp $DEST_BIN $DEST_SBIN $DEST_DOC

echo ""
echo "copying files to their home"
echo "---------------------------"
cp -v hexls $DEST_BIN/beo_hexls
cp -v pxeconfig $DEST_BIN/beo_pxeconfig
cp -v pxeconfigd $DEST_SBIN/beo_pxeconfigd
cp -v AUTHORS COPYING Changelog INSTALL README $DEST_DOC

echo ""
echo "copying Debian package config files"
echo "-----------------------------------"
cp -rv DEBIAN $TOPDIR

echo ""
echo "Making the Debian package"
echo "-------------------------"
dpkg -b $TOPDIR
echo ${PKG_NAME}_${VERSION}
mv -v $TOPDIR.deb ${PKG_NAME}_${VERSION}.deb

echo ""
echo "removing $TOPDIR dir"
echo "----------------"
rm -rf $TOPDIR
