summaryrefslogtreecommitdiff
path: root/netcon/zerotier-intercept
diff options
context:
space:
mode:
authorJoseph Henry <josephjah@gmail.com>2015-11-20 01:08:38 -0800
committerJoseph Henry <josephjah@gmail.com>2015-11-20 01:08:38 -0800
commit1f27022fa75b71ce7da63ffa47b457622e74d6a1 (patch)
tree4c562cf1fc12d2fbd3691f01859882f196b3a910 /netcon/zerotier-intercept
parent9a25a627bba4a00465a3648b82fc89f61b980ed1 (diff)
downloadinfinitytier-1f27022fa75b71ce7da63ffa47b457622e74d6a1.tar.gz
infinitytier-1f27022fa75b71ce7da63ffa47b457622e74d6a1.zip
Test/Code Refactor in preparation for merge
Diffstat (limited to 'netcon/zerotier-intercept')
-rwxr-xr-xnetcon/zerotier-intercept54
1 files changed, 54 insertions, 0 deletions
diff --git a/netcon/zerotier-intercept b/netcon/zerotier-intercept
new file mode 100755
index 00000000..85e9fba1
--- /dev/null
+++ b/netcon/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