New init script which allows more granular control of seperate vpns, #105439
authorRoy Marples <uberlord@gentoo.org>
Thu, 13 Oct 2005 14:09:10 +0000 (14:09 +0000)
committerRoy Marples <uberlord@gentoo.org>
Thu, 13 Oct 2005 14:09:10 +0000 (14:09 +0000)
  Install all docs, #100943
  new iproute2 USE flag, #98782 thanks to Sean Lynn
  new static USE flag, #105479 thanks to Clemens Noss
  new minimal USE flag which decides to build bundled plugins or not, #103711
Package-Manager: portage-2.0.51.22-r3

net-misc/openvpn/ChangeLog
net-misc/openvpn/Manifest
net-misc/openvpn/files/digest-openvpn-2.0.2-r1 [new file with mode: 0644]
net-misc/openvpn/files/openvpn.init [new file with mode: 0644]
net-misc/openvpn/openvpn-2.0.2-r1.ebuild [new file with mode: 0644]

index 6411418c19594bc1ea9317e60323e7e23e8ef7dd..081724412170dd8c5279757bcbbef72c800c0b22 100644 (file)
@@ -1,6 +1,16 @@
 # ChangeLog for net-misc/openvpn
 # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/openvpn/ChangeLog,v 1.42 2005/09/19 21:10:56 seemant Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openvpn/ChangeLog,v 1.43 2005/10/13 14:09:10 uberlord Exp $
+
+*openvpn-2.0.2-r1 (13 Oct 2005)
+
+  13 Oct 2005; Roy Marples <uberlord@gentoo.org> +files/openvpn.init,
+  +openvpn-2.0.2-r1.ebuild:
+  New init script which allows more granular control of seperate vpns, #105439
+  Install all docs, #100943
+  new iproute2 USE flag, #98782 thanks to Sean Lynn
+  new static USE flag, #105479 thanks to Clemens Noss
+  new minimal USE flag which decides to build bundled plugins or not, #103711
 
 *openvpn-2.0.2 (19 Sep 2005)
 
index 13666a8960c2045b790fe58a0dcf24771159a070..03f6dfbc1dad85aadcf4d6ffe111f5277c5ba3f2 100644 (file)
@@ -1,11 +1,14 @@
-MD5 97eb6ac27ef53276153e2338718596f9 ChangeLog 6152
-MD5 41623f5bd4f728bd9018e69514149bc5 metadata.xml 452
 MD5 57db3db67cafcb3a5bb7a07eb4a3b884 openvpn-1.5.0-r1.ebuild 1334
+MD5 39940f47a19b6f46fd8bef9cc133d15b openvpn-2.0.2.ebuild 2164
+MD5 41623f5bd4f728bd9018e69514149bc5 metadata.xml 452
+MD5 c4cf5c922717624e4c8b92f50383c540 ChangeLog 6576
 MD5 c0bb9d10424cda8d9361368015b324ca openvpn-1.6.0.ebuild 1338
 MD5 eb2aeb437e7815de4810170acb79480c openvpn-2.0.1.ebuild 2159
-MD5 39940f47a19b6f46fd8bef9cc133d15b openvpn-2.0.2.ebuild 2164
-MD5 51eea8a2c9a5189571de49ad32b88ac1 files/digest-openvpn-1.5.0-r1 65
+MD5 81b01ca22902874afb3466dedf933b40 openvpn-2.0.2-r1.ebuild 3290
 MD5 64180e225493c8fc2e085071ff65897b files/digest-openvpn-1.6.0 65
 MD5 e173c8d27fc623ce79d2c5e83854b28a files/openvpn 1318
+MD5 22b600fc5b49888e4032bf15806854bd files/openvpn.init 974
 MD5 7668c8296962628c96186d860d6a878d files/digest-openvpn-2.0.1 65
+MD5 378f09becb8ef03cad8e76a44c7210f9 files/digest-openvpn-2.0.2-r1 65
+MD5 51eea8a2c9a5189571de49ad32b88ac1 files/digest-openvpn-1.5.0-r1 65
 MD5 378f09becb8ef03cad8e76a44c7210f9 files/digest-openvpn-2.0.2 65
