diff options
author | Francesco Colista <fcolista@alpinelinux.org> | 2015-05-26 12:50:42 +0000 |
---|---|---|
committer | Francesco Colista <fcolista@alpinelinux.org> | 2015-05-26 12:50:47 +0000 |
commit | c3f4d165bb84d76b123af30c466e87f80e13acbb (patch) | |
tree | 87ae71a4bd559b7e007d1826021939617a0b0fa7 /testing/anytun | |
parent | da84fd0cfde6226b909ab3d0da998fd190478e8b (diff) | |
download | aports-c3f4d165bb84d76b123af30c466e87f80e13acbb.tar.bz2 aports-c3f4d165bb84d76b123af30c466e87f80e13acbb.tar.xz |
testing/anytun: new aport.
Diffstat (limited to 'testing/anytun')
-rw-r--r-- | testing/anytun/APKBUILD | 57 | ||||
-rw-r--r-- | testing/anytun/anytun.initd | 155 | ||||
-rw-r--r-- | testing/anytun/boost-mt.patch | 26 |
3 files changed, 238 insertions, 0 deletions
diff --git a/testing/anytun/APKBUILD b/testing/anytun/APKBUILD new file mode 100644 index 0000000000..67333c6ff6 --- /dev/null +++ b/testing/anytun/APKBUILD @@ -0,0 +1,57 @@ +# Contributor: Francesco Colista <fcolista@alpinelinux.org> +# Maintainer: Francesco Colista <fcolista@alpinelinux.org> +pkgname=anytun +pkgver=0.3.5 +pkgrel=0 +pkgdesc="Secure anycast tunneling protocol implementation for flexible and fault-tolerant VPNs" +url="http://www.anytun.org" +arch="all" +license="GPL3" +depends="" +depends_dev="openssl-dev boost-dev linux-headers" +makedepends="$depends_dev" +install="" +subpackages="$pkgname-dev $pkgname-doc" +source="http://www.anytun.org/download/$pkgname-$pkgver.tar.gz + boost-mt.patch + $pkgname.initd" + +_builddir="$srcdir"/$pkgname-$pkgver/src +prepare() { + local i + cd "$_builddir" + cd .. + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done +} + +build() { + cd "$_builddir" + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --use-ssl-crypto \ + --examplesdir=/usr/share/docs || return 1 + make || return 1 +} + +package() { + cd "$_builddir" + mkdir -p ${pkgdir}/var/run/anytun ${pkgdir}/var/run/anytun-controld &>/dev/null + make install DESTDIR="${pkgdir}" + rm "${pkgdir}"/etc/init.d/$pkgname + install -Dm 755 "$srcdir"/$pkgname.initd "${pkgdir}"/etc/init.d/$pkgname +} + +md5sums="beb1a6f84c2997a052d2446337404603 anytun-0.3.5.tar.gz +d7220eae296c814ee100d8ca1f5cf19a boost-mt.patch +d429ba9feaaf15bb268b811eccc71862 anytun.initd" +sha256sums="97f88c9a5ba0eedc3a10fd202d526af8817966ae2eac103738aaef60edb4dea7 anytun-0.3.5.tar.gz +31dca9b29da41ed338d12ff96171b1f2a84013f689af0965c2d97f2fbcf0b499 boost-mt.patch +f2390be3b27d2a208e4d77bf776d62c2dd9a92a79a30e5394188b82af6f55037 anytun.initd" +sha512sums="9bfa6bcb86ba77cb3f16b447a9fd7ecd241cf64e4ed8b5f509ab1a945defa20a2c3906f8c0a9be81261f35cc2b4dbac7686cf82a510e35e2a2bd79dd6d0f8d9d anytun-0.3.5.tar.gz +e19522a26529bb16591ed724d499c3b7fd7060e937eadc93f7719c29aaa604b953c59b94024efe2227331741ba5bbde084619dd42071cf086ef803906e6678a7 boost-mt.patch +a31455058e0ac60ed9457c79eea789ce19ba49abc200b59c0d8390eb0c3b6f09813177f9b679fb8ac69ac7b0be862e4604d19298ae4cd79925511fff3963e93d anytun.initd" diff --git a/testing/anytun/anytun.initd b/testing/anytun/anytun.initd new file mode 100644 index 0000000000..0767a73802 --- /dev/null +++ b/testing/anytun/anytun.initd @@ -0,0 +1,155 @@ +#!/sbin/openrc-run +# Distributed under the terms of the GNU General Public License v3 +# Written by Bernhard Tittelbach based on examples from Gentoo, openvpn and anytun debian init.rd script + +opts="${opts} reload" +depend() { + need net + use dns + after bootmisc +} + +DAEMON=/usr/sbin/anytun +ANYTUNCONFIG=/usr/bin/anytun-config +CONTROLDAEMON=/usr/bin/anytun-controld +NAME=anytun +DESC=anytun +CONFIG_DIR=/etc/anytun +VARCONFIG_DIR=/var/run/anytun-controld +VARRUN_DIR=/var/run/anytun + +VPN=${SVCNAME#*.} +[ "$VPN" = "$SVCNAME" ] && VPN="" + +# Include anytun defaults if available +if [ -f /etc/conf.d/anytun ] ; then + . /etc/conf.d/anytun +fi + +test -x $DAEMON || exit 1 + + +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 + test -d $VARRUN_DIR || mkdir -p $VARRUN_DIR + DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '` + start-stop-daemon --start --pidfile $VARRUN_DIR/${NAME}.pid --exec $DAEMON -- --write-pid $VARRUN_DIR/${NAME}.pid $POSTUP \ + $DAEMONOPTS $DAEMONARG || return 1 + else + eerror "no config found" + return 1 + fi + start_configd + return 0 +} +stop_vpn () { + start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON + rm -f $PIDFILE + stop_configd +} + +start_configd () { + if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then + test -d $VARCONFIG_DIR || mkdir -p $VARCONFIG_DIR + chmod 700 $VARCONFIG_DIR + rm -f $VARCONFIG_DIR/$NAME 2>/dev/null + KDPRF=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e 'kd-prf' | sed 's/^/ --/' | xargs echo` + for CLIENTPATH in $CONFIG_DIR/$NAME/conf.d/* ; do + DAEMONARG=`sed 's/#.*//' < $CLIENTPATH | grep -e '\w' | sed 's/^/ --/' | xargs echo` + $ANYTUNCONFIG $DAEMONARG $CIPHER $AUTHALGO $KDPRF >> $VARCONFIG_DIR/$NAME + done + CONTROLHOST=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e 'control-host' | sed 's/^/ --/'i | xargs echo` + start-stop-daemon --start --pidfile $VARCONFIG_DIR/${NAME}.pid --exec $CONTROLDAEMON \ + -- -f $VARCONFIG_DIR/$NAME $DAEMONOPTS $CONTROLHOST --write-pid $VARCONFIG_DIR/${NAME}.pid + fi +} +stop_configd () { + if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then + start-stop-daemon --stop --pidfile $VARCONFIG_DIR/${NAME}.pid --exec $CONTROLDAEMON + rm -f $VARCONFIG_DIR/${NAME}.pid + fi +} + +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 ${VARRUN_DIR}/*.pid ; do + NAME=`basename $PIDFILE .pid` + ebegin "Stopping ${DESC} VPN: ${NAME}" + stop_vpn + eend $? + done + else + if test -e ${VARRUN_DIR}/${VPN}.pid ; then + PIDFILE=${VARRUN_DIR}/${VPN}.pid + NAME=`basename $PIDFILE .pid` + ebegin "Stopping ${DESC} VPN: ${NAME}" + stop_vpn + eend $? + else + eerror " failure: No such tunnel is running: $VPN" + fi + fi +} + +reload () { + if test -z "$VPN" ; then + for PIDFILE in ${VARRUN_DIR}/*.pid ; do + NAME=`basename $PIDFILE .pid` + if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then + ebegin "Reloading ${DESC} VPN: ${NAME}" + stop_vpn + start_vpn + eend $? + else + ebegin "Reloading ${DESC} VPN: ${NAME}" + stop_configd + start_configd + eend $? + fi + done + else + if test -e ${VARRUN_DIR}/${VPN}.pid ; then + PIDFILE=${VARRUN_DIR}/${VPN}.pid + NAME=`basename $PIDFILE .pid` + if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then + ebegin "Reloading ${DESC} VPN: ${NAME}" + stop_vpn + start_vpn + eend $? + else + ebegin "Reloading ${DESC} VPN: ${NAME}" + stop_configd + start_configd + eend $? + fi + else + eerror "failure: No such tunnel is running: $VPN" + fi + fi +} diff --git a/testing/anytun/boost-mt.patch b/testing/anytun/boost-mt.patch new file mode 100644 index 0000000000..9596d4c234 --- /dev/null +++ b/testing/anytun/boost-mt.patch @@ -0,0 +1,26 @@ +diff --git a/src/anyrtpproxy/Makefile b/src/anyrtpproxy/Makefile +index ef15ff3..190cb9d 100644 +--- a/src/anyrtpproxy/Makefile ++++ b/src/anyrtpproxy/Makefile +@@ -47,7 +47,7 @@ CFLAGS = -g -Wall + CXX = g++ + CXXFLAGS = -g -Wall + LD = g++ +-LDFLAGS = -g -Wall -O2 -lboost_thread -lboost_serialization -lboost_system ++LDFLAGS = -g -Wall -O2 -lboost_thread-mt -lboost_serialization -lboost_system + + OBJS = anyrtpproxy.o \ + ../signalController.o \ +diff --git a/src/configure b/src/configure +index f070150..eb4e131 100755 +--- a/src/configure ++++ b/src/configure +@@ -215,7 +215,7 @@ case $TARGET in + ln -sf posix/posixDaemon.h daemonService.h + ln -sf posix/posixDaemon.cpp daemonService.cpp + echo "loading Linux specific TUN Device" +- LDFLAGS=$LDFLAGS' -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread' ++ LDFLAGS=$LDFLAGS' -lboost_thread-mt -lboost_serialization -lboost_system -lboost_date_time -lpthread' + LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT' + ;; + OpenBSD|FreeBSD|NetBSD|GNU/kFreeBSD) |