#!/bin/sh
# Set initial variables:
CWD=`pwd`
if [ "$TMP" = "" ]; then
  TMP=/tmp
fi
PKG=$TMP/package-aaa_base

VERSION=11.0.0
ARCH=noarch
BUILD=2

if [ ! -d $TMP ]; then
  mkdir -p $TMP # location to build the source
fi
if [ ! -d $PKG ]; then
  mkdir -p $PKG # place for the package to be built
fi

# Explode the package framework:
cd $PKG
explodepkg $CWD/_aaa_base.tar.gz

echo "+======================+"
echo "| repackaging aaa_base |"
echo "+======================+"

cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/slackware-version > $PKG/etc/slackware-version

# Build the package:
cd $PKG
makepkg -l y -c n $TMP/aaa_base-$VERSION-$ARCH-$BUILD.tgz

# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
  rm -rf $PKG
fi