mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-23 23:02:23 +00:00
55 lines
926 B
Plaintext
55 lines
926 B
Plaintext
|
#!/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
|