diff options
| author | Joseph Henry <joseph.henry@zerotier.com> | 2015-10-09 15:41:16 -0400 |
|---|---|---|
| committer | Joseph Henry <joseph.henry@zerotier.com> | 2015-10-09 15:41:16 -0400 |
| commit | e3ec000e93f0eeb365633d36d1a9ce0b139c75b5 (patch) | |
| tree | fdb429cb7ad16c4038ab9e2e0af8d161f27e5f94 /netcon/intercept | |
| parent | 769bad332041fd707533c086dc0d2c2f4a57befe (diff) | |
| download | infinitytier-e3ec000e93f0eeb365633d36d1a9ce0b139c75b5.tar.gz infinitytier-e3ec000e93f0eeb365633d36d1a9ce0b139c75b5.zip | |
Added intercept build file and sources
Diffstat (limited to 'netcon/intercept')
| -rwxr-xr-x | netcon/intercept | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/netcon/intercept b/netcon/intercept new file mode 100755 index 00000000..3eb27ff7 --- /dev/null +++ b/netcon/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 |
