diff options
author | Shiz <hi@shiz.me> | 2017-05-20 22:25:28 +0200 |
---|---|---|
committer | Shiz <hi@shiz.me> | 2017-05-20 22:25:28 +0200 |
commit | 2437d87efb4f54b3d3a162e619a36a43f647723b (patch) | |
tree | 52e4cf3213689673d3c208055fbf4dcf50aa6183 /testing | |
parent | f57e5a3db221a55b0526b3b546af47d5c57fe5b4 (diff) | |
download | aports-2437d87efb4f54b3d3a162e619a36a43f647723b.tar.bz2 aports-2437d87efb4f54b3d3a162e619a36a43f647723b.tar.xz |
testing/vpnc: move from unmaintained and modernize
Diffstat (limited to 'testing')
-rw-r--r-- | testing/vpnc/APKBUILD | 40 | ||||
-rw-r--r-- | testing/vpnc/vpnc.confd | 4 | ||||
-rw-r--r-- | testing/vpnc/vpnc.initd | 103 | ||||
-rw-r--r-- | testing/vpnc/working.patch | 32 |
4 files changed, 179 insertions, 0 deletions
diff --git a/testing/vpnc/APKBUILD b/testing/vpnc/APKBUILD new file mode 100644 index 0000000000..d4ef16a361 --- /dev/null +++ b/testing/vpnc/APKBUILD @@ -0,0 +1,40 @@ +# Contributor: Natanael Copa <ncopa@alpinelinux.org> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=vpnc +pkgver=0.5.3 +pkgrel=1 +pkgdesc="IPSec VPN client compatible with Cisco equipment" +url="http://www.unix-ag.uni-kl.de/~massar/vpnc/" +arch="all" +license="GPLv2+" +makedepends="libgcrypt-dev perl" +subpackages="$pkgname-doc" +source="http://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-$pkgver.tar.gz + working.patch + vpnc.initd + vpnc.confd" +builddir="$srcdir"/vpnc-$pkgver + +build() { + cd "$builddir" + make PREFIX=/usr +} + +check() { + cd "$builddir" + ./vpnc --version +} + +package() { + cd "$builddir" + make PREFIX=/usr DESTDIR="$pkgdir" install + install -m755 -D "$srcdir"/vpnc.initd \ + "$pkgdir"/etc/init.d/vpnc + install -m644 -D "$srcdir"/vpnc.confd \ + "$pkgdir"/etc/conf.d/vpnc +} + +sha512sums="fd1251d200c3826ebfd7022683e38912f30c2a95fbc51259bcd1fdf0570ef3c53cd842003c117a770657f7f8ebb00ceffeea91ced0c3f83dd9c1ca0488519ea3 vpnc-0.5.3.tar.gz +6c3eb976d3877b02c751c310f835bc864e4868d167bbaf9f365b9b728d732cc018591e9a8dfc5a4277b01daf070b74f3bb7e67e175b90ee495fecec1a049e29f working.patch +d20091a67ccd3b8e9f31ca47c49577ff3cd5bf6ba9ef7bcd9f03231d87fa64d978c60ab69c67bbafdc18d6474d932d6ec68de02d13bea41ae6a7d31b845635e9 vpnc.initd +1254f687dcd9822becfcccabbb34d8343d715d70247dbf4b5e018835fff24b33f5272368f77199d697c8d11d913182b1f756d5e08a46b2057849779f09b19633 vpnc.confd" diff --git a/testing/vpnc/vpnc.confd b/testing/vpnc/vpnc.confd new file mode 100644 index 0000000000..62789bd407 --- /dev/null +++ b/testing/vpnc/vpnc.confd @@ -0,0 +1,4 @@ +# If you wish to see the output made by vpnc, for example the password +# prompt, set this variable to yes + +VPNCOUTPUT="no" diff --git a/testing/vpnc/vpnc.initd b/testing/vpnc/vpnc.initd new file mode 100644 index 0000000000..53e5f62fa2 --- /dev/null +++ b/testing/vpnc/vpnc.initd @@ -0,0 +1,103 @@ +#!/sbin/openrc-run + +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/vpnc/files/vpnc-3.init,v 1.2 2010/08/13 08:39:48 fauli Exp $ + +VPNDIR="/etc/vpnc" +VPN="${SVCNAME#*.}" +if [ -n ${VPN} ] && [ ${SVCNAME} != "vpnc" ]; then + mkdir -p /var/run/vpnc + VPNPID="/var/run/vpnc/${VPN}.pid" +else + VPNPID="/var/run/vpnc.pid" +fi +VPNCONF="${VPNDIR}/${VPN}.conf" +VPNSCRIPTDIR="${VPNDIR}/scripts.d" +PREUPSCRIPT="${VPNSCRIPTDIR}/${VPN}-preup.sh" +PREDOWNSCRIPT="${VPNSCRIPTDIR}/${VPN}-predown.sh" +POSTUPSCRIPT="${VPNSCRIPTDIR}/${VPN}-postup.sh" +POSTDOWNSCRIPT="${VPNSCRIPTDIR}/${VPN}-postdown.sh" +# We should source this file to avoid problems when init script +# name differs from the default name +. /etc/conf.d/vpnc + +depend() { + need net + before netmount +} + +checktundevice() { + if [ ! -e /dev/net/tun ]; then + if ! modprobe tun ; then + eerror "TUN/TAP support is not available in this kernel" + return 1 + fi + fi + if [ -h /dev/net/tun ] && [ -c /dev/misc/net/tun ]; then + ebegin "Detected broken /dev/net/tun symlink, fixing..." + rm -f /dev/net/tun + ln -s /dev/misc/net/tun /dev/net/tun + eend $? + fi +} + +screenoutput() { + if [ "${VPNCOUTPUT}" = "yes" ]; then + export SCREEN_OUTPUT="/dev/stdout" + else + export SCREEN_OUTPUT="/dev/null" + fi +} + +start() { + ebegin "Starting VPNC: ${VPN}" + + checktundevice || return 1 + screenoutput + + if [ ! -e "${VPNCONF}" ]; then + eend 1 "${VPNCONF} does not exist" + return 1 + fi + + local args="" + + if [ -x "${PREUPSCRIPT}" ] ; then + "${PREUPSCRIPT}" > ${SCREEN_OUTPUT} + fi + + start-stop-daemon --start --pidfile "${VPNPID}" --exec /usr/sbin/vpnc \ + -- --pid-file "${VPNPID}" "${VPNCONF}" > ${SCREEN_OUTPUT} + local retval=$? + if [ ! ${retval} -eq 0 ]; then + eend ${retval} + return ${retval} + fi + + if [ -x "${POSTUPSCRIPT}" ] ; then + "${POSTUPSCRIPT}" > ${SCREEN_OUTPUT} + fi + eend $? +} + +stop() { + ebegin "Stopping VPNC: ${VPN}" + screenoutput + if [ -x "${PREDOWNSCRIPT}" ] ; then + "${PREDOWNSCRIPT}" > ${SCREEN_OUTPUT} + fi + + start-stop-daemon --stop --pidfile "${VPNPID}" + local retval=$? + if [ ! ${retval} -eq 0 ]; then + eend ${retval} + return ${retval} + fi + + + if [ -x "${POSTDOWNSCRIPT}" ] ; then + "${POSTDOWNSCRIPT}" > ${SCREEN_OUTPUT} + fi + eend $? +} diff --git a/testing/vpnc/working.patch b/testing/vpnc/working.patch new file mode 100644 index 0000000000..2a6e1a19a2 --- /dev/null +++ b/testing/vpnc/working.patch @@ -0,0 +1,32 @@ +diff --git a/sysdep.c b/sysdep.c +index ff07753..43fdb74 100644 +--- a/sysdep.c ++++ b/sysdep.c +@@ -59,7 +59,7 @@ + #if defined(__DragonFly__) + #include <net/tun/if_tun.h> + #elif defined(__linux__) +-#include <linux/if_tun.h> ++/*#include <linux/if_tun.h>*/ + #elif defined(__APPLE__) + /* no header for tun */ + #elif defined(__CYGWIN__) +diff --git a/sysdep.h b/sysdep.h +index a5eafd6..af34e94 100644 +--- a/sysdep.h ++++ b/sysdep.h +@@ -38,11 +38,13 @@ int tun_get_hwaddr(int fd, char *dev, uint8_t *hwaddr); + + /***************************************************************************/ + #if defined(__linux__) || defined(__GLIBC__) ++#ifdef __GLIBC__ + #include <error.h> ++#define HAVE_ERROR 1 ++#endif + + #define HAVE_VASPRINTF 1 + #define HAVE_ASPRINTF 1 +-#define HAVE_ERROR 1 + #define HAVE_GETLINE 1 + #define HAVE_UNSETENV 1 + #define HAVE_SETENV 1 |