diff options
author | rillig <rillig@pkgsrc.org> | 2007-07-26 12:27:18 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2007-07-26 12:27:18 +0000 |
commit | f73ddfc6893d4d59333643d82ba1da85a80f830b (patch) | |
tree | c07b9522987a4cd67571089bcc2a6be26a3b1b16 /net/tsocks | |
parent | 1b8a4975f65accfe472d0a82962259b8391a845a (diff) | |
download | pkgsrc-f73ddfc6893d4d59333643d82ba1da85a80f830b.tar.gz |
Changed tsocks.sh so that it matches the man page. PKGREVISION++
Diffstat (limited to 'net/tsocks')
-rw-r--r-- | net/tsocks/Makefile | 6 | ||||
-rw-r--r-- | net/tsocks/files/tsocks.sh | 59 |
2 files changed, 56 insertions, 9 deletions
diff --git a/net/tsocks/Makefile b/net/tsocks/Makefile index 2b98ffcfabf..5d04a0815be 100644 --- a/net/tsocks/Makefile +++ b/net/tsocks/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.11 2006/09/17 11:45:04 jmmv Exp $ +# $NetBSD: Makefile,v 1.12 2007/07/26 12:27:18 rillig Exp $ # DISTNAME= tsocks-1.8beta5 -PKGREVISION= 2 +PKGREVISION= 3 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=tsocks/} @@ -29,8 +29,6 @@ post-extract: ${RM} -f ${WRKSRC}/config.cache ${CP} ${FILESDIR}/tsocks.sh ${WRKSRC}/tsocks -post-configure: subst-tsocks - post-install: ${INSTALL_SCRIPT} ${WRKSRC}/tsocks ${PREFIX}/bin ${INSTALL_DATA_DIR} ${EGDIR} diff --git a/net/tsocks/files/tsocks.sh b/net/tsocks/files/tsocks.sh index 448860e2191..3d67e80f541 100644 --- a/net/tsocks/files/tsocks.sh +++ b/net/tsocks/files/tsocks.sh @@ -1,9 +1,58 @@ -#!@SH@ +#! @SH@ + +libtsocks="@PREFIX@/lib/libtsocks.so" + +usage() { + echo "usage:" + echo " $0 [program [arguments...]]" + echo " . $0 on" + echo " . $0 off" +} + +tsocks_on() { + case $LD_PRELOAD in + *"$libtsocks"*) + ;; + "") LD_PRELOAD="$libtsocks" + ;; + *) LD_PRELOAD="$LD_PRELOAD $libtsocks" + ;; + esac + export LD_PRELOAD +} + +tsocks_off() { + LD_PRELOAD=`echo $LD_PRELOAD | sed 's,$libtsocks[ :]?,,'` + if [ "$LD_PRELOAD" ]; then + export LD_PRELOAD + else + unset LD_PRELOAD + fi +} if [ $# -eq 0 ]; then - echo "usage: `basename $0` command" 1>&2 - exit 1 + set -- ${SHELL:-/bin/sh} fi -LD_PRELOAD="@PREFIX@/lib/libtsocks.so"; export LD_PRELOAD -exec $* +case "$1" in +on) + tsocks_on + ;; +off) + tsocks_off + ;; + +show | sh) + echo "LD_PRELOAD=\"$LD_PRELOAD\"" + ;; +-h | -?) + usage + ;; +-*) usage 1>&2 + exit 1 + ;; +*) + tsocks_on + exec "$@" + ;; +esac |