#!/bin/sh
#
# Clear the SR database directory (Shape Recognition Module)

usage() {
    echo "megawave_clear_base (no options)"
    echo "input:  none"
    echo "effect: modify the base directory"
    echo "output: none"
}

if [ $# -ne 0 ]; then
    usage
    exit
fi

$TMP=/tmp/megawave-$USERNAME

if [ ! -d $TMP ]; then
    if mkdir $TMP; then
	echo "$TMP directory created."
    else
	echo "Could not create $TMP directory !"
	exit 1
    fi
fi	

if [ -z "$BASEDIR" ]; then
    BASEDIR=$TMP/sr_base
    echo "No base directory"
    echo "-> Setting default value $BASEDIR"
fi
if [ ! -d $BASEDIR ]; then
    if mkdir $BASEDIR; then
	echo "Base directory created."
    else
	echo "Could not create $BASEDIR directory !"
	exit 1
    fi
fi

rm -f $BASEDIR/*.crv $BASEDIR/references $BASEDIR/signature.fimg
