#!/bin/sh
#
# Currently, there are no proper release packages of palbart. This script
# downloads the required files and packs them into a tar that can be used as
# the source archive for Debian packages.
#
# Running this script will create palbart.tar.xz in the current directory.

set -e

TMPDIR=$(mktemp -d)

trap 'rm -r "$TMPDIR"' EXIT

DEST="$TMPDIR/palbart"
mkdir "$DEST"

wget -nv -P "$DEST" \
	http://www.pdp8online.com/ftp/software/palbart/README \
	http://www.pdp8online.com/ftp/software/palbart/palbart.1 \
	http://www.pdp8online.com/ftp/software/palbart/palbart.c

tar -caf palbart.tar.xz -C "$TMPDIR" palbart

echo
echo "Package built in palbart.tar.xz"
echo "Release line from the source file:"
grep '^char \*release' "$DEST/palbart.c" || echo "*** release line not found"
