summaryrefslogtreecommitdiff
path: root/netcon/docker-test/zerotier-intercept
diff options
context:
space:
mode:
authorJoseph Henry <josephjah@gmail.com>2015-12-04 12:39:54 -0800
committerJoseph Henry <josephjah@gmail.com>2015-12-04 12:39:54 -0800
commitd9b12be697ed97e5a66c3912acc9a88d97f9ab8d (patch)
treeb2c4adbb8771c3dfb0516e0ba065272d3cfada97 /netcon/docker-test/zerotier-intercept
parent2196d982c374231e09f41d23cc32932391036ee8 (diff)
downloadinfinitytier-d9b12be697ed97e5a66c3912acc9a88d97f9ab8d.tar.gz
infinitytier-d9b12be697ed97e5a66c3912acc9a88d97f9ab8d.zip
ZT_NC_NWID patch + (WIP) test script modifications
Diffstat (limited to 'netcon/docker-test/zerotier-intercept')
-rwxr-xr-xnetcon/docker-test/zerotier-intercept54
1 files changed, 54 insertions, 0 deletions
diff --git a/netcon/docker-test/zerotier-intercept b/netcon/docker-test/zerotier-intercept
new file mode 100755
index 00000000..85e9fba1
--- /dev/null
+++ b/netcon/docker-test/zerotier-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/libzerotierintercept.so.1.0"
+ else
+ echo $LD_PRELOAD | grep -q "/lib/libzerotierintercept\.so.1.0" || \
+ export LD_PRELOAD="/lib/libzerotierintercept.so $LD_PRELOAD"
+ fi
+ ;;
+ off)
+ export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/lib\/libzerotierintercept.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/libzerotierintercept.so.1.0"
+ else
+ echo $LD_PRELOAD | grep -q "/lib/libzerotierintercept\.so.1.0" || \
+ export LD_PRELOAD="/lib/libzerotierintercept.so.1.0 $LD_PRELOAD"
+ fi
+
+ if [ $# = 0 ]
+ then
+ ${SHELL:-/bin/sh}
+ fi
+
+ if [ $# -gt 0 ]
+ then
+ exec "$@"
+ fi
+ ;;
+esac
+
+#EOF