From 1a1b28abdbce06d39cf2b86fd4f8be4142a67fd9 Mon Sep 17 00:00:00 2001 From: Marcus Alves Grando Date: Fri, 17 Feb 2006 22:21:25 +0000 Subject: [PATCH] - Update to 0.1.1.13 - Correct way to use USE_RC_SUBR - Update MAINTAINER email PR: 93314 Submitted by: maintainer --- security/tor-devel/Makefile | 20 ++--- security/tor-devel/distinfo | 6 +- .../tor-devel/files/patch-contrib-tor.sh.in | 85 ------------------- .../tor-devel/files/patch-contrib-torctl.in | 39 --------- security/tor-devel/files/pkg-message.in | 6 ++ security/tor-devel/files/tor.in | 45 ++++++++++ security/tor-devel/pkg-deinstall | 62 ++++++++++++++ security/tor-devel/pkg-descr | 2 - security/tor-devel/pkg-install | 69 ++++++++------- security/tor-devel/pkg-message | 7 -- security/tor-devel/pkg-plist | 2 - 11 files changed, 163 insertions(+), 180 deletions(-) delete mode 100644 security/tor-devel/files/patch-contrib-tor.sh.in delete mode 100644 security/tor-devel/files/patch-contrib-torctl.in create mode 100644 security/tor-devel/files/pkg-message.in create mode 100644 security/tor-devel/files/tor.in create mode 100644 security/tor-devel/pkg-deinstall delete mode 100644 security/tor-devel/pkg-message diff --git a/security/tor-devel/Makefile b/security/tor-devel/Makefile index f1cf39682723..e57f6d53f41f 100644 --- a/security/tor-devel/Makefile +++ b/security/tor-devel/Makefile @@ -1,18 +1,18 @@ # ports collection makefile for: tor-devel # Date created: 2005.10.20 -# Whom: eol1@yahoo.com +# Whom: peter.thoenen@yahoo.com # # $FreeBSD$ # PORTNAME= tor -PORTVERSION= 0.1.1.12 +PORTVERSION= 0.1.1.13 CATEGORIES= security net MASTER_SITES= http://tor.eff.org/dist/ PKGNAMESUFFIX= -devel DISTNAME= ${PORTNAME}-${PORTVERSION}-alpha -MAINTAINER= eol1@yahoo.com +MAINTAINER= peter.thoenen@yahoo.com COMMENT= An anonymizing overlay network for TCP RUN_DEPENDS= tsocks:${PORTSDIR}/net/tsocks @@ -20,8 +20,10 @@ LIB_DEPENDS= event-1.1a:${PORTSDIR}/devel/libevent GNU_CONFIGURE= yes USE_OPENSSL= yes -USE_REINPLACE= yes -USE_RC_SUBR= yes + +USE_RC_SUBR= tor +SUB_FILES= pkg-message +PKG_MESSAGE= ${WRKSRC}/pkg-message CONFLICTS= tor-[0-9]* @@ -33,19 +35,16 @@ post-patch: ${WRKSRC}/contrib/tor-tsocks.conf.sample @${REINPLACE_CMD} -e "s|tor-tsocks.conf|tor-tsocks.conf.sample|g" \ ${WRKSRC}/contrib/Makefile.in - @${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" \ - ${WRKSRC}/contrib/torctl.in @${FIND} ${WRKSRC} -type f | ${XARGS} \ -n 10 ${REINPLACE_CMD} -E \ -e 's!-g -O2!!' \ -e 's!-O2!!' pre-install: - PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL + @${SETENV} PKG_PREFIX=${PREFIX} ${SH} \ + ${PKGINSTALL} ${PKGNAME} PRE-INSTALL post-install: - ${INSTALL_SCRIPT} ${WRKSRC}/contrib/tor.sh ${PREFIX}/etc/rc.d/tor.sh - ${INSTALL_SCRIPT} ${WRKSRC}/contrib/torctl ${PREFIX}/bin/torctl @${MKDIR} /var/run/tor @${CHOWN} _tor:_tor /var/run/tor @${TOUCH} /var/log/tor @@ -54,4 +53,5 @@ post-install: @${MKDIR} /var/db/tor/data @${CHOWN} -R _tor:_tor /var/db/tor @${CAT} ${PKGMESSAGE} + .include diff --git a/security/tor-devel/distinfo b/security/tor-devel/distinfo index 8616dbcd899c..a0681c38a81f 100644 --- a/security/tor-devel/distinfo +++ b/security/tor-devel/distinfo @@ -1,3 +1,3 @@ -MD5 (tor-0.1.1.12-alpha.tar.gz) = 64439b11f18462bc0a9599940899240e -SHA256 (tor-0.1.1.12-alpha.tar.gz) = 125bfd5b3f6979ee02dca0fa8372f80bbf6e4907a569e890105fe3405dc03a95 -SIZE (tor-0.1.1.12-alpha.tar.gz) = 751711 +MD5 (tor-0.1.1.13-alpha.tar.gz) = 5cdf6c5ed20efd7048ee1257cbcc1b4e +SHA256 (tor-0.1.1.13-alpha.tar.gz) = cb15a83ed8ad87d67c0685b20a41096c32211f20ae321f39ed110d7ace38e29f +SIZE (tor-0.1.1.13-alpha.tar.gz) = 756583 diff --git a/security/tor-devel/files/patch-contrib-tor.sh.in b/security/tor-devel/files/patch-contrib-tor.sh.in deleted file mode 100644 index e9cdbdb472e5..000000000000 --- a/security/tor-devel/files/patch-contrib-tor.sh.in +++ /dev/null @@ -1,85 +0,0 @@ ---- contrib/tor.sh.in.orig Mon Dec 26 04:28:12 2005 -+++ contrib/tor.sh.in Thu Jan 12 06:25:02 2006 -@@ -9,26 +9,26 @@ - # This particular script is written for Red Hat/Fedora Linux, and may - # also work on Mandrake, but not SuSE. - # --# These next couple of lines "declare" tor for the "chkconfig" program, --# originally from SGI, used on Red Hat/Fedora and probably elsewhere. --# --# chkconfig: 2345 90 10 - # description: Onion Router - A low-latency anonymous proxy - # -+# -+# Add some of the following variables to /etc/rc.conf to configure stunnel: -+# tor_enable (bool): Default "NO" -+# Set it to "YES" to enable stunnel. -+# tor_user (str): Default "_tor" -+# Set it to the tor user -+# tor_group (str): Default "_tor" -+# Set it to the tor group -+# - --# Library functions --if [ -f /etc/rc.d/init.d/functions ]; then -- . /etc/rc.d/init.d/functions --elif [ -f /etc/init.d/functions ]; then -- . /etc/init.d/functions --fi -+tor_enable=${tor_enable-"NO"} - --TORCTL=@BINDIR@/torctl -+TORCTL=%%PREFIX%%/bin/torctl - - # torctl will use these environment variables --TORUSER=@TORUSER@ -+TORUSER=${tor_user-"_tor"} - export TORUSER --TORGROUP=@TORGROUP@ -+TORGROUP=${tor_group-"_tor"} - export TORGROUP - - if [ -x /bin/su ] ; then -@@ -46,28 +46,32 @@ - case "$1" in - - start) -- action $"Starting tor:" $TORCTL start -- RETVAL=$? -+ echo "Starting tor:" -+ $TORCTL start -+ RETVAL=$? - ;; - - stop) -- action $"Stopping tor:" $TORCTL stop -- RETVAL=$? -+ echo "Stopping tor:" -+ $TORCTL stop -+ RETVAL=$? - ;; - - restart) -- action $"Restarting tor:" $TORCTL restart -- RETVAL=$? -+ echo "Restarting tor:" -+ $TORCTL restart -+ RETVAL=$? - ;; - - reload) -- action $"Reloading tor:" $TORCTL reload -- RETVAL=$? -+ echo "Reloading tor:" -+ $TORCTL reload -+ RETVAL=$? - ;; - - status) -- $TORCTL status -- RETVAL=$? -+ $TORCTL status -+ RETVAL=$? - ;; - - *) diff --git a/security/tor-devel/files/patch-contrib-torctl.in b/security/tor-devel/files/patch-contrib-torctl.in deleted file mode 100644 index b305980d0a2c..000000000000 --- a/security/tor-devel/files/patch-contrib-torctl.in +++ /dev/null @@ -1,39 +0,0 @@ ---- contrib/torctl.in.orig Mon Dec 26 04:28:12 2005 -+++ contrib/torctl.in Fri Jan 13 09:12:42 2006 -@@ -24,20 +24,20 @@ - EXEC=tor - # - # the path to your binary, including options if necessary --TORBIN="@BINDIR@/$EXEC" -+TORBIN="/usr/local/bin/$EXEC" - # - # the path to the configuration file --TORCONF="@CONFDIR@/torrc" -+TORCONF="/usr/local/etc/tor/torrc" - # - # the path to your PID file --PIDFILE="@LOCALSTATEDIR@/run/tor/tor.pid" -+PIDFILE="/var/run/tor/tor.pid" - # - # The path to the log file --LOGFILE="@LOCALSTATEDIR@/log/tor/tor.log" -+LOGFILE="/var/log/tor" - # - # The path to the datadirectory --TORDATA="@LOCALSTATEDIR@/lib/tor" - # -+TORDATA="/var/db/tor/data" - TORARGS="--pidfile $PIDFILE --log \"notice file $LOGFILE\" --runasdaemon 1" - TORARGS="$TORARGS --datadirectory $TORDATA" - -@@ -47,8 +47,8 @@ - # let an unprivileged user run tor for her own use using this script, - # while still providing for it to be used as a system daemon. - if [ "x`id -u`" = "x0" ]; then -- TORUSER=@TORUSER@ -- TORGROUP=@TORGROUP@ -+ TORUSER="_tor" -+ TORGROUP="_tor" - fi - - if [ "x$TORUSER" != "x" ]; then diff --git a/security/tor-devel/files/pkg-message.in b/security/tor-devel/files/pkg-message.in new file mode 100644 index 000000000000..379e6e2227d4 --- /dev/null +++ b/security/tor-devel/files/pkg-message.in @@ -0,0 +1,6 @@ +===================================================================================== + +To enable the tor server, set tor_enable="YES" in your /etc/rc.conf +and edit %%PREFIX%%/etc/tor/torrc + +===================================================================================== diff --git a/security/tor-devel/files/tor.in b/security/tor-devel/files/tor.in new file mode 100644 index 000000000000..3840408ddb36 --- /dev/null +++ b/security/tor-devel/files/tor.in @@ -0,0 +1,45 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# REQUIRE: NETWORKING SERVERS USR +# BEFORE: LOGIN +# +# Add the following lines to /etc/rc.conf to enable tor +# +# tor_enable (bool): Set to "NO" by default +# Set it to "YES" to enable tor +# tor_conf (str): Points to your tor conf file +# Default: %%PREFIX%%/etc/tor/torrc +# tor_user (str): Tor Daemon user. Default _tor +# tor_groupr (str): Tor Daemon group. Default _tor +# + +. %%RC_SUBR%% + +name="tor" +rcvar=${name}_enable + +load_rc_config ${name} + +: ${tor_enable="NO"} +: ${tor_conf="%%PREFIX%%/etc/tor/torrc"} +: ${tor_user="_tor"} +: ${tor_group="_tor"} +: ${tor_pidfile="/var/run/tor/tor.pid"} +: ${tor_logfile="/var/log/tor"} +: ${tor_datadir="/var/run/tor"} + +required_files=${tor_conf} +required_dirs=${tor_datadir} +command="%%PREFIX%%/bin/${name}" +command_args="-f ${tor_conf} --pidfile ${tor_pidfile} --runasdaemon 1 --datadirectory ${tor_datadir} --user ${tor_user} --group ${tor_group}" +extra_commands="log" +log_cmd="${name}_log" + +tor_log() { + cat ${tor_logfile} +} + +run_rc_command "$1" + diff --git a/security/tor-devel/pkg-deinstall b/security/tor-devel/pkg-deinstall new file mode 100644 index 000000000000..dc7222645375 --- /dev/null +++ b/security/tor-devel/pkg-deinstall @@ -0,0 +1,62 @@ +#! /bin/sh +# +# taken from net/cvsup-mirror + +PATH=/bin:/usr/sbin + +TOR_USER=${TOR_USER:-_tor} +TOR_GROUP=${TOR_GROUP:-_tor} + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ x${answer} = x ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local dflt question answer + + question=$1 + dflt=$2 + while :; do + answer=$(ask "${question}" "${dflt}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +delete_account() { + local u g home + + u=$1 + g=$2 + if yesno "Do you want me to remove group \"${g}\"" y; then + pw groupdel -n ${g} + echo "Done." + fi + if yesno "Do you want me to remove user \"${u}\"" y; then + eval home=~${u} + pw userdel -n ${u} + echo "Done." + if [ -d "${home}" ]; then + echo "Please remember to remove the home directory \"${home}\"" + fi + fi +} + +if [ x$2 != xDEINSTALL ]; then + exit +fi + +delete_account ${TOR_USER} ${TOR_GROUP} diff --git a/security/tor-devel/pkg-descr b/security/tor-devel/pkg-descr index 459d213bead8..72a692937021 100644 --- a/security/tor-devel/pkg-descr +++ b/security/tor-devel/pkg-descr @@ -14,5 +14,3 @@ Remember that this is development code -- DON'T RELY ON THE CURRENT TOR NETWORK FOR ANONYMITY! WWW: http://tor.eff.org/ -- rik -freebsd-ports@rikrose.net diff --git a/security/tor-devel/pkg-install b/security/tor-devel/pkg-install index fbbea4b722f0..8480c6988675 100644 --- a/security/tor-devel/pkg-install +++ b/security/tor-devel/pkg-install @@ -1,35 +1,40 @@ -#!/bin/sh +#! /bin/sh +# +# taken from devel/perforce -if [ x"$2" = xPRE-INSTALL ]; then - USER="_tor" - UID="256" - GROUP="_tor" - GID="256" +PATH=/bin:/usr/sbin - if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then - echo "You already have a group \"${GROUP}\", so I will use it." - else - if /usr/sbin/pw groupadd ${GROUP} -g ${GID}; then - echo "Added group \"${GROUP}\"." - else - echo "Adding group \"${GROUP}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi +TOR_USER=${TOR_USER:-_tor} +TOR_GROUP=${TOR_GROUP:-_tor} - if /usr/sbin/pw user show "${USER}" 2>/dev/null; then - echo "You already have a user \"${USER}\", so I will use it." - else - if /usr/sbin/pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ - -d /var/db/tor \ - -s /bin/sh \ - -c "Tor anonymising router"; then - echo "Added user \"${USER}\"." - else - echo "Adding user \"${USER}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi -fi +case $2 in +PRE-INSTALL) + USER=${TOR_USER} + GROUP=${TOR_GROUP} + + if pw group show "${GROUP}" 2>/dev/null; then + echo "You already have a group \"${GROUP}\", so I will use it." + else + if pw groupadd ${GROUP} ; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi + fi + + if pw user show "${USER}" 2>/dev/null; then + echo "You already have a user \"${USER}\", so I will use it." + else + if pw useradd ${USER} -g ${GROUP} -h - \ + -d /nonexistent -c "Tor Daemon" -s /bin/sh + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi + fi + + ;; +esac diff --git a/security/tor-devel/pkg-message b/security/tor-devel/pkg-message deleted file mode 100644 index fc1729eb4ad2..000000000000 --- a/security/tor-devel/pkg-message +++ /dev/null @@ -1,7 +0,0 @@ - -*********************** WARNING! WARNING! WARNING! *********************** -The tor startup script has been converted to rc_subr format now. You -have to set at least the tor_enable variable if you want tor to be started -automatically at boot time! -************************************************************************** - diff --git a/security/tor-devel/pkg-plist b/security/tor-devel/pkg-plist index 62748b9e9712..6dac940cc517 100644 --- a/security/tor-devel/pkg-plist +++ b/security/tor-devel/pkg-plist @@ -1,8 +1,6 @@ bin/tor bin/tor-resolve -bin/torctl bin/torify -etc/rc.d/tor.sh etc/tor/tor-tsocks.conf.sample etc/tor/torrc.sample @dirrm etc/tor