summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorrillig <rillig>2007-07-26 12:27:18 +0000
committerrillig <rillig>2007-07-26 12:27:18 +0000
commitd28fadf37c33af5fe818211af9215f9ab9256971 (patch)
treec07b9522987a4cd67571089bcc2a6be26a3b1b16 /net
parentab3073afeb43abbd8adc3619857df3c7a73bc1d7 (diff)
downloadpkgsrc-d28fadf37c33af5fe818211af9215f9ab9256971.tar.gz
Changed tsocks.sh so that it matches the man page. PKGREVISION++
Diffstat (limited to 'net')
-rw-r--r--net/tsocks/Makefile6
-rw-r--r--net/tsocks/files/tsocks.sh59
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