#!/bin/sh
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo  --- license GNU GPL 
# stta: (@#) 1.31051043346- [2004_01_29_102036]

STTA_TOOLSDIR="/opt/tarantella/tools"
[ -x $STTA_TOOLSDIR/setenv_vars ] &&  . $STTA_TOOLSDIR/setenv_vars

is_STTA=true;

RenameOrg() {
    if [ "$#" -eq 0 ] ; then 
             echo $N "$msg_orgname $C" 
             read ouname
    else 
             ouname=`echo $* | sed 's/o=//g' 2>$dn` 
    fi    
    outcmd=`$TTACMD object rename  --name o=organization  --newname o="$ouname" ` 
    [ -n $outcmd ] && echo "$outcmd"  
}

CreateDefaultDB(){
    echo "$msg_dbcreate $msg_default ..."

    INSTDIR=$TTAINSTDIR ; export INSTDIR
    TTAINSTSCRIPTS=$TTAINSTDIR/bin/scripts/install_scripts
    cd $TTAINSTSCRIPTS

        for dir in vendor */vendor; do
        (
            cd $dir
            # script names are <vendor>/<product>/<vendor>.defaults
            # (example: SCO/Tarantella/SCO.defaults)
            for DefaultsScript in */*/*.defaults; do
                sh $xflag $DefaultsScript >>$INSTDIR/var/log/setup.log 2>&1
            done
        )
        done
}

$TTA_ForceSTOP
echo "$msg_dbdelete ..."
rm -r $TTAINSTDIR/var/ens 
CreateDefaultDB
$TTA_START

RenameOrg $*
