/[gentoo-x86]/net-misc/tor/tor-0.1.0.18.ebuild
Gentoo

Contents of /net-misc/tor/tor-0.1.0.18.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download)
Thu May 31 09:50:14 2007 UTC (7 years, 2 months ago) by humpback
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +1 -1 lines
FILE REMOVED
bumped, fixed bug and cleaned older versions
(Portage version: 2.1.2.7)

1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-misc/tor/tor-0.1.0.18.ebuild,v 1.10 2007/05/15 16:08:36 humpback Exp $
4
5 inherit eutils flag-o-matic
6
7 DESCRIPTION="The Onion Router - Anonymizing overlay network for TCP"
8 HOMEPAGE="http://tor.eff.org/"
9 SRC_URI="http://tor.eff.org/dist/${P}.tar.gz"
10
11 LICENSE="BSD"
12 SLOT="0"
13 ## Arch temas please please dont mark this stable untill you really test the
14 ## chroot stuff
15 KEYWORDS="amd64 ppc ppc64 sparc x86"
16 IUSE="static"
17
18 DEPEND=">=dev-libs/openssl-0.9.6
19 dev-libs/libevent"
20 RDEPEND="!static? (
21 net-proxy/tsocks
22 >=dev-libs/openssl-0.9.6
23 dev-libs/libevent
24 )"
25
26 pkg_setup() {
27 enewgroup tor
28 enewuser tor -1 -1 /var/lib/tor tor
29 }
30
31 src_unpack() {
32 unpack ${A}
33 cd ${S}
34 epatch ${FILESDIR}/torrc.sample-0.1.0.16.patch
35 }
36
37 src_compile() {
38 use static && append-ldflags -static
39 use static && append-flags -static
40 econf || die
41 emake || die
42 }
43
44 src_install() {
45 exeinto /etc/init.d ; newexe ${FILESDIR}/tor.initd-r1 tor
46 insinto /etc/conf.d ; newins ${FILESDIR}/tor.confd tor
47 make DESTDIR=${D} install || die
48 keepdir /var/{lib,log,run}/tor
49
50 dodoc README ChangeLog AUTHORS INSTALL \
51 doc/{CLIENTS,FAQ,HACKING,TODO} \
52 doc/{control-spec.txt,rend-spec.txt,tor-doc.css,tor-doc.html,tor-spec.txt}
53
54 dodir /var/lib/tor
55 dodir /var/log/tor
56 fperms 750 /var/lib/tor /var/log/tor
57 fowners tor:tor /var/lib/tor /var/log/tor
58 }
59
60 pkg_postinst() {
61 einfo "You must create /etc/tor/torrc, you can use the sample that is in that directory"
62 einfo "To have privoxy and tor working together you must add:"
63 einfo "forward-socks4a / localhost:9050 ."
64 ewarn "(notice the . at the end of the line)"
65 einfo "to /etc/privoxy/config"
66 einfo
67 einfo "The Tor ebuild now includes chroot support."
68 einfo "If you like to run tor in chroot AND this is a new install OR"
69 einfo "your tor doesn't already run in chroot, simply run:"
70 einfo "\`emerge --config =${CATEGORY}/${PF} \`"
71 einfo "Before running the above command you might want to change the chroot"
72 einfo "dir in /etc/conf.d/tor. Otherwise /chroot/tor will be used."
73 }
74
75 pkg_config() {
76 CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/tor 2>/dev/null`
77 EXISTS="no"
78
79 if [ -z "${CHROOT}" -a ! -d "/chroot/tor" ]; then
80 CHROOT="/chroot/tor"
81 elif [ -d ${CHROOT} ]; then
82 eerror; eerror "${CHROOT:-/chroot/tor} already exists. Quitting."; eerror; EXISTS="yes"
83 fi
84
85 if [ ! "$EXISTS" = yes ]; then
86 USERNAME="tor"
87 BINARY="/usr/bin/tor"
88
89 einfo
90 einfo "Setting up the chroot directory..."
91 mkdir -m 700 -p ${CHROOT}
92 mkdir -p ${CHROOT}/etc/tor \
93 ${CHROOT}/dev ${CHROOT}/var/log/tor ${CHROOT}/var/lib/tor \
94 ${CHROOT}/usr/bin ${CHROOT}/var/run ${CHROOT}/lib \
95 ${CHROOT}/usr/lib
96
97 einfo "Creating devices..."
98 mknod -m 0444 ${CHROOT}/dev/random c 1 8
99 mknod -m 0444 ${CHROOT}/dev/urandom c 1 9
100 mknod -m 0666 ${CHROOT}/dev/null c 1 3
101
102 einfo "Adding ${USERNAME} to ${CHROOT}/etc/passwd and group..."
103 grep ^${USERNAME}: /etc/passwd > ${CHROOT}/etc/passwd
104 grep ^${USERNAME}: /etc/group > ${CHROOT}/etc/group
105
106 einfo "Copying system files..."
107 cp -p /etc/{nsswitch.conf,host.conf,resolv.conf,hosts,localtime} ${CHROOT}/etc
108 cp -p /lib/{libc.*,libnsl.*,libnss_*.*,libresolv.*,libgcc_*.*,ld-linux.*} ${CHROOT}/lib
109
110 # Static version has no dynamic dependencies
111 if useq !static ; then
112 einfo "Copying dependencies..."
113 for DEP in $(ldd $BINARY | awk '{print $3}'); do
114 test -f ${DEP} && cp ${DEP} ${CHROOT}${DEP}
115 done
116 fi
117
118 einfo "Copying binaries and config files..."
119 for i in ${BINARY}; do
120 cp ${i} ${CHROOT}${i}
121 done
122
123 cp -R /etc/tor ${CHROOT}/etc/
124 cp -Rp /var/lib/tor ${CHROOT}/var/lib/
125
126 einfo "Setting permissions..."
127 chown root:${USERNAME} ${CHROOT} ${CHROOT}/var/lib/tor \
128 ${CHROOT}/var/log/tor ${CHROOT}/var/run
129 chmod 0750 ${CHROOT}/var/lib/tor ${CHROOT}/var/run ${CHROOT}/var/log/tor
130 chmod 0444 ${CHROOT}/etc/{group,host.conf,hosts,localtime,nsswitch.conf}
131 chmod 0444 ${CHROOT}/etc/{passwd,resolv.conf}
132 chmod 0644 ${CHROOT}/etc/tor/*
133
134 einfo "Done."
135 fi
136 }

  ViewVC Help
Powered by ViewVC 1.1.20