diff options
author | Michael Mason <ms13sp@gmail.com> | 2009-03-17 14:10:35 +0000 |
---|---|---|
committer | Michael Mason <ms13sp@gmail.com> | 2009-03-17 14:10:35 +0000 |
commit | d934c95f9511d62620b63fa050b29605ed2c1a06 (patch) | |
tree | 174328bbca58d44d7c23c56aa2ce1a542c8296c2 /testing | |
parent | f02160281491e668a52a1a2d847e19c68cb18e1c (diff) | |
download | aports-d934c95f9511d62620b63fa050b29605ed2c1a06.tar.bz2 aports-d934c95f9511d62620b63fa050b29605ed2c1a06.tar.xz |
testing/openvpn Initial Commit
Diffstat (limited to 'testing')
-rw-r--r-- | testing/openvpn/APKBUILD | 31 | ||||
-rw-r--r-- | testing/openvpn/openvpn.initd | 63 |
2 files changed, 94 insertions, 0 deletions
diff --git a/testing/openvpn/APKBUILD b/testing/openvpn/APKBUILD new file mode 100644 index 00000000..b5b1c45a --- /dev/null +++ b/testing/openvpn/APKBUILD @@ -0,0 +1,31 @@ +# Contributor: Michael Mason <ms13sp@gmail.com> +# Maintainer: +pkgname=openvpn +pkgver=2.0.9 +pkgrel=0 +pkgdesc="Full featured SSL VPN solution" +url="http://openvpn.net" +license="GPL" +depends="uclibc openssl" +makedepends="openssl-dev lzo-dev" +install= +subpackages="$pkgname-doc" +source="http://openvpn.net/release/openvpn-2.0.9.tar.gz + openvpn.initd" + + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 + make DESTDIR="$pkgdir" install + + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname +} + +md5sums="60745008b90b7dbe25fe8337c550fec6 openvpn-2.0.9.tar.gz +10390247d1fdc4fd1ebec1ebae8872be openvpn.initd" diff --git a/testing/openvpn/openvpn.initd b/testing/openvpn/openvpn.initd new file mode 100644 index 00000000..a6e4529e --- /dev/null +++ b/testing/openvpn/openvpn.initd @@ -0,0 +1,63 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +VPNDIR="/etc/openvpn" +VPN="${SVCNAME#*.}" +if [ -n "${VPN}" ] && [ "${SVCNAME}" != "openvpn" ]; then + VPNPID="/var/run/openvpn.${VPN}.pid" +else + VPNPID="/var/run/openvpn.pid" +fi +VPNCONF="${VPNDIR}/${VPN}.conf" + +depend() { + need localmount net + before netmount + after bootmisc +} + +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 +} + +start() { + ebegin "Starting ${SVCNAME}" + + checktundevice || return 1 + + if [ ! -e "${VPNCONF}" ]; then + eend 1 "${VPNCONF} does not exist" + return 1 + fi + + local args="" + # If the config file does not specify the cd option, we do + # But if we specify it, we override the config option which we do not want + if ! grep -q "^[ \t]*cd[ \t].*" "${VPNCONF}" ; then + args="${args} --cd ${VPNDIR}" + fi + + start-stop-daemon --start --exec /usr/sbin/openvpn --pidfile "${VPNPID}" \ + -- --config "${VPNCONF}" --writepid "${VPNPID}" --daemon ${args} + eend $? "Check your logs to see why startup failed" +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec /usr/sbin/openvpn --pidfile "${VPNPID}" + eend $? +} + +# vim: ts=4 |