aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/run-native-example-simple.sh
blob: 3fa51ff2bacdd08bb9c986705dd411af9ecca327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash

# Script arguments in order:
#
# ...               All subsequent arguments are passed to the Direct-BT example
#
# Assuming executing dbt_scanner10:
#

script_args="$@"

username=${USER}

sdir=`dirname $(readlink -f $0)`
rootdir=`dirname $sdir`
bname=`basename $0 .sh`

. $rootdir/jaulib/scripts/setup-machine-arch.sh "-quiet"

dist_dir=$rootdir/"dist-$os_name-$archabi"
build_dir=$rootdir/"build-$os_name-$archabi"
echo dist_dir $dist_dir
echo build_dir $build_dir

if [ ! -e $dist_dir/bin/$bname ] ; then
    echo "Not existing $dist_dir/bin/$bname"
    exit 1
fi

if [ ! -e $dist_dir/lib/libdirect_bt.so ] ; then
    echo "Not existing $dist_dir/lib/libdirect_bt.so"
    exit 1
fi

if [ "$1" = "-log" ] ; then
    logbasename=$2
    shift 2
else
    logbasename=$bname-$os_name-$archabi
fi

mkdir -p $rootdir/doc/test
logfile=$rootdir/doc/test/$logbasename.0.log
rm -f $logfile

# run as root 'dpkg-reconfigure locales' enable 'en_US.UTF-8'
# perhaps run as root 'update-locale LC_MEASUREMENT=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8'
export LC_MEASUREMENT=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

runit() {
    #echo "script invocation: $0 ${script_args}"
    #echo exename $exename
    #echo username $username
    #echo ${exename} commandline "$@"
    #echo direct_bt_debug $direct_bt_debug
    #echo direct_bt_verbose $direct_bt_verbose
    #
    #echo LD_LIBRARY_PATH=`pwd`/lib bin/${exename} "$@"
    mkdir -p client_keys
    mkdir -p server_keys

    ulimit -c unlimited
    LD_LIBRARY_PATH=$dist_dir/lib $dist_dir/bin/${bname} "$@"
    exit $?
}

runit "$@" 2>&1 | tee $logfile