#!/bin/sh

echo -n "Checking the Octave version... "

dep=$(grep Depends DESCRIPTION	\
      | perl -ne 'if (/octave\s+\(>=\s*([.\d]+)\)/i) {print $1}')

if [ "$dep" != "" ] ; then
    if dpkg --compare-versions "$version" lt "$dep" ; then
        echo ;
        echo "Octave version mismatch: "		\
             "Needs >= $dep, but version "		\
             "$version is installed" 1>&2 ;
        exit 1
    fi
fi

echo ok
