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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20