#!/bin/sh

abspath="/opt/ros/kinetic/bin"
cmd=`basename $0`

if [ -z "${OROCOS_TARGET}" ]; then
    possibilities=`echo $abspath/$cmd-*`
    if [ -z "$possibilities" -o ! -f "$possibilities" ]; then
        echo "You have not set the OROCOS_TARGET environment variable. I need it to know which target to run."
        echo "You can set it by doing for example: 'export OROCOS_TARGET=gnulinux' in your .bashrc"
        echo " or before you run this script."
        exit 1
    fi
    cmd=$possibilities
else
    cmd=$abspath/$cmd-${OROCOS_TARGET}
fi

exec ${OROCOS_LAUNCH_PREFIX} "$cmd" "$@"
