aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-11-08 01:42:16 +0100
committerSven Gothel <[email protected]>2021-11-08 01:42:16 +0100
commita669ab16d8408ce0b309061df079faeb83d8b2c1 (patch)
treea43e4964ec9db559279cf6bac7f297665d20e240 /scripts
parent9eda67d440fb7f3aa0b2170e5c3394c5ceac390f (diff)
Add example: dbt_readsmpkey.cpp: Read SMPKeyBin files and dump them
Diffstat (limited to 'scripts')
l---------scripts/run-dbt_readsmpkey.sh1
-rwxr-xr-xscripts/run-java-example-simple.sh54
-rwxr-xr-xscripts/run-native-example-simple.sh65
3 files changed, 120 insertions, 0 deletions
diff --git a/scripts/run-dbt_readsmpkey.sh b/scripts/run-dbt_readsmpkey.sh
new file mode 120000
index 00000000..4ddbfb62
--- /dev/null
+++ b/scripts/run-dbt_readsmpkey.sh
@@ -0,0 +1 @@
+run-native-example-simple.sh \ No newline at end of file
diff --git a/scripts/run-java-example-simple.sh b/scripts/run-java-example-simple.sh
new file mode 100755
index 00000000..f261926c
--- /dev/null
+++ b/scripts/run-java-example-simple.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+script_args="$*"
+
+username=${USER}
+
+sdir=`dirname $(readlink -f $0)`
+rootdir=`dirname $sdir`
+bname=`basename $0 .sh`
+
+exename=`echo $bname | sed 's/^run-//g'`
+
+if [ ! -e lib/java/direct_bt.jar -o ! -e bin/java/${exename}.jar -o ! -e lib/libdirect_bt.so ] ; then
+ echo run from dist directory
+ exit 1
+fi
+
+logbasename=~/$bname
+logfile=$logbasename.log
+rm -f $logfile
+
+echo 'core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern 2>/dev/null
+ulimit -c unlimited
+
+# 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
+
+JAVA_EXE=`readlink -f $(which java)`
+# JAVA_CMD="${JAVA_EXE} -Xcheck:jni -verbose:jni"
+JAVA_CMD="${JAVA_EXE}"
+
+runit() {
+ #echo "script invocation: $0 ${script_args}"
+ #echo username $username
+ #echo ${exename} commandline $*
+ #echo EXE_WRAPPER $EXE_WRAPPER
+ #echo logfile $logfile
+ #echo direct_bt_debug $direct_bt_debug
+ #echo direct_bt_verbose $direct_bt_verbose
+
+ #echo $EXE_WRAPPER $JAVA_CMD -cp lib/java/direct_bt.jar:bin/java/${exename}.jar -Djava.library.path=`pwd`/lib ${exename} $*
+ # $EXE_WRAPPER $JAVA_CMD -cp lib/java/direct_bt.jar:bin/java/${exename}.jar -Djava.library.path=`pwd`/lib ${exename} $*
+ mkdir -p keys
+
+ ulimit -c unlimited
+ $EXE_WRAPPER $JAVA_CMD $JAVA_PROPS -cp lib/java/direct_bt.jar:bin/java/${exename}.jar -Djava.library.path=`pwd`/lib ${exename} $*
+ exit $?
+}
+
+runit $* 2>&1 | tee $logfile
+
diff --git a/scripts/run-native-example-simple.sh b/scripts/run-native-example-simple.sh
new file mode 100755
index 00000000..07d6ef28
--- /dev/null
+++ b/scripts/run-native-example-simple.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+# Script arguments in order:
+#
+# ... All subsequent arguments are passed to the Direct-BT example
+#
+# Assuming executing dbt_scanner10:
+#
+
+# Only reliable way, but Linux specific
+THIS_SHELL=`readlink /proc/$$/exe`
+#THIS_SHELL=`ps -hp $$ | awk '{ print $5 }'`
+if [ "$(basename ${THIS_SHELL})" != "bash" ]; then
+ echo "$0 must run in bash to preserve command-line quotes, not ${THIS_SHELL}"
+ exit 1
+fi
+
+script_args="$@"
+
+username=${USER}
+
+sdir=`dirname $(readlink -f $0)`
+rootdir=`dirname $sdir`
+bname=`basename $0 .sh`
+
+exename=`echo $bname | sed 's/^run-//g'`
+
+if [ ! -e bin/${exename} -o ! -e lib/libdirect_bt.so ] ; then
+ echo run from dist directory
+ exit 1
+fi
+
+logbasename=~/$bname
+logfile=$logbasename.log
+rm -f $logfile
+
+echo 'core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern >/dev/null
+ulimit -c unlimited
+
+# 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 keys
+ mkdir -p dbt_keys
+
+ exe_file=$(readlink -f bin/${exename})
+ ulimit -c unlimited
+ LD_LIBRARY_PATH=`pwd`/lib ${exe_file} "$@"
+ exit $?
+}
+
+runit "$@" 2>&1 | tee $logfile
+