#!/bin/sh 
# --------------------------------------------------------------------------
# Copyright 1992 by Forschungszentrum Informatik (FZI)
#
# You can use and distribute this software under the terms of the license
# version 1 you should have received along with this software.
# If not or if you want additional information, write to
# Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
# D-76131 Karlsruhe, Germany.
# --------------------------------------------------------------------------
# 'obst-init - 06:03:91 - Dietmar Theobald'
#
# obst-init
#
# Cleans the container directory by removing all containers and
# running 'init'.
#
self='obst-init'
[ -n "$OBSTdir" ] || { OBSTdir="`cd \`dirname $0\`;pwd`/"; export OBSTdir; }

if [ -n "$OBSTCONTAINER" ] ; then
  cd $OBSTCONTAINER
elif [ -n "$SOSCONTAINER" ] ; then
  cd $SOSCONTAINER
else
  echo >&2 "*** $self: environment variable OBSTCONTAINER not defined"
  exit 1
fi

rm -f [0-9]* version

${OBSTdir}init

# create the $OBSTCONTAINER/version file if cfe is able to show its version
version="`${OBSTdir}cfe -v 2>&1`"

echo "$version" | grep -i -s version && echo "$version" > version

exit 0