diff --git a/net-misc/openvpn/files/digest-openvpn-2.0.2-r1 b/net-misc/openvpn/files/digest-openvpn-2.0.2-r1
new file mode 100644 (file)
index 0000000..02f141c
--- /dev/null
@@ -0,0 +1 @@
+MD5 862f8788f080f669b1ae00a74ef68001 openvpn-2.0.2.tar.gz 663246
diff --git a/net-misc/openvpn/files/openvpn.init b/net-misc/openvpn/files/openvpn.init
new file mode 100644 (file)
index 0000000..7e148c3
--- /dev/null
@@ -0,0 +1,47 @@
+#!/sbin/runscript
+
+VPNDIR="/etc/openvpn"
+VPN="${myservice##*.}"
+if [[ -n ${VPN} && ${myservice} != "openvpn" ]]; then
+       VPNPID="/var/run/openvpn.${VPN}.pid"
+else
+       VPNPID="/var/run/openvpn.pid"
+fi
+VPNCONF="${VPNDIR}/${VPN}.conf"
+
+depend() {
+       need net
+}
+
+checktundevice() {
+       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() {
+       checktundevice || return 1
+
+       ebegin "Starting ${myservice}"
+       
+       if [[ ! -e "${VPNCONF}" ]]; then
+               eend 1 "${VPNCONF} does not exist"
+               return 1
+       fi
+               
+       start-stop-daemon --start --exec /usr/sbin/openvpn --pidfile "${VPNPID}" \
+               -- --config "${VPNCONF}" --writepid "${VPNPID}" \
+               --daemon --cd "${VPNDIR}"
+       eend $? "Check your logs to see why startup failed"
+}
+
+stop() {
+       ebegin "Stopping ${myservice}"
+       start-stop-daemon --stop -exec /usr/sbin/openvpn --pidfile "${VPNPID}"
+       eend $?
+}
+
+# vim: ts=4
diff --git a/net-misc/openvpn/openvpn-2.0.2-r1.ebuild b/net-misc/openvpn/openvpn-2.0.2-r1.ebuild
new file mode 100644 (file)
index 0000000..3119a99
--- /dev/null
@@ -0,0 +1,113 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openvpn/openvpn-2.0.2-r1.ebuild,v 1.1 2005/10/13 14:09:10 uberlord Exp $
+
+inherit eutils gnuconfig multilib
+
+DESCRIPTION="OpenVPN is a robust and highly flexible tunneling application compatible with many OSes."
+SRC_URI="http://openvpn.net/release/openvpn-${PV}.tar.gz"
+HOMEPAGE="http://openvpn.net/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ppc ~ppc-macos ~sparc ~x86"
+IUSE="examples iproute2 minimal selinux ssl static threads"
+
+RDEPEND=">=dev-libs/lzo-1.07
+       iproute2? ( sys-apps/iproute2 )
+       selinux? ( sec-policy/selinux-openvpn )
+       ssl? ( >=dev-libs/openssl-0.9.6 )"
+DEPEND="${RDEPEND}
+       virtual/os-headers"
+
+src_unpack() {
+       unpack "${A}"
+       gnuconfig_update
+}
+
+src_compile() {
+       econf \
+               $(use_enable iproute2) \
+               $(use_enable ssl) \
+               $(use_enable ssl crypto) \
+               $(use_enable threads pthread) \
+               || die "configure failed"
+       use static && sed -e -i '/^LIBS/s/LIBS = /LIBS = -static /' Makefile
+       emake || die "make failed"
+
+       if ! use minimal ; then
+               cd plugin
+               for i in $( ls 2>/dev/null ); do
+                       [[ ${i} == "README" || ${i} == "examples" ]] && continue
+                       einfo "Building ${i} plugin"
+                       cd "${i}"
+                       emake || die "make failed"
+                       cd ..
+               done
+               cd ..
+       fi
+}
+
+src_install() {
+       make DESTDIR="${D}" install || die "make install failed"
+
+       # install documentation
+       dodoc AUTHORS ChangeLog INSTALL PORTS README
+
+       # Empty dir
+       dodir /etc/openvpn
+       keepdir /etc/openvpn
+
+       # Install the init script
+       newinitd "${FILESDIR}/openvpn.init" openvpn
+
+       # Install easy-rsa stuffs
+       dodir "/usr/share/${PN}/easy-rsa"
+       exeinto "/usr/share/${PN}/easy-rsa"
+       doexe easy-rsa/2.0/*
+       exeopts -m0644
+
+       # install examples, controlled by the respective useflag
+       if use examples ; then
+               docinto examples
+               dodoc -r sample-{config-files,keys,scripts} contrib
+       fi
+
+       # Install plugins
+       if ! use minimal ; then
+               dodir "/usr/share/${PN}/plugins"
+               exeinto "/usr/share/${PN}/plugins"
+               doexe plugin/*/*.so
+       fi
+}
+
+pkg_postinst() {
+       ewarn "WARNING: The openvpn init script has changed"
+       ewarn ""
+       einfo "The openvpn init script expects to find the configuration file"
+       einfo "openvpn.conf in /etc/openvpn along with any extra files it may need."
+       einfo ""
+       einfo "To create more VPNs, simply create a new .conf file for it and"
+       einfo "then create a symlink to the openvpn init script from a link called"
+       einfo "openvpn.newconfname - like so"
+       einfo "   cd /etc/openvpn"
+       einfo "   ${EDITOR##*/} foo.conf"
+       einfo "   cd /etc/init.d"
+       einfo "   ln -s openvpn openvpn.foo"
+       einfo ""
+       einfo "You can then treat openvpn.foo as any other service, so you can"
+       einfo "stop one vpn and start another if you need to."
+       if ! use minimal ; then
+               einfo ""
+               einfo "plugins have been installed into /usr/$(get_libdir)/${PN}"
+       fi
+       einfo ""
+       einfo "It is recommended that you create your tun/tap interfaces using"
+       einfo "the net.tun0/net.tap0 scripts provided by baselayout instead of"
+       einfo "using the 'server' directive in openvpn configuration files."
+       einfo "This will insure that the interface really is up after openvpn"
+       einfo "starts."
+       einfo "Note that you cannot use net.tun0/net.tap0 and the server option,"
+       einfo "otherwise openvpn will not start."
+       ebeep
+}