#!/bin/sh

[ -h "$0" ] && ORIGIN=`ls -l "$0" | sed "s/.*-> //g"` || ORIGIN="$0"
ORIGIN=`(cd "\`dirname \"$ORIGIN\"\`"; pwd -P 2>/dev/null || pwd)`

TLCLIENT_PREFIX=`(cd "${ORIGIN}"; cd ..; pwd)`
export TLCLIENT_PREFIX

if [ "${BASH_VERSION}" ]; then
    shopt -s execfail
fi
mkdir -p /wfs/user/.thinlinc /userhome/.thinlinc
ln -sf /wfs/user/.thinlinc/known_hosts /userhome/.thinlinc
ln -sf /wfs/user/.thinlinc/tlclient.conf /userhome/.thinlinc
exec "${ORIGIN}/../lib/tlclient/tlclient.bin" "$@"
echo The execution of the ThinLinc client failed. A common reason for
echo this is that you are using the wrong architecture. Perhaps you
echo are running a 32 bit client on a 64 bit system without support
echo for 32 bit applications?
