12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #! /bin/sh
- compat() {
- echo "torify is now just a wrapper around torsocks(1) for backwards compatibility."
- }
- usage() {
- compat
- echo "Usage: $0 [-hv] <command> [<options>...]"
- }
- case $# in 0)
- usage >&2
- exit 1
- esac
- case $# in 1)
- case $1 in -h|--help)
- usage
- exit 0
- esac
- esac
- case $1 in -v|--verbose)
- compat >&2
- shift
- esac
- pathfind() {
- OLDIFS="$IFS"
- IFS=:
- for p in $PATH; do
- if [ -x "$p/$*" ]; then
- IFS="$OLDIFS"
- return 0
- fi
- done
- IFS="$OLDIFS"
- return 1
- }
- if pathfind torsocks; then
- exec torsocks "$@"
- echo "$0: Failed to exec torsocks $@" >&2
- exit 1
- else
- echo "$0: torsocks not found in your PATH. Perhaps it isn't installed? (tsocks is no longer supported, for security reasons.)" >&2
- fi
|