summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Tittelbach (xro) <xro@gmx.net>2009-11-22 21:41:32 +0000
committerBernhard Tittelbach (xro) <xro@gmx.net>2009-11-22 21:41:32 +0000
commit649ca9d1e0a103fed8ad3a7e3f09580aa21c2d0e (patch)
treefb86ec9dcef0625512845812abd827b08f209084 /net-misc
parentsys-fs/fuse-zip: Initial commit, bug #241202. Thanks to Sergey Dryabzhinsky f... (diff)
downloadsunrise-649ca9d1e0a103fed8ad3a7e3f09580aa21c2d0e.tar.gz
sunrise-649ca9d1e0a103fed8ad3a7e3f09580aa21c2d0e.tar.bz2
sunrise-649ca9d1e0a103fed8ad3a7e3f09580aa21c2d0e.zip
net-misc/uanytun: Initial commit. New Ebuild for bug 294103.
svn path=/sunrise/; revision=9581
Diffstat (limited to 'net-misc')
-rw-r--r--net-misc/uanytun/ChangeLog8
-rwxr-xr-xnet-misc/uanytun/files/uanytun-0.3.1.init90
-rw-r--r--net-misc/uanytun/metadata.xml12
-rw-r--r--net-misc/uanytun/uanytun-0.3.1.ebuild66
4 files changed, 176 insertions, 0 deletions
diff --git a/net-misc/uanytun/ChangeLog b/net-misc/uanytun/ChangeLog
new file mode 100644
index 000000000..a17a2d581
--- /dev/null
+++ b/net-misc/uanytun/ChangeLog
@@ -0,0 +1,8 @@
+# ChangeLog for net-misc/uanytun
+# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+ 22 Nov 2009; Bernhard Tittelbach (xro) <xro@gmx.net>
+ +uanytun-0.3.1.ebuild, +files/uanytun-0.3.1.init, +metadata.xml:
+ Initial commit. New Ebuild for bug 294103.
+
diff --git a/net-misc/uanytun/files/uanytun-0.3.1.init b/net-misc/uanytun/files/uanytun-0.3.1.init
new file mode 100755
index 000000000..4a4aaa3f4
--- /dev/null
+++ b/net-misc/uanytun/files/uanytun-0.3.1.init
@@ -0,0 +1,90 @@
+#!/sbin/runscript
+# Distributed under the terms of the GNU General Public License v3
+# Written by Bernhard Tittelbach based on examples from Gentoo, openvpn and uanytun debian initrd script
+
+depend() {
+ need net
+ use dns
+ after bootmisc
+}
+
+DAEMON=/usr/sbin/uanytun
+CONFIG_DIR=/etc/uanytun
+NAME=uanytun
+DESC=uanytun
+VARRUN_PREFIX=/var/run/uanytun
+
+VPN=${SVCNAME#*.}
+[ "$VPN" = "$SVCNAME" ] && VPN=""
+
+test -x $DAEMON || exit 1
+
+# Include uanytun defaults if available
+if [ -f /etc/default/uanytun ] ; then
+ . /etc/default/uanytun
+fi
+
+start_vpn () {
+ if [ -f $CONFIG_DIR/$NAME/config ] ; then
+ POSTUP=''
+ test -f $CONFIG_DIR/$NAME/post-up.sh && POSTUP="-x $CONFIG_DIR/$NAME/post-up.sh"
+ CHROOTDIR=`grep '^chroot' < $CONFIG_DIR/$NAME/config | sed 's/chroot\s*//'`
+ if [ -n "$CHROOTDIR" ] ; then
+ test -d $CHROOTDIR || mkdir -p $CHROOTDIR
+ fi
+ DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '`
+ start-stop-daemon --start --pidfile $VARRUN_PREFIX.${NAME}.pid --exec \
+ $DAEMON -- --write-pid $VARRUN_PREFIX.${NAME}.pid $POSTUP $DAEMONARG || return 1
+ else
+ eerror "no config found"
+ return 1
+ fi
+ return 0
+}
+stop_vpn () {
+ start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON --oknodo
+ rm -f $PIDFILE
+}
+
+start () {
+ if test -z "$VPN" ; then
+ if [ -f $CONFIG_DIR/autostart ] ; then
+ for NAME in `sed 's/#.*//' < $CONFIG_DIR/autostart | grep -e '\w'`; do
+ ebegin "Starting ${DESC} VPN: ${NAME}"
+ start_vpn
+ eend $?
+ done
+ else
+ eerror "no config found"
+ return 1
+ fi
+ else
+ NAME="$VPN"
+ ebegin "Starting ${DESC} VPN: ${NAME}"
+ start_vpn
+ eend $?
+ fi
+}
+
+stop () {
+ if test -z "$VPN" ; then
+ for PIDFILE in `ls $VARRUN_PREFIX.*.pid 2> /dev/null`; do
+ NAME=`echo $PIDFILE | cut -c18-`
+ NAME=${NAME%%.pid}
+ ebegin "Stopping ${DESC} VPN: ${NAME}"
+ stop_vpn
+ eend $?
+ done
+ else
+ if test -e $VARRUN_PREFIX.${VPN}.pid ; then
+ PIDFILE=`ls $VARRUN_PREFIX.${VPN}.pid 2> /dev/null`
+ NAME=`echo $PIDFILE | cut -c18-`
+ NAME=${NAME%%.pid}
+ ebegin "Stopping ${DESC} VPN: ${NAME}"
+ stop_vpn
+ eend $?
+ else
+ eerror " failure: No such tunnel is running: $VPN"
+ fi
+ fi
+}
diff --git a/net-misc/uanytun/metadata.xml b/net-misc/uanytun/metadata.xml
new file mode 100644
index 000000000..89d94fd00
--- /dev/null
+++ b/net-misc/uanytun/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>uanytun</herd>
+<longdescription>uAnytun is an simplified implementation of the Secure Anycast Tunneling Protocol. It is designed for use in embedded environments. Unlike anytun it does not implement the synchronisation of multiple server endpoints and can only act as client or single endpoint server.</longdescription>
+<use>
+ <flag name='examples'>Install example configuration into /usr/share/doc/...</flag>
+ <flag name='gcrypt'>Prefer <pkg>dev-libs/libgcrypt</pkg> over
+ <pkg>dev-libs/openssl</pkg> for encryption
+ </flag>
+</use>
+</pkgmetadata>
diff --git a/net-misc/uanytun/uanytun-0.3.1.ebuild b/net-misc/uanytun/uanytun-0.3.1.ebuild
new file mode 100644
index 000000000..5f7815d74
--- /dev/null
+++ b/net-misc/uanytun/uanytun-0.3.1.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="tiny VPN daemon using Secure Anycast Tunneling"
+HOMEPAGE="http://anytun.org/"
+SRC_URI="http://anytun.org/download/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="examples gcrypt"
+
+RDEPEND="gcrypt? ( dev-libs/libgcrypt )
+ !gcrypt? ( dev-libs/openssl )"
+DEPEND="${RDEPEND}
+ <app-text/asciidoc-8.5.0" # asciidoc a2x >= 8.5.0 requires an -L switch not present in lower versions
+
+S=${S}/src
+
+src_compile() {
+ local myconf=""
+ use gcrypt || myconf="--use-ssl-crypto"
+ #uanytun doesn't use autoconf and fails with options like --build --infodir --host ...
+ ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc ${myconf} || die "configure failed"
+
+ emake || die "make failed"
+
+ einfo "Building manpages"
+ emake manpage || die "failed building manpages"
+}
+
+src_install() {
+ #make target install-bin is buggy
+ dosbin uanytun || die "failed to copy/install an executable"
+ newinitd "${FILESDIR}/${PN}-0.3.1.init" uanytun || die "failed to copy/install initrd script"
+
+ emake install-man DESTDIR=${D} || die "failed to install manpages"
+
+ cd ../
+ dodoc AUTHORS ChangeLog README || die "failed to install docs"
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}/examples/etc/
+ doins -r etc/uanytun || die "failed to install examples"
+ fi
+}
+
+pkg_config() {
+ [ -e "${ROOT}"/etc/uanytun ] && die "${ROOT}/etc/uanytun/ already present, rm -R it first"
+ [ ! -d "${ROOT}"/usr/share/doc/${PF}/examples/etc/uanytun/ ] && \
+ die "can't copy example configs since examples were not installed (reemerge with USE=\"examples\")"
+ cp -vr "${ROOT}"/usr/share/doc/${PF}/examples/etc/uanytun "${ROOT}"/etc/ || die "failed to copy examples"
+}
+
+pkg_postinst() {
+ enewgroup uanytun
+ enewuser uanytun -1 -1 /var/run/ uanytun
+ einfo "Note that each VPN gets its own directory under /etc/uanytun/"
+ einfo " (see examples provided with the package)"
+ einfo "Use the following example to create gentoo-style"
+ einfo " uanytun.{VPN} initrd scripts for each VPN"
+ einfo "# ln -s /etc/init.d/uanytun /etc/init.d/uanytun.client1"
+}