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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Tue Sep 5 01:03:17 2006 UTC (8 years ago) by humpback
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
removed older versions.
(Portage version: 2.1.1_rc1-r2)
 (Signed Manifest commit)

1 # Copyright 1999-2006 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.16.ebuild,v 1.3 2006/04/23 15:31:36 exg 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
49 dodoc README ChangeLog AUTHORS INSTALL \
50 doc/{CLIENTS,FAQ,HACKING,TODO} \
51 doc/{control-spec.txt,rend-spec.txt,tor-doc.css,tor-doc.html,tor-spec.txt}
52
53 dodir /var/lib/tor
54 dodir /var/log/tor
55 fperms 750 /var/lib/tor /var/log/tor
56 fowners tor:tor /var/lib/tor /var/log/tor
57 }
58
59 pkg_postinst() {
60 einfo "You must create /etc/tor/torrc, you can use the sample that is in that directory"
61 einfo "To have privoxy and tor working together you must add:"
62 einfo "forward-socks4a / localhost:9050 ."
63 einfo "to /etc/privoxy/config"
64 einfo
65 einfo "The Tor ebuild now includes chroot support."
66 einfo "If you like to run tor in chroot AND this is a new install OR"
67 einfo "your tor doesn't already run in chroot, simply run:"
68 einfo "\`ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config\`"
69 einfo "Before running the above command you might want to change the chroot"
70 einfo "dir in /etc/conf.d/tor. Otherwise /chroot/tor will be used."
71 }
72
73 pkg_config() {
74 CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/tor 2>/dev/null`
75 EXISTS="no"
76
77 if [ -z "${CHROOT}" -a ! -d "/chroot/tor" ]; then
78 CHROOT="/chroot/tor"
79 elif [ -d ${CHROOT} ]; then
80 eerror; eerror "${CHROOT:-/chroot/tor} already exists. Quitting."; eerror; EXISTS="yes"
81 fi
82
83 if [ ! "$EXISTS" = yes ]; then
84 USERNAME="tor"
85 BINARY="/usr/bin/tor"
86
87 einfo
88 einfo "Setting up the chroot directory..."
89 mkdir -m 700 -p ${CHROOT}
90 mkdir -p ${CHROOT}/etc/tor \
91 ${CHROOT}/dev ${CHROOT}/var/log/tor ${CHROOT}/var/lib/tor \
92 ${CHROOT}/usr/bin ${CHROOT}/var/run ${CHROOT}/lib \
93 ${CHROOT}/usr/lib
94
95 einfo "Creating devices..."
96 mknod -m 0444 ${CHROOT}/dev/random c 1 8
97 mknod -m 0444 ${CHROOT}/dev/urandom c 1 9
98 mknod -m 0666 ${CHROOT}/dev/null c 1 3
99
100 einfo "Adding ${USERNAME} to ${CHROOT}/etc/passwd and group..."
101 grep ^${USERNAME}: /etc/passwd > ${CHROOT}/etc/passwd
102 grep ^${USERNAME}: /etc/group > ${CHROOT}/etc/group
103
104 einfo "Copying system files..."
105 cp -p /etc/{nsswitch.conf,host.conf,resolv.conf,hosts,localtime} ${CHROOT}/etc
106 cp -p /lib/{libc.*,libnsl.*,libnss_*.*,libresolv.*,libgcc_*.*,ld-linux.*} ${CHROOT}/lib
107
108 # Static version has no dynamic dependencies
109 if useq !static ; then
110 einfo "Copying dependencies..."
111 for DEP in $(ldd $BINARY | awk '{print $3}'); do
112 test -f ${DEP} && cp ${DEP} ${CHROOT}${DEP}
113 done
114 fi
115
116 einfo "Copying binaries and config files..."
117 for i in ${BINARY}; do
118 cp ${i} ${CHROOT}${i}
119 done
120
121 cp -R /etc/tor ${CHROOT}/etc/
122 cp -Rp /var/lib/tor ${CHROOT}/var/lib/
123
124 einfo "Setting permissions..."
125 chown ${USERNAME}:${USERNAME} ${CHROOT} ${CHROOT}/var/lib/tor \
126 ${CHROOT}/var/log/tor ${CHROOT}/var/run
127 chmod 0700 ${CHROOT}/var/lib/tor ${CHROOT}/var/run ${CHROOT}/var/log/tor
128 chmod 0444 ${CHROOT}/etc/{group,host.conf,hosts,localtime,nsswitch.conf}
129 chmod 0444 ${CHROOT}/etc/{passwd,resolv.conf}
130 chmod 0644 ${CHROOT}/etc/tor/*
131
132 einfo "Done."
133 fi
134 }

  ViewVC Help
Powered by ViewVC 1.1.20