#!/bin/sh
#
# Welcome to the sbox-dtc install maker for BSD!
# Maintainer: Thomas GOIRAND <thomas@goirand.fr>
# please do not ship with you packages
# this is only a small coder tool...
#

PKGNAME="sbox-dtc"

# Nothing to be configured after this line
VERS=`cat version`
RELS=`cat release`
VERSION=$VERS"."$RELS

DIRNAME=$PKGNAME"-"$VERSION

echo " --- Making sbox-dtc BSD package --- "
# Make the directories
mkdir -p build
cd build
rm -fr $DIRNAME
mkdir -p $DIRNAME

# Copy DTC's files in the good directories
cp -rf ../create_chroot.sh ../Makefile ../README.html ../README.txt ../changelog ../copyright ../env.c ../sbox.h ../sbox.c $DIRNAME

# Make the archive
tar -czf ../$DIRNAME".tar.gz" $DIRNAME

# Make the port archive
mkdir $PKGNAME
cp -rf ../bsd/* $PKGNAME
rm -rf $PKGNAME/CVS

# Make the md5 sum file in this distinfo
BSDSUM=`md5sum "../"$PKGNAME"-"$VERSION".tar.gz" | cut -f1 -d" "`
SIZE=`ls -ALln "../"$PKGNAME"-"$VERSION".tar.gz" | awk '{print $5}'`
echo "MD5 ("$PKGNAME"-"$VERSION".tar.gz) = "$BSDSUM"
SIZE ("$PKGNAME"-"$VERSION".tar.gz) = "$SIZE >>""$PKGNAME"/distinfo"

tar -cvzf ../$PKGNAME"BSDport-"$VERSION".tar.gz" $PKGNAME
cd ..
echo " -- Succesfully made BSD port "$DIRNAME".tar.gz and $PKGNAME"BSDport-"$VERSION".tar.gz" ---"
