diff options
author | root <root@rshg047.dnsready.net> | 2011-05-15 22:39:31 +0000 |
---|---|---|
committer | root <root@rshg047.dnsready.net> | 2011-05-15 22:39:31 +0000 |
commit | a45aa8f19ea32f45610dafabfc06c8b7d1ed5cfe (patch) | |
tree | 3855efd25da6fab2bbaf889a2090a44a9faab93f /testing/openvpn | |
parent | e69c538fc7af5a9861c7688dd15913082d978180 (diff) |
Sun May 15 22:39:30 UTC 2011
Diffstat (limited to 'testing/openvpn')
-rw-r--r-- | testing/openvpn/PKGBUILD | 61 | ||||
-rw-r--r-- | testing/openvpn/openvpn-tapdev.conf | 12 | ||||
-rwxr-xr-x | testing/openvpn/openvpn-tapdev.rc | 40 | ||||
-rwxr-xr-x | testing/openvpn/openvpn.rc | 43 |
4 files changed, 156 insertions, 0 deletions
diff --git a/testing/openvpn/PKGBUILD b/testing/openvpn/PKGBUILD new file mode 100644 index 000000000..d0d7111b6 --- /dev/null +++ b/testing/openvpn/PKGBUILD @@ -0,0 +1,61 @@ +# $Id: PKGBUILD 123913 2011-05-14 10:10:30Z thomas $ +# Maintainer: Thomas Bächler <thomas@archlinux.org> + +pkgname=openvpn +pkgver=2.2.0 +pkgrel=1 +pkgdesc="An easy-to-use, robust, and highly configurable VPN (Virtual Private Network)" +arch=(i686 x86_64) +url="http://openvpn.net/index.php/open-source.html" +depends=('openssl' 'lzo2') +license=('custom') +backup=(usr/share/openvpn/easy-rsa/vars + usr/share/openvpn/easy-rsa/openssl.cnf + etc/conf.d/openvpn-tapdev) +source=(http://swupdate.openvpn.net/community/releases/openvpn-${pkgver}.tar.gz + openvpn.rc + openvpn-tapdev.rc + openvpn-tapdev.conf) +md5sums=('4f440603eac45fec7be218b87d570834' + 'a3809b9727f0c2af2d0770f5c7442db2' + 'd2c48e970088d679dd3c2afd914ff731' + '722f483c9e3ce2ec66d3301aaf7cf3d5') + +build() { + cd $srcdir/$pkgname-$pkgver + # Build openvpn + CFLAGS="$CFLAGS -DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn\\\"" ./configure --prefix=/usr --enable-password-save --mandir=/usr/share/man + make + + # Build plugins + for plug in auth-pam down-root; do + cd $srcdir/$pkgname-$pkgver/plugin/$plug + make + done +} + +package() { + cd $srcdir/$pkgname-$pkgver + # Install openvpn + make DESTDIR=$pkgdir install + install -d -m755 $pkgdir/etc/openvpn + # Install examples + install -d -m755 $pkgdir/usr/share/openvpn + cp -r sample-config-files $pkgdir/usr/share/openvpn/examples + find $pkgdir/usr/share/openvpn -type f -exec chmod 644 {} \; + find $pkgdir/usr/share/openvpn -type d -exec chmod 755 {} \; + # Install license + install -D -m644 COPYING $pkgdir/usr/share/licenses/$pkgname/COPYING + # Install plugins + for plug in auth-pam down-root; do + cd $srcdir/$pkgname-$pkgver/plugin/$plug + install -D -m755 openvpn-$plug.so $pkgdir/usr/lib/openvpn/openvpn-$plug.so + done + # Install easy-rsa + cd $srcdir/$pkgname-$pkgver + make -C easy-rsa/2.0 install DESTDIR=$pkgdir PREFIX=usr/share/openvpn/easy-rsa + # Install rc scripts + install -D -m755 $srcdir/openvpn.rc $pkgdir/etc/rc.d/openvpn + install -D -m755 $srcdir/openvpn-tapdev.rc $pkgdir/etc/rc.d/openvpn-tapdev + install -D -m644 $srcdir/openvpn-tapdev.conf $pkgdir/etc/conf.d/openvpn-tapdev +} diff --git a/testing/openvpn/openvpn-tapdev.conf b/testing/openvpn/openvpn-tapdev.conf new file mode 100644 index 000000000..afa5586dd --- /dev/null +++ b/testing/openvpn/openvpn-tapdev.conf @@ -0,0 +1,12 @@ +# +# /etc/conf.d/openvpn-tapdev +# +# Place openvpn-tapdev before network into your DAEMONS array +# This will create permanent tap devices which you can use for bridging +# +# Example: +# TAPDEVS="work home" +# Will create two tap devices "work" and "home" +# + +TAPDEVS="" diff --git a/testing/openvpn/openvpn-tapdev.rc b/testing/openvpn/openvpn-tapdev.rc new file mode 100755 index 000000000..2c51f8248 --- /dev/null +++ b/testing/openvpn/openvpn-tapdev.rc @@ -0,0 +1,40 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +. /etc/conf.d/openvpn-tapdev + +case "$1" in + start) + stat_busy "Creating tap devices for OpenVPN ... " + success=0 + for tapdev in ${TAPDEVS}; do + stat_append "${tapdev} " + /usr/sbin/openvpn --mktun --dev-type tap --dev ${tapdev} >/dev/null 2>&1 || success=$? + done + if [ $success -eq 0 ]; then + add_daemon openvpn-tapdev + stat_done + else + stat_fail + fi + ;; + stop) + stat_busy "Destroying tap devices for OpenVPN ..." + for tapdev in ${TAPDEVS}; do + stat_append "${tapdev} " + /usr/sbin/openvpn --rmtun --dev-type tap --dev ${tapdev} >/dev/null 2>&1 || success=$? + done + rm_daemon openvpn-tapdev + stat_done + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/testing/openvpn/openvpn.rc b/testing/openvpn/openvpn.rc new file mode 100755 index 000000000..96c28b641 --- /dev/null +++ b/testing/openvpn/openvpn.rc @@ -0,0 +1,43 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +CFGDIR="/etc/openvpn" +STATEDIR="/var/run/openvpn" + +case "$1" in + start) + stat_busy "Starting OpenVPN ... " + success=0 + mkdir -p "${STATEDIR}" + for cfg in "${CFGDIR}"/*.conf; do + stat_append "$(basename "${cfg}" .conf) " + /usr/sbin/openvpn --daemon --writepid "${STATEDIR}"/"$(basename "${cfg}" .conf)".pid --cd "${CFGDIR}" --config "${cfg}" || success=$? + done + if [ $success -eq 0 ]; then + add_daemon openvpn + stat_done + else + stat_fail + fi + ;; + stop) + stat_busy "Stopping OpenVPN ..." + for pidfile in "${STATEDIR}"/*.pid; do + stat_append "$(basename "${pidfile}" .pid) " + kill $(cat "${pidfile}" 2>/dev/null) 2>/dev/null + rm -f "${pidfile}" + done + rm_daemon openvpn + stat_done + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 |