summaryrefslogtreecommitdiff
path: root/docker-test/intercept
diff options
context:
space:
mode:
authorJoseph Henry <josephjah@gmail.com>2015-11-19 16:21:59 -0800
committerJoseph Henry <josephjah@gmail.com>2015-11-19 16:21:59 -0800
commit31bc5e1559848db374d8d9dd039939c802d91649 (patch)
treeeb3f9ddb521f667ab5cffb4c584ad62014ef945a /docker-test/intercept
parentb1100b3d130598d73534c5e324e1a079364f6146 (diff)
downloadinfinitytier-31bc5e1559848db374d8d9dd039939c802d91649.tar.gz
infinitytier-31bc5e1559848db374d8d9dd039939c802d91649.zip
WIP: Unit tests
Diffstat (limited to 'docker-test/intercept')
-rwxr-xr-xdocker-test/intercept54
1 files changed, 54 insertions, 0 deletions
diff --git a/docker-test/intercept b/docker-test/intercept
new file mode 100755
index 00000000..3eb27ff7
--- /dev/null
+++ b/docker-test/intercept
@@ -0,0 +1,54 @@
+#!/bin/sh
+# usage:
+# /usr/bin/intercept program <args>
+
+if [ $# = 0 ] ; then
+ echo "$0: insufficient arguments"
+ exit
+fi
+
+case "$1" in
+ on)
+ if [ -z "$LD_PRELOAD" ]
+ then
+ export LD_PRELOAD="/lib/libintercept.so.1.0"
+ else
+ echo $LD_PRELOAD | grep -q "/lib/libintercept\.so.1.0" || \
+ export LD_PRELOAD="/lib/libintercept.so $LD_PRELOAD"
+ fi
+ ;;
+ off)
+ export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/lib\/libintercept.so.1.0 \?//'`
+ if [ -z "$LD_PRELOAD" ]
+ then
+ unset LD_PRELOAD
+ fi
+ ;;
+ show|sh)
+ echo "LD_PRELOAD=\"$LD_PRELOAD\""
+ ;;
+ -h|-?)
+ echo ""
+ ;;
+ *)
+ if [ -z "$LD_PRELOAD" ]
+ then
+ export LD_PRELOAD="/lib/libintercept.so.1.0"
+ else
+ echo $LD_PRELOAD | grep -q "/lib/libintercept\.so.1.0" || \
+ export LD_PRELOAD="/lib/libintercept.so.1.0 $LD_PRELOAD"
+ fi
+
+ if [ $# = 0 ]
+ then
+ ${SHELL:-/bin/sh}
+ fi
+
+ if [ $# -gt 0 ]
+ then
+ exec "$@"
+ fi
+ ;;
+esac
+
+#EOF