pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/tsocks Changed tsocks.sh so that it matches the ma...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bdc844a6a193
branches:  trunk
changeset: 531252:bdc844a6a193
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Jul 26 12:27:18 2007 +0000

description:
Changed tsocks.sh so that it matches the man page. PKGREVISION++

diffstat:

 net/tsocks/Makefile        |   6 +---
 net/tsocks/files/tsocks.sh |  59 ++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 56 insertions(+), 9 deletions(-)

diffs (90 lines):

diff -r 8719a5a09246 -r bdc844a6a193 net/tsocks/Makefile
--- a/net/tsocks/Makefile       Thu Jul 26 12:24:52 2007 +0000
+++ b/net/tsocks/Makefile       Thu Jul 26 12:27:18 2007 +0000
@@ -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 @@
        ${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 -r 8719a5a09246 -r bdc844a6a193 net/tsocks/files/tsocks.sh
--- a/net/tsocks/files/tsocks.sh        Thu Jul 26 12:24:52 2007 +0000
+++ b/net/tsocks/files/tsocks.sh        Thu Jul 26 12:27:18 2007 +0000
@@ -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



Home | Main Index | Thread Index | Old Index