#!/bin/sh
#

curdir=`pwd`
cd /brunie

uci="$1"

export gtm_dist="/usr/gtm"
export gtmgbldir="$uci"
export gtmroutines="/usr/gtm"

if ! $gtm_dist/mupip rundown -f $uci.dat &>/dev/null ; then
	echo "  - $uci ist zur Zeit in Benutzung!"
	cd $curdir
	exit
fi
if ! $gtm_dist/mupip rundown -f $uci.tmp &>/dev/null ; then
	echo "  - $uci ist zur Zeit in Benutzung!"
	cd $curdir
	exit
fi

echo -e "  - $uci wird gelscht... \c"
rm -f -r -d $uci &>/dev/null
rm -f -r $uci.dat  &>/dev/null
rm -f -r $uci.tmp  &>/dev/null
rm -f -r $uci.gld  &>/dev/null
echo "Okay!"

cd $curdir
