#!/bin/sh

# Install a copy of KNOWN_SERVER somewhere so that other users can use KNOWN_SERVER.

if [ "$KNOWN_HOME" = "" ]; then
    echo "KNOWN_HOME must be set."
    exit 2
fi

# bin
if [ ! -d "orb40/src/panst" ]; then
    echo "Can't find orb40/src/panst in the current directory"
    exit 1;
fi

# lib
if [ ! -d "orb40/lib" ]; then
    echo "Can't find orb40/lib in the current directory"
    exit 1;
fi

# static_macro
# Pay attention to trailing / here; see rsync docs
if [ ! -d "macros/static_macro" ]; then
    echo "Can't find macros/static_macro in the current directory"
    exit 1;
fi

# options_static
if [ ! -d "macros/options_static" ]; then
    echo "Can't find macros/options_static directory"
    exit 1;
fi

rsync -avx --exclude=.svn orb40/src/panst/*.x $KNOWN_HOME/bin
rsync -avx --exclude=.svn orb40/lib/ $KNOWN_HOME/lib
rsync -avx --exclude=.svn macros/static_macro/ $KNOWN_HOME/static_macro
rsync -avx --exclude=.svn macros/options_static/ $KNOWN_HOME/options_static
