SHORT_DESC="Dynamic mathematics for learning and teaching"
WEB_SITE="http://www.geogebra.org/cms/en/"
# end of get.list data
DEPENDS="bash java-jre ncurses"
WGET_URL="http://www.geogebra.net/linux/pool/main/g/"
WGET_URL="$WGET_URL$(wget -O - "$WGET_URL?C=M;O=D" | \
	  sed '/href="g/!d;s/.*href="\([^"]*\).*/\1/;q')"
WGET_URL="$WGET_URL$(wget -O - "$WGET_URL?C=M;O=D" | \
	  sed '/href/!d;/i386/!d;s/.*href="\([^"]*\).*/\1/;q')"
TARBALL=$(basename $WGET_URL)

wget -O $TARBALL $WGET_URL

[ -f $TARBALL ] || abort_package

mkdir $PACKAGE
dpkg-deb -e $TARBALL $PACKAGE/meta
dpkg-deb -x $TARBALL $PACKAGE/fs
# extracted pkg can be removed: Save RAM
rm -f $TARBALL
sed '/^Description:/,$!d;s/^Description://' \
	< $PACKAGE/meta/control > $PACKAGE/description.txt

SHORT_DESC="$(sed '/^Description:/!d;s/.*: //' $PACKAGE/meta/control)"
MAINTAINER="$(sed '/^Maintainer:/!d;s/.*: //' $PACKAGE/meta/control)"
VERSION="$(sed '/^Version:/!d;s/.*: //' $PACKAGE/meta/control)"
TARBALL=${PACKAGE}_$VERSION.deb
