diff options
author | 2016-10-15 08:06:19 -0400 | |
---|---|---|
committer | 2016-10-15 08:06:39 -0400 | |
commit | 2b6f5644de8c328fe4b4df0e17848ca2d46fe031 (patch) | |
tree | a1697709f33dd3c2b5498aa596d2cb531cd33d79 /net-misc/tinc | |
parent | package.mask: remove obsolete mask (diff) | |
download | gentoo-2b6f5644de8c328fe4b4df0e17848ca2d46fe031.tar.gz gentoo-2b6f5644de8c328fe4b4df0e17848ca2d46fe031.tar.bz2 gentoo-2b6f5644de8c328fe4b4df0e17848ca2d46fe031.zip |
net-misc/tinc: fix logfile and pidfile paths, bug #560528
Package-Manager: portage-2.2.28
Diffstat (limited to 'net-misc/tinc')
-rw-r--r-- | net-misc/tinc/files/tinc-1.1-fix-paths.patch | 44 | ||||
-rw-r--r-- | net-misc/tinc/files/tincd-r2 | 79 | ||||
-rw-r--r-- | net-misc/tinc/tinc-1.1_pre14-r2.ebuild | 98 |
3 files changed, 221 insertions, 0 deletions
diff --git a/net-misc/tinc/files/tinc-1.1-fix-paths.patch b/net-misc/tinc/files/tinc-1.1-fix-paths.patch new file mode 100644 index 000000000000..519677dd5034 --- /dev/null +++ b/net-misc/tinc/files/tinc-1.1-fix-paths.patch @@ -0,0 +1,44 @@ +diff -Naur tinc-1.1pre14.orig/src/names.c tinc-1.1pre14/src/names.c +--- tinc-1.1pre14.orig/src/names.c 2016-04-17 12:08:41.000000000 -0400 ++++ tinc-1.1pre14/src/names.c 2016-10-15 07:37:51.147064396 -0400 +@@ -86,36 +86,11 @@ + if(!pidfilename) + xasprintf(&pidfilename, "%s" SLASH "pid", confbase); + #else +- bool fallback = false; +- if(daemon) { +- if(access(LOCALSTATEDIR, R_OK | W_OK | X_OK)) +- fallback = true; +- } else { +- char fname[PATH_MAX]; +- snprintf(fname, sizeof fname, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname); +- if(access(fname, R_OK)) { +- snprintf(fname, sizeof fname, "%s" SLASH "pid", confbase); +- if(!access(fname, R_OK)) +- fallback = true; +- } +- } ++ if(!logfilename) ++ xasprintf(&logfilename, "/var/log" SLASH "%s.log", identname); + +- if(!fallback) { +- if(!logfilename) +- xasprintf(&logfilename, LOCALSTATEDIR SLASH "log" SLASH "%s.log", identname); +- +- if(!pidfilename) +- xasprintf(&pidfilename, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname); +- } else { +- if(!logfilename) +- xasprintf(&logfilename, "%s" SLASH "log", confbase); +- +- if(!pidfilename) { +- if(daemon) +- logger(DEBUG_ALWAYS, LOG_WARNING, "Could not access " LOCALSTATEDIR SLASH " (%s), storing pid and socket files in %s" SLASH, strerror(errno), confbase); +- xasprintf(&pidfilename, "%s" SLASH "pid", confbase); +- } +- } ++ if(!pidfilename) ++ xasprintf(&pidfilename, "/run" SLASH "%s.pid", identname); + #endif + + if(!unixsocketname) { diff --git a/net-misc/tinc/files/tincd-r2 b/net-misc/tinc/files/tincd-r2 new file mode 100644 index 000000000000..6e242d17c5d3 --- /dev/null +++ b/net-misc/tinc/files/tincd-r2 @@ -0,0 +1,79 @@ +#!/sbin/openrc-run +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +extra_started_commands="reload" + +NETS="/etc/conf.d/tinc.networks" +DAEMON="/usr/sbin/tincd" + +depend() { + use logger dns + need net +} + +checkconfig() { + if [ "${RC_SVCNAME}" = "tincd" ] ; then + ALL_NETNAME="$(awk '/^ *NETWORK:/ { print $2 }' "${NETS}")" + else + ALL_NETNAME="${RC_SVCNAME#*.}" + fi + # warn this if still not found + if [ -z "${ALL_NETNAME}" ] ; then + eerror "No VPN networks configured in ${NETS}" + return 1 + fi + return 0 +} + +start() { + ebegin "Starting tinc VPN networks" + checkconfig || return 1 + for NETNAME in ${ALL_NETNAME} + do + CONFIG="/etc/tinc/${NETNAME}/tinc.conf" + PIDFILE="/run/tinc.${NETNAME}.pid" + if [ ! -f "${CONFIG}" ]; then + eerror "Cannot start network ${NETNAME}." + eerror "Please set up ${CONFIG} !" + else + ebegin "Starting tinc network ${NETNAME}" + if [ "${SYSLOG}" = "yes" ]; then + LOG="" + else + LOG="--logfile=/var/log/tinc.${NETNAME}.log" + fi + start-stop-daemon --start --exec "${DAEMON}" --pidfile "${PIDFILE}" -- --net="${NETNAME}" ${LOG} --pidfile "${PIDFILE}" --debug="${DEBUG_LEVEL}" ${EXTRA_OPTS} + eend $? + fi + done +} + +stop() { + ebegin "Stopping tinc VPN networks" + checkconfig || return 1 + for NETNAME in ${ALL_NETNAME} + do + PIDFILE="/run/tinc.${NETNAME}.pid" + if [ -f "${PIDFILE}" ]; then + ebegin "Stopping tinc network ${NETNAME}" + start-stop-daemon --stop --pidfile "${PIDFILE}" + eend $? + fi + done +} + +reload() { + ebegin "Reloading configuration for tinc VPN networks" + checkconfig || return 1 + for NETNAME in ${ALL_NETNAME} + do + PIDFILE="/run/tinc.${NETNAME}.pid" + if [ -f "${PIDFILE}" ]; then + ebegin "Reloading tinc network ${NETNAME}" + start-stop-daemon --signal HUP --pidfile ${PIDFILE} + eend $? + fi + done +} diff --git a/net-misc/tinc/tinc-1.1_pre14-r2.ebuild b/net-misc/tinc/tinc-1.1_pre14-r2.ebuild new file mode 100644 index 000000000000..bca8d412e168 --- /dev/null +++ b/net-misc/tinc/tinc-1.1_pre14-r2.ebuild @@ -0,0 +1,98 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="6" + +MY_PV=${PV/_/} +MY_P=${PN}-${MY_PV} + +PYTHON_COMPAT=( python2_7 ) +inherit eutils multilib python-any-r1 + +DESCRIPTION="tinc is an easy to configure VPN implementation" +HOMEPAGE="http://www.tinc-vpn.org/" + +UPSTREAM_VER=0 + +[[ -n ${UPSTREAM_VER} ]] && \ + UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN}-1.1-upstream-patches-${UPSTREAM_VER}.tar.xz" + +SRC_URI="http://www.tinc-vpn.org/packages/${MY_P}.tar.gz + ${UPSTREAM_PATCHSET_URI}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos" +IUSE="+lzo +ncurses gui libressl +readline +ssl uml vde upnp +zlib" + +DEPEND=" + ssl? ( + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= ) + ) + lzo? ( dev-libs/lzo:2 ) + ncurses? ( sys-libs/ncurses:= ) + readline? ( sys-libs/readline:= ) + upnp? ( net-libs/miniupnpc ) + zlib? ( sys-libs/zlib )" +RDEPEND="${DEPEND} + vde? ( net-misc/vde ) + ${PYTHON_DEPS} + gui? ( $(python_gen_any_dep ' + dev-python/wxpython[${PYTHON_USEDEP}] + ') )" + +S="${WORKDIR}/${MY_P}" + +src_prepare() { + # Upstream's patchset + if [[ -n ${UPSTREAM_VER} ]]; then + einfo "Try to apply Tinc Upstream patch set" + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + EPATCH_OPTS="-p1" \ + epatch "${WORKDIR}"/patches-upstream + fi + + eapply "${FILESDIR}"/tinc-1.1-fix-paths.patch #560528 + eapply_user +} + +src_configure() { + econf \ + --enable-jumbograms \ + --disable-silent-rules \ + --enable-legacy-protocol \ + --disable-tunemu \ + --with-systemd=/usr/$(get_libdir)/systemd/system \ + $(use_enable lzo) \ + $(use_enable ncurses curses) \ + $(use_enable readline) \ + $(use_enable uml) \ + $(use_enable vde) \ + $(use_enable zlib) \ + $(use_enable upnp miniupnpc) \ + $(use_with ssl openssl) + #--without-libgcrypt \ +} + +src_install() { + emake DESTDIR="${D}" install + dodir /etc/tinc + dodoc AUTHORS NEWS README THANKS + doconfd "${FILESDIR}"/tinc.networks + newconfd "${FILESDIR}"/tincd.conf tincd + newinitd "${FILESDIR}"/tincd-r2 tincd + + if use gui; then + python_fix_shebang "${ED}"/usr/bin/tinc-gui + else + rm -f "${ED}"/usr/bin/tinc-gui || die + fi +} + +pkg_postinst() { + elog "This package requires the tun/tap kernel device." + elog "Look at http://www.tinc-vpn.org/ for how to configure tinc" +} |