1 |
commit: 2b6f5644de8c328fe4b4df0e17848ca2d46fe031 |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 15 12:06:19 2016 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 15 12:06:39 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b6f5644 |
7 |
|
8 |
net-misc/tinc: fix logfile and pidfile paths, bug #560528 |
9 |
|
10 |
Package-Manager: portage-2.2.28 |
11 |
|
12 |
net-misc/tinc/files/tinc-1.1-fix-paths.patch | 44 +++++++++++++ |
13 |
net-misc/tinc/files/tincd-r2 | 79 ++++++++++++++++++++++ |
14 |
net-misc/tinc/tinc-1.1_pre14-r2.ebuild | 98 ++++++++++++++++++++++++++++ |
15 |
3 files changed, 221 insertions(+) |
16 |
|
17 |
diff --git a/net-misc/tinc/files/tinc-1.1-fix-paths.patch b/net-misc/tinc/files/tinc-1.1-fix-paths.patch |
18 |
new file mode 100644 |
19 |
index 00000000..519677d |
20 |
--- /dev/null |
21 |
+++ b/net-misc/tinc/files/tinc-1.1-fix-paths.patch |
22 |
@@ -0,0 +1,44 @@ |
23 |
+diff -Naur tinc-1.1pre14.orig/src/names.c tinc-1.1pre14/src/names.c |
24 |
+--- tinc-1.1pre14.orig/src/names.c 2016-04-17 12:08:41.000000000 -0400 |
25 |
++++ tinc-1.1pre14/src/names.c 2016-10-15 07:37:51.147064396 -0400 |
26 |
+@@ -86,36 +86,11 @@ |
27 |
+ if(!pidfilename) |
28 |
+ xasprintf(&pidfilename, "%s" SLASH "pid", confbase); |
29 |
+ #else |
30 |
+- bool fallback = false; |
31 |
+- if(daemon) { |
32 |
+- if(access(LOCALSTATEDIR, R_OK | W_OK | X_OK)) |
33 |
+- fallback = true; |
34 |
+- } else { |
35 |
+- char fname[PATH_MAX]; |
36 |
+- snprintf(fname, sizeof fname, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname); |
37 |
+- if(access(fname, R_OK)) { |
38 |
+- snprintf(fname, sizeof fname, "%s" SLASH "pid", confbase); |
39 |
+- if(!access(fname, R_OK)) |
40 |
+- fallback = true; |
41 |
+- } |
42 |
+- } |
43 |
++ if(!logfilename) |
44 |
++ xasprintf(&logfilename, "/var/log" SLASH "%s.log", identname); |
45 |
+ |
46 |
+- if(!fallback) { |
47 |
+- if(!logfilename) |
48 |
+- xasprintf(&logfilename, LOCALSTATEDIR SLASH "log" SLASH "%s.log", identname); |
49 |
+- |
50 |
+- if(!pidfilename) |
51 |
+- xasprintf(&pidfilename, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname); |
52 |
+- } else { |
53 |
+- if(!logfilename) |
54 |
+- xasprintf(&logfilename, "%s" SLASH "log", confbase); |
55 |
+- |
56 |
+- if(!pidfilename) { |
57 |
+- if(daemon) |
58 |
+- logger(DEBUG_ALWAYS, LOG_WARNING, "Could not access " LOCALSTATEDIR SLASH " (%s), storing pid and socket files in %s" SLASH, strerror(errno), confbase); |
59 |
+- xasprintf(&pidfilename, "%s" SLASH "pid", confbase); |
60 |
+- } |
61 |
+- } |
62 |
++ if(!pidfilename) |
63 |
++ xasprintf(&pidfilename, "/run" SLASH "%s.pid", identname); |
64 |
+ #endif |
65 |
+ |
66 |
+ if(!unixsocketname) { |
67 |
|
68 |
diff --git a/net-misc/tinc/files/tincd-r2 b/net-misc/tinc/files/tincd-r2 |
69 |
new file mode 100644 |
70 |
index 00000000..6e242d1 |
71 |
--- /dev/null |
72 |
+++ b/net-misc/tinc/files/tincd-r2 |
73 |
@@ -0,0 +1,79 @@ |
74 |
+#!/sbin/openrc-run |
75 |
+# Copyright 1999-2014 Gentoo Foundation |
76 |
+# Distributed under the terms of the GNU General Public License v2 |
77 |
+# $Id$ |
78 |
+ |
79 |
+extra_started_commands="reload" |
80 |
+ |
81 |
+NETS="/etc/conf.d/tinc.networks" |
82 |
+DAEMON="/usr/sbin/tincd" |
83 |
+ |
84 |
+depend() { |
85 |
+ use logger dns |
86 |
+ need net |
87 |
+} |
88 |
+ |
89 |
+checkconfig() { |
90 |
+ if [ "${RC_SVCNAME}" = "tincd" ] ; then |
91 |
+ ALL_NETNAME="$(awk '/^ *NETWORK:/ { print $2 }' "${NETS}")" |
92 |
+ else |
93 |
+ ALL_NETNAME="${RC_SVCNAME#*.}" |
94 |
+ fi |
95 |
+ # warn this if still not found |
96 |
+ if [ -z "${ALL_NETNAME}" ] ; then |
97 |
+ eerror "No VPN networks configured in ${NETS}" |
98 |
+ return 1 |
99 |
+ fi |
100 |
+ return 0 |
101 |
+} |
102 |
+ |
103 |
+start() { |
104 |
+ ebegin "Starting tinc VPN networks" |
105 |
+ checkconfig || return 1 |
106 |
+ for NETNAME in ${ALL_NETNAME} |
107 |
+ do |
108 |
+ CONFIG="/etc/tinc/${NETNAME}/tinc.conf" |
109 |
+ PIDFILE="/run/tinc.${NETNAME}.pid" |
110 |
+ if [ ! -f "${CONFIG}" ]; then |
111 |
+ eerror "Cannot start network ${NETNAME}." |
112 |
+ eerror "Please set up ${CONFIG} !" |
113 |
+ else |
114 |
+ ebegin "Starting tinc network ${NETNAME}" |
115 |
+ if [ "${SYSLOG}" = "yes" ]; then |
116 |
+ LOG="" |
117 |
+ else |
118 |
+ LOG="--logfile=/var/log/tinc.${NETNAME}.log" |
119 |
+ fi |
120 |
+ start-stop-daemon --start --exec "${DAEMON}" --pidfile "${PIDFILE}" -- --net="${NETNAME}" ${LOG} --pidfile "${PIDFILE}" --debug="${DEBUG_LEVEL}" ${EXTRA_OPTS} |
121 |
+ eend $? |
122 |
+ fi |
123 |
+ done |
124 |
+} |
125 |
+ |
126 |
+stop() { |
127 |
+ ebegin "Stopping tinc VPN networks" |
128 |
+ checkconfig || return 1 |
129 |
+ for NETNAME in ${ALL_NETNAME} |
130 |
+ do |
131 |
+ PIDFILE="/run/tinc.${NETNAME}.pid" |
132 |
+ if [ -f "${PIDFILE}" ]; then |
133 |
+ ebegin "Stopping tinc network ${NETNAME}" |
134 |
+ start-stop-daemon --stop --pidfile "${PIDFILE}" |
135 |
+ eend $? |
136 |
+ fi |
137 |
+ done |
138 |
+} |
139 |
+ |
140 |
+reload() { |
141 |
+ ebegin "Reloading configuration for tinc VPN networks" |
142 |
+ checkconfig || return 1 |
143 |
+ for NETNAME in ${ALL_NETNAME} |
144 |
+ do |
145 |
+ PIDFILE="/run/tinc.${NETNAME}.pid" |
146 |
+ if [ -f "${PIDFILE}" ]; then |
147 |
+ ebegin "Reloading tinc network ${NETNAME}" |
148 |
+ start-stop-daemon --signal HUP --pidfile ${PIDFILE} |
149 |
+ eend $? |
150 |
+ fi |
151 |
+ done |
152 |
+} |
153 |
|
154 |
diff --git a/net-misc/tinc/tinc-1.1_pre14-r2.ebuild b/net-misc/tinc/tinc-1.1_pre14-r2.ebuild |
155 |
new file mode 100644 |
156 |
index 00000000..bca8d41 |
157 |
--- /dev/null |
158 |
+++ b/net-misc/tinc/tinc-1.1_pre14-r2.ebuild |
159 |
@@ -0,0 +1,98 @@ |
160 |
+# Copyright 1999-2016 Gentoo Foundation |
161 |
+# Distributed under the terms of the GNU General Public License v2 |
162 |
+# $Id$ |
163 |
+ |
164 |
+EAPI="6" |
165 |
+ |
166 |
+MY_PV=${PV/_/} |
167 |
+MY_P=${PN}-${MY_PV} |
168 |
+ |
169 |
+PYTHON_COMPAT=( python2_7 ) |
170 |
+inherit eutils multilib python-any-r1 |
171 |
+ |
172 |
+DESCRIPTION="tinc is an easy to configure VPN implementation" |
173 |
+HOMEPAGE="http://www.tinc-vpn.org/" |
174 |
+ |
175 |
+UPSTREAM_VER=0 |
176 |
+ |
177 |
+[[ -n ${UPSTREAM_VER} ]] && \ |
178 |
+ UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN}-1.1-upstream-patches-${UPSTREAM_VER}.tar.xz" |
179 |
+ |
180 |
+SRC_URI="http://www.tinc-vpn.org/packages/${MY_P}.tar.gz |
181 |
+ ${UPSTREAM_PATCHSET_URI}" |
182 |
+ |
183 |
+LICENSE="GPL-2" |
184 |
+SLOT="0" |
185 |
+KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos" |
186 |
+IUSE="+lzo +ncurses gui libressl +readline +ssl uml vde upnp +zlib" |
187 |
+ |
188 |
+DEPEND=" |
189 |
+ ssl? ( |
190 |
+ !libressl? ( dev-libs/openssl:0= ) |
191 |
+ libressl? ( dev-libs/libressl:0= ) |
192 |
+ ) |
193 |
+ lzo? ( dev-libs/lzo:2 ) |
194 |
+ ncurses? ( sys-libs/ncurses:= ) |
195 |
+ readline? ( sys-libs/readline:= ) |
196 |
+ upnp? ( net-libs/miniupnpc ) |
197 |
+ zlib? ( sys-libs/zlib )" |
198 |
+RDEPEND="${DEPEND} |
199 |
+ vde? ( net-misc/vde ) |
200 |
+ ${PYTHON_DEPS} |
201 |
+ gui? ( $(python_gen_any_dep ' |
202 |
+ dev-python/wxpython[${PYTHON_USEDEP}] |
203 |
+ ') )" |
204 |
+ |
205 |
+S="${WORKDIR}/${MY_P}" |
206 |
+ |
207 |
+src_prepare() { |
208 |
+ # Upstream's patchset |
209 |
+ if [[ -n ${UPSTREAM_VER} ]]; then |
210 |
+ einfo "Try to apply Tinc Upstream patch set" |
211 |
+ EPATCH_SUFFIX="patch" \ |
212 |
+ EPATCH_FORCE="yes" \ |
213 |
+ EPATCH_OPTS="-p1" \ |
214 |
+ epatch "${WORKDIR}"/patches-upstream |
215 |
+ fi |
216 |
+ |
217 |
+ eapply "${FILESDIR}"/tinc-1.1-fix-paths.patch #560528 |
218 |
+ eapply_user |
219 |
+} |
220 |
+ |
221 |
+src_configure() { |
222 |
+ econf \ |
223 |
+ --enable-jumbograms \ |
224 |
+ --disable-silent-rules \ |
225 |
+ --enable-legacy-protocol \ |
226 |
+ --disable-tunemu \ |
227 |
+ --with-systemd=/usr/$(get_libdir)/systemd/system \ |
228 |
+ $(use_enable lzo) \ |
229 |
+ $(use_enable ncurses curses) \ |
230 |
+ $(use_enable readline) \ |
231 |
+ $(use_enable uml) \ |
232 |
+ $(use_enable vde) \ |
233 |
+ $(use_enable zlib) \ |
234 |
+ $(use_enable upnp miniupnpc) \ |
235 |
+ $(use_with ssl openssl) |
236 |
+ #--without-libgcrypt \ |
237 |
+} |
238 |
+ |
239 |
+src_install() { |
240 |
+ emake DESTDIR="${D}" install |
241 |
+ dodir /etc/tinc |
242 |
+ dodoc AUTHORS NEWS README THANKS |
243 |
+ doconfd "${FILESDIR}"/tinc.networks |
244 |
+ newconfd "${FILESDIR}"/tincd.conf tincd |
245 |
+ newinitd "${FILESDIR}"/tincd-r2 tincd |
246 |
+ |
247 |
+ if use gui; then |
248 |
+ python_fix_shebang "${ED}"/usr/bin/tinc-gui |
249 |
+ else |
250 |
+ rm -f "${ED}"/usr/bin/tinc-gui || die |
251 |
+ fi |
252 |
+} |
253 |
+ |
254 |
+pkg_postinst() { |
255 |
+ elog "This package requires the tun/tap kernel device." |
256 |
+ elog "Look at http://www.tinc-vpn.org/ for how to configure tinc" |
257 |
+} |