#!/bin/sh

PATH=/sbin:/usr/sbin:/bin:/usr/bin
NAME=ohiwhereami
DAEMON=${NAME}_bridge
# Read configuration variable file if it is present
. /etc/3d-p/$NAME/$NAME || exit 1

[ -n "${WHEREAMI_BRIDGE_PORT}" ] || {
    printf "%s" "Virtual port is required" >&2
    exit 1
}

[ -e ${WHEREAMI_BRIDGE_PORT} ] || {
    printf "%s" "Virtual port ${WHEREAMI_BRIDGE_PORT} does not exist" >&2
    exit 1
}

exec ohiwhereami_bridge -d ${WHEREAMI_BRIDGE_PORT} -p ${WHEREAMI_BRIDGE_SERVICE}
