diff options
author | Justin Davis <jrcd83@gmail.com> | 2011-08-14 21:15:27 +0200 |
---|---|---|
committer | Justin Davis <jrcd83@gmail.com> | 2011-08-14 21:15:27 +0200 |
commit | 01da7f81b3d6924d5a9a25d804a3905c6fd616ed (patch) | |
tree | 5483bc3d6dca6a45addae0710ce82d1410a343c4 /bin/pbj | |
download | genpkg-01da7f81b3d6924d5a9a25d804a3905c6fd616ed.tar.gz genpkg-01da7f81b3d6924d5a9a25d804a3905c6fd616ed.tar.xz |
Initial commit.
Diffstat (limited to 'bin/pbj')
-rwxr-xr-x | bin/pbj | 58 |
1 files changed, 58 insertions, 0 deletions
@@ -0,0 +1,58 @@ +#!/bin/sh + +VERSION=0.01 + +die() { + echo "error: $1" + exit 1 +} + +if [ -z "$1" ] ; then + die "Usage: $0 [package name]" +fi + +if [ "$PBJROOT" ] ; then + cd "$PBJROOT" +fi + +bindir="$(pwd)/bin" +if [ ! -d "$bindir" ] ; then + die "$bindir does not exist" +fi +PATH="$PATH:$bindir" + +pkgroot="$(pwd)/pkg" +if [ ! -d "$pkgroot" ] ; then + die "$pkgroot does not exist" +fi + +jamdir="$(pwd)/pbj" +if [ ! -d "$jamdir" ] ; then + die "$jamdir does not exist" +fi + +jamfile="$jamdir/$1.pbj" +if [ ! -f "$jamfile" ] ; then + die "$jamfile is missing" +fi + +pkg=$1 +rm -rf "$pkgroot/$pkg" +mkdir "$pkgroot/$pkg" +cd "$pkgroot/$pkg" + +export PATH="$PATH:$bindir/macros:$bindir/templ" + +# Provide values for things macros won't be able to. +printf "+ pbjver $VERSION\n+ pkgrel ${PKGREL:-1}\n" \ + | cat - "$jamfile" \ + | awk -v packager="$PACKAGER" -f "$bindir/pbjparse.awk" \ + > PKGBUILD + +if [ $? -ne 0 ] ; then + echo "Failed to write $pkgroot/$pkg/PKGBUILD" + exit $? +fi + +echo "Wrote $pkgroot/$pkg/PKGBUILD." +exit 0 |