#!/bin/bash

# Figure out the VERSION detail of SlackBuild scripts
# Run from the current dir inside the Slackware ARM tree.
# This is because the SlackBuild scripts now have automatic code
# to figure out the versions rather than hard coding them - which
# makes it more time consuming when updating Slackware ARM.
# This redresses this problem.

source /usr/share/slackdev/buildkit.sh
OURDIR="$( pwd | rev | cut -d / -f1-2 | rev )"
PKGSERIES="$( pwd | rev | cut -d / -f2 | rev )"
OURPKG="$( pwd | rev | cut -d / -f1 | rev )"

cd $SLACKSOURCE/$OURDIR
export CWD=$PWD
export PKGNAM=
grep -E '^BUILD=|^PKGVER=|^ARCNAM=|^PKGNAM=|^VERSION=' *.SlackBuild | bash -x 2>&1| tail -n2

echo "Slackware package name"
cd $SLACKSOURCE/../slackware*/$PKGSERIES
shopt -s extglob # needed to find package names
ls $OURPKG-+([^-])-+([^-])-+([^-]).t?z
