|
@@ -1,33 +1,45 @@
|
|
#! /bin/sh
|
|
#! /bin/sh
|
|
|
|
+
|
|
# Wrapper script for use of the tsocks(8) transparent socksification library
|
|
# Wrapper script for use of the tsocks(8) transparent socksification library
|
|
# See the tsocks(1) and torify(1) manpages.
|
|
# See the tsocks(1) and torify(1) manpages.
|
|
|
|
+
|
|
|
|
+# Copyright (c) 2004, 2006 Peter Palfrader
|
|
# Modified by Jacob Appelbaum <jacob@appelbaum.net> April 16th 2006
|
|
# Modified by Jacob Appelbaum <jacob@appelbaum.net> April 16th 2006
|
|
|
|
+# May be distributed under the same terms as Tor itself
|
|
|
|
+
|
|
|
|
|
|
# Define and ensure we have tsocks
|
|
# Define and ensure we have tsocks
|
|
-TSOCKS=`which tsocks`;
|
|
+# XXX: what if we don't have which?
|
|
-if [ ! -x $TSOCKS ];
|
|
+TSOCKS="`which tsocks`"
|
|
|
|
+if [ ! -x "$TSOCKS" ]
|
|
then
|
|
then
|
|
- echo "Can't find tsocks in PATH. Perhaps you haven't installed it?";
|
|
+ echo "$0: Can't find tsocks in PATH. Perhaps you haven't installed it?" >&2
|
|
- exit 1;
|
|
+ exit 1
|
|
fi
|
|
fi
|
|
|
|
|
|
# Check for any argument list
|
|
# Check for any argument list
|
|
-if [ -z $1 ];
|
|
+if [ "$#" = 0 ]
|
|
then
|
|
then
|
|
- echo "Usage: $0 <application> <arguments>";
|
|
+ echo "Usage: $0 <command> [<options>...]" >&2
|
|
- exit 1;
|
|
+ exit 1
|
|
|
|
+fi
|
|
|
|
+if [ "$#" = 1 ] && ( [ "$1" = "-h" ] || [ "$1" = "--help" ] )
|
|
|
|
+then
|
|
|
|
+ echo "Usage: $0 <command> [<options>...]"
|
|
|
|
+ exit 0
|
|
fi
|
|
fi
|
|
|
|
|
|
# Define our tsocks config file
|
|
# Define our tsocks config file
|
|
-TSOCKS_CONF_FILE=@CONFDIR@/tor-tsocks.conf
|
|
+TSOCKS_CONF_FILE="@CONFDIR@/tor-tsocks.conf"
|
|
export TSOCKS_CONF_FILE
|
|
export TSOCKS_CONF_FILE
|
|
|
|
|
|
# Check that we've got a tsocks config file
|
|
# Check that we've got a tsocks config file
|
|
-if [ -r $TSOCKS_CONF_FILE ];
|
|
+if [ -r "$TSOCKS_CONF_FILE" ]
|
|
then
|
|
then
|
|
exec tsocks "$@"
|
|
exec tsocks "$@"
|
|
|
|
+ echo "$0: Failed to exec tsocks $@" >&2
|
|
|
|
+ exit 1
|
|
else
|
|
else
|
|
- echo "Error: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\".";
|
|
+ echo "$0: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\"." >&2
|
|
- exit 1;
|
|
+ exit 1
|
|
fi
|
|
fi
|
|
-
|
|
|