#!/bin/sh
# @(#$Id: r3dsetup.sh,v 1.7 2004/04/02 15:31:34 ux_richel Exp $ (C) 2002 OKYZ

# Post-install setup for the r3d directory: 
# possibly create wrapper shell-scripts on some systems (none
# currently). Create cut-and-pastable lines for shell startup scripts.

OS=`uname`

fatal() {
    echo $1
    exit 1
}

test -f etc/r3drc || fatal "Must be executed in the r3d top directory"

r3ddir=`pwd`

R3DPROFILE=etc/r3dprofile
rm -f $R3DPROFILE
cat > $R3DPROFILE <<EOF
export R3D_HOME=$r3ddir

export PATH=\${R3D_HOME}/bin:\$PATH
export R3D_LOGLEVEL=2
export R3D_SNAPNOASK=y
#export R3D_LOGFILE=/var/tmp/r3dcaptrace
EOF
chmod 444 $R3DPROFILE

R3DCSHRC=etc/r3dcshrc
rm -f $R3DCSHRC
cat > $R3DCSHRC <<EOF
setenv R3D_HOME $r3ddir

set path=(\$R3D_HOME/bin \$path)
setenv R3D_LOGLEVEL 2
setenv R3D_SNAPNOASK y
#setenv R3D_LOGFILE /var/tmp/r3dcaptrace
EOF

chmod 444 $R3DCSHRC

# Change Pyramid.model path as a static reference in the wrl file inside
# share/r3dview/resources/OKYZ-N4DLC-datas.wrl

rp="`pwd`/share/r3dview/resources/"
cat share/r3dview/resources/OKYZ-N4DLC-datas.wrl-src | sed "s!@OKYZ_REPLACE_PYRA_DIRNAME@!$rp!" > share/r3dview/resources/OKYZ-N4DLC-datas.wrl
