aboutsummaryrefslogtreecommitdiff
path: root/network/tor/tor.build
blob: 7ff63140c69e929de80d62e31d94585c2505d083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=tor
VERSION=0.2.4.21
BUILD=1
DEPENDS=('libevent >= 2.0.21-1' 'openssl >= 1.0.1g-1')

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: tor (The Onion Router)
${NAME}:
${NAME}: Tor protects you by bouncing your communications around a distributed
${NAME}: network of relays run by volunteers all around the world: it prevents
${NAME}: somebody watching your Internet connection from learning what sites
${NAME}: you visit, and it prevents the sites you visit from learning your
${NAME}: physical location. Tor works with many of your existing applications,
${NAME}: including web browsers, instant messaging clients, remote login, and
${NAME}: other applications based on the TCP protocol.
${NAME}:
${NAME}: Homepage: https://www.torproject.org
EOF

cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh

config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
    # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

preserve_perms() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  if [ -e \$OLD ]; then
    cp -a \$OLD \${NEW}.incoming
    cat \$NEW > \${NEW}.incoming
    mv \${NEW}.incoming \$NEW
  fi
  config \$NEW
}

preserve_perms etc/rc.d/rc.tor.new
config etc/logrotate.d/tor.new
config etc/tor/torrc.new
config etc/tor/torsocks.conf.new

# If the tor users/groups don't exist add them

if grep "^tor:x:" etc/passwd 1> /dev/null 2> /dev/null ; then
  true
else
  echo "tor:x:44:44:tor:/:/bin/false" >> etc/passwd
fi
if grep "^tor::" etc/group 1> /dev/null 2> /dev/null ; then
  true
else
  echo "tor::44:tor" >> etc/group
fi
if grep "^tor:" etc/shadow 1> /dev/null 2> /dev/null ; then
  true
else
  echo "tor:*:9797:0:::::" >> etc/shadow
fi

chown tor.tor var/lib/tor
chmod 0700 var/lib/tor
EOF

# Sources

SRCNAME[0]=${NAME}
SRCVERS[0]=${VERSION}
SRCPACK[0]=https://www.torproject.org/dist/${SRCNAME[0]}-${SRCVERS[0]}.tar.gz

build0()
{
CPPFLAGS="-I${SYS_DIR[include]}/event" \
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --disable-dependency-tracking \
 --disable-silent-rules \
 --prefix="${SYS_DIR[usr]}" \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}" \
 --libdir="${SYS_DIR[lib]}" \
 --localstatedir="${SYS_DIR[var]}"
# --enable-upnp
# --enable-nat-pmp
# --with-syslog-facility="LOG_DAEMON"
make ${JOBS} V=1
make install DESTDIR="${PKG}"
changelog ReleaseNotes
license LICENSE
install -m 0700 -d ${PKG}${SYS_DIR[var]}/lib/tor
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dat tor.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.cfg torrc ${PKG}${SYS_DIR[etc]}/tor
install.dir ${PKG}${SYS_DIR[etc]}/{rc,logrotate}.d
install.bin rc.tor ${PKG}${SYS_DIR[etc]}/rc.d/rc.tor.new
install.dat tor.logrotate ${PKG}${SYS_DIR[etc]}/logrotate.d/tor.new
config ${PKG}${SYS_DIR[etc]}/tor/tor{rc,-tsocks.conf}
rm -rf ${PKG}${SYS_DIR[doc]}/tor
}

SRCNAME[1]=torsocks
SRCVERS[1]=2.0.0.$(date +%Y%m%d)
SRCPACK[1]=git://git.torproject.org/torsocks.git
SRCCOPY[1]="GPL2"

build1()
{
./autogen.sh
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --disable-dependency-tracking \
 --disable-silent-rules \
 --enable-static=no \
 --enable-shared=yes \
 --prefix="${SYS_DIR[usr]}" \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}" \
 --libdir="${SYS_DIR[lib]}" \
 --localstatedir="${SYS_DIR[var]}" \
 --datadir="${SYS_DIR[doc]}/torsocks"
make ${JOBS} V=1
make install DESTDIR="${PKG}"
changelog ChangeLog
config ${PKG}${SYS_DIR[etc]}/tor/torsocks.conf
rm -rf ${PKG}${SYS_DIR[doc]}/torsocks
}