From bec4b1c275b9d56670b86ad6232534eaaff8e8d6 Mon Sep 17 00:00:00 2001 From: hasufell Date: Wed, 17 Feb 2016 12:26:25 +0100 Subject: [PATCH] net-misc/badvpn: initial import of version 1.999.130 --- metadata/accounts/groups/badvpn.conf | 0 metadata/accounts/users/badvpn.conf | 4 + .../badvpn/badvpn-1.999.130.exheres-0 | 92 +++++++++++++++++++ .../badvpn/files/badvpn-1.999.127-ncd.init | 24 +++++ .../net-misc/badvpn/files/badvpn-ncd.conf | 11 +++ .../net-misc/badvpn/files/badvpn-ncd.init | 48 ++++++++++ .../net-misc/badvpn/files/badvpn-server.conf | 11 +++ .../net-misc/badvpn/files/badvpn-server.init | 48 ++++++++++ .../badvpn/files/systemd/badvpn-ncd.service | 11 +++ 9 files changed, 249 insertions(+) create mode 100644 metadata/accounts/groups/badvpn.conf create mode 100644 metadata/accounts/users/badvpn.conf create mode 100644 packages/net-misc/badvpn/badvpn-1.999.130.exheres-0 create mode 100644 packages/net-misc/badvpn/files/badvpn-1.999.127-ncd.init create mode 100644 packages/net-misc/badvpn/files/badvpn-ncd.conf create mode 100644 packages/net-misc/badvpn/files/badvpn-ncd.init create mode 100644 packages/net-misc/badvpn/files/badvpn-server.conf create mode 100644 packages/net-misc/badvpn/files/badvpn-server.init create mode 100644 packages/net-misc/badvpn/files/systemd/badvpn-ncd.service diff --git a/metadata/accounts/groups/badvpn.conf b/metadata/accounts/groups/badvpn.conf new file mode 100644 index 0000000..e69de29 diff --git a/metadata/accounts/users/badvpn.conf b/metadata/accounts/users/badvpn.conf new file mode 100644 index 0000000..6467054 --- /dev/null +++ b/metadata/accounts/users/badvpn.conf @@ -0,0 +1,4 @@ +gecos = User for badvpn +home = /dev/null +shell = /sbin/nologin +primary_group = badvpn diff --git a/packages/net-misc/badvpn/badvpn-1.999.130.exheres-0 b/packages/net-misc/badvpn/badvpn-1.999.130.exheres-0 new file mode 100644 index 0000000..557ba67 --- /dev/null +++ b/packages/net-misc/badvpn/badvpn-1.999.130.exheres-0 @@ -0,0 +1,92 @@ +# Copyright 2016 Julian Ospald +# Distributed under the terms of the GNU General Public License v2 +# +# Partly based on badvpn-1.999.130.ebuild which is: +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +require cmake + +MY_P=${PN}-${PV/_rc/rc} +SUMMARY="Peer-to-peer VPN, NCD scripting language, tun2socks proxifier" +DESCRIPTION=" + BadVPN is an open-source peer-to-peer VPN system. It provides a + Layer 2 (Ethernet) network between the peers (VPN nodes). The peers + connect to a central server which acts as a chat server for them to + establish direct connections between each other (data connections). + These connections are used for transferring network data (Ethernet + frames), and can be secured with a multitude of mechanisms. + + The BadVPN package also includes other network-related software, + like tun2socks and NCD. +" +HOMEPAGE="https://github.com/ambrop72/badvpn https://code.google.com/p/badvpn/" +DOWNLOADS="https://github.com/ambrop72/badvpn/archive/${PV}.tar.gz -> ${PNV}.tar.gz" + +LICENCES="BSD-3" +PLATFORMS="~amd64 ~x86" +SLOT="0" + +MYOPTIONS=" + ncd [[ description = [ Build NCD, a lightweight scripting language + especially suited for network configurations ] ]] + tun2socks [[ description = [ Build tun2socks, a program which implements + a TUN device that forwards TCP traffic through + a SOCKS5 server ] ]] + udpgw [[ description = [ Build udpgw, a small daemon which allows + tun2socks to forward UDP traffic ] ]] + ( providers: libressl openssl ) [[ number-selected = exactly-one ]] + ( providers: eudev systemd ) [[ number-selected = exactly-one ]] +" + +DEPENDENCIES=" + build+run: + dev-libs/nspr + dev-libs/nss + providers:libressl? ( dev-libs/libressl:= ) + providers:openssl? ( dev-libs/openssl ) + run: + group/badvpn + user/badvpn + ncd? ( + sys-apps/iproute2 + providers:eudev? ( sys-apps/eudev ) + providers:systemd? ( sys-apps/systemd ) + ) + build: + virtual/pkg-config +" + +WORK=${WORKBASE}/${MY_P} + +CMAKE_SRC_CONFIGURE_PARAMS=( + -DBUILD_NOTHING_BY_DEFAULT=1 + -DBUILD_CLIENT=ON + -DBUILD_SERVER=ON +) + +CMAKE_SRC_CONFIGURE_OPTIONS=( + 'ncd BUILD_NCD' + 'tun2socks BUILD_TUN2SOCKS' + 'udpgw BUILD_UDPGW' +) + +src_install() { + cmake_src_install + dodoc ChangeLog + + exeinto /etc/init.d + newexe "${FILES}"/${PN}-server.init ${PN}-server + insinto /etc/conf.d + newins "${FILES}"/${PN}-server.conf ${PN}-server + + if option ncd; then + exeinto /etc/init.d + newexe "${FILES}"/${PN}-1.999.127-ncd.init ${PN}-ncd + insinto /etc/conf.d + newins "${FILES}"/${PN}-ncd.conf ${PN}-ncd + install_systemd_files + fi +} + diff --git a/packages/net-misc/badvpn/files/badvpn-1.999.127-ncd.init b/packages/net-misc/badvpn/files/badvpn-1.999.127-ncd.init new file mode 100644 index 0000000..509a17f --- /dev/null +++ b/packages/net-misc/badvpn/files/badvpn-1.999.127-ncd.init @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Released under the 3-clause BSD license. + +command="${ncd_exec:-"/usr/bin/badvpn-ncd"}" +command_args="${ncd_args} --config-file ${ncd_config:-/etc/ncd.conf}" +command_background="YES" +description="Network Configuration Daemon" +pidfile="/var/run/${RC_SVCNAME}.pid" + +depend() { + need localmount + after bootmisc + before netmount +} + +start_pre() { + if yesno "${ncd_syslog:-NO}"; then + command_args="${command_args} + --logger syslog + --syslog-ident \"${ncd_syslog_ident:-${RC_SVCNAME}}\" + --channel-loglevel ncd_log_msg info" + fi +} diff --git a/packages/net-misc/badvpn/files/badvpn-ncd.conf b/packages/net-misc/badvpn/files/badvpn-ncd.conf new file mode 100644 index 0000000..ad34c66 --- /dev/null +++ b/packages/net-misc/badvpn/files/badvpn-ncd.conf @@ -0,0 +1,11 @@ +# NCD program file. +#ncd_config="/etc/ncd.conf" + +# enable or disable syslog. +#ncd_syslog="NO" + +# Syslog identification. +#ncd_syslog_ident="ncd" + +# Additional arguments. +#ncd_args="" diff --git a/packages/net-misc/badvpn/files/badvpn-ncd.init b/packages/net-misc/badvpn/files/badvpn-ncd.init new file mode 100644 index 0000000..e07af67 --- /dev/null +++ b/packages/net-misc/badvpn/files/badvpn-ncd.init @@ -0,0 +1,48 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Released under the 3-clause BSD license. + +command="${ncd_exec:-"/usr/bin/badvpn-ncd"}" +command_args="${ncd_args} --config-file ${ncd_config:-/etc/ncd.conf}" +command_background="YES" +description="Network Configuration Daemon" +pidfile="/var/run/${RC_SVCNAME}.pid" + +depend() { + need localmount + after bootmisc + before netmount + if yesno "${ncd_syslog:-NO}"; then + use logger + fi +} + +start_pre() { + if yesno "${ncd_syslog:-NO}"; then + command_args="${command_args} + --logger syslog + --syslog-ident \"${ncd_syslog_ident:-${RC_SVCNAME}}\"" + fi +} + +start() +{ + [ -n "$command" ] || return 0 + local _background= + ebegin "Starting ${name:-$RC_SVCNAME}" + if yesno "${command_background}"; then + if [ -z "${pidfile}" ]; then + eend 1 "command_background option used but no pidfile specified" + return 1 + fi + _background="--background --make-pidfile" + fi + eval start-stop-daemon --start \ + --exec $command \ + ${procname:+--name} $procname \ + ${pidfile:+--pidfile} $pidfile \ + $_background $start_stop_daemon_args \ + -- $command_args + eend $? "Failed to start $RC_SVCNAME" + return $? +} diff --git a/packages/net-misc/badvpn/files/badvpn-server.conf b/packages/net-misc/badvpn/files/badvpn-server.conf new file mode 100644 index 0000000..ed5103d --- /dev/null +++ b/packages/net-misc/badvpn/files/badvpn-server.conf @@ -0,0 +1,11 @@ +# User account to run server as. +#vpn_user="badvpn" + +# Enable or disable syslog. +#vpn_syslog="NO" + +# Syslog identification. +#vpn_syslog_ident="badvpn-server" + +# Arguments to badvpn-server. +vpn_args="--listen-addr 0.0.0.0:7179" diff --git a/packages/net-misc/badvpn/files/badvpn-server.init b/packages/net-misc/badvpn/files/badvpn-server.init new file mode 100644 index 0000000..94e3518 --- /dev/null +++ b/packages/net-misc/badvpn/files/badvpn-server.init @@ -0,0 +1,48 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Released under the 3-clause BSD license. + +command="${vpn_exec:-/usr/bin/badvpn-server}" +command_args="${vpn_args}" +command_background="YES" +description="BadVPN server" +pidfile="/var/run/${RC_SVCNAME}.pid" +start_stop_daemon_args="--user \"${vpn_user:-badvpn}\"" + +depend() { + need localmount + after bootmisc + if yesno "${vpn_syslog:-NO}"; then + use logger + fi +} + +start_pre() { + if yesno "${vpn_syslog:-NO}"; then + command_args="${command_args} + --logger syslog + --syslog-ident \"${vpn_syslog_ident:-${RC_SVCNAME}}\"" + fi +} + +start() +{ + [ -n "$command" ] || return 0 + local _background= + ebegin "Starting ${name:-$RC_SVCNAME}" + if yesno "${command_background}"; then + if [ -z "${pidfile}" ]; then + eend 1 "command_background option used but no pidfile specified" + return 1 + fi + _background="--background --make-pidfile" + fi + eval start-stop-daemon --start \ + --exec $command \ + ${procname:+--name} $procname \ + ${pidfile:+--pidfile} $pidfile \ + $_background $start_stop_daemon_args \ + -- $command_args + eend $? "Failed to start $RC_SVCNAME" + return $? +} diff --git a/packages/net-misc/badvpn/files/systemd/badvpn-ncd.service b/packages/net-misc/badvpn/files/systemd/badvpn-ncd.service new file mode 100644 index 0000000..6ca7aa5 --- /dev/null +++ b/packages/net-misc/badvpn/files/systemd/badvpn-ncd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Network Configuation Daemon +After=syslog.target + +[Service] +ExecStart=/usr/bin/badvpn-ncd --logger syslog --syslog-ident ncd --loglevel warning --channel-loglevel ncd_log_msg info /etc/ncd.conf +Restart=always + +[Install] +WantedBy=multi-user.target +