diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2011-07-22 17:17:54 +0200 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-07-26 08:21:29 +0200 |
commit | 73e0b9d1c2003c9ef5e7ac4aca06687469bb2161 (patch) | |
tree | 4c1e10e8a0e7a26a5f4c650452e1d0c6b416d80e | |
parent | 3fa3d6505e42de7300204f4efb47878eb7f8f682 (diff) | |
download | meta-openembedded-73e0b9d1c2003c9ef5e7ac4aca06687469bb2161.tar.gz |
openvpn: import from openembedded
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
-rw-r--r-- | meta-oe/recipes-connectivity/openvpn/openvpn.inc | 23 | ||||
-rwxr-xr-x | meta-oe/recipes-connectivity/openvpn/openvpn/openvpn | 104 | ||||
-rw-r--r-- | meta-oe/recipes-connectivity/openvpn/openvpn_2.1.3.bb | 26 |
3 files changed, 153 insertions, 0 deletions
diff --git a/meta-oe/recipes-connectivity/openvpn/openvpn.inc b/meta-oe/recipes-connectivity/openvpn/openvpn.inc new file mode 100644 index 000000000..68bfc5171 --- /dev/null +++ b/meta-oe/recipes-connectivity/openvpn/openvpn.inc | |||
@@ -0,0 +1,23 @@ | |||
1 | DESCRIPTION = "A full-featured SSL VPN solution via tun device." | ||
2 | HOMEPAGE = "http://openvpn.sourceforge.net" | ||
3 | SECTION = "console/network" | ||
4 | LICENSE = "GPLv2" | ||
5 | PRIORITY = "optional" | ||
6 | DEPENDS = "lzo openssl" | ||
7 | RRECOMMENDS_${PN} = "kernel-module-tun" | ||
8 | |||
9 | INC_PR = "r2" | ||
10 | |||
11 | SRC_URI = "http://openvpn.net/release/openvpn-${PV}.tar.gz \ | ||
12 | file://openvpn" | ||
13 | S = "${WORKDIR}/openvpn-${PV}" | ||
14 | |||
15 | CFLAGS += "-fno-inline" | ||
16 | |||
17 | inherit autotools | ||
18 | |||
19 | do_install_append() { | ||
20 | install -d ${D}/${sysconfdir}/init.d | ||
21 | install -d ${D}/${sysconfdir}/openvpn | ||
22 | install -m 755 ${WORKDIR}/openvpn ${D}/${sysconfdir}/init.d | ||
23 | } | ||
diff --git a/meta-oe/recipes-connectivity/openvpn/openvpn/openvpn b/meta-oe/recipes-connectivity/openvpn/openvpn/openvpn new file mode 100755 index 000000000..a3cd6a2f4 --- /dev/null +++ b/meta-oe/recipes-connectivity/openvpn/openvpn/openvpn | |||
@@ -0,0 +1,104 @@ | |||
1 | #!/bin/sh -e | ||
2 | # | ||
3 | # Original version by Robert Leslie | ||
4 | # <rob@mars.org>, edited by iwj and cs | ||
5 | # Modified for openvpn by Alberto Gonzalez Iniesta <agi@agi.as> | ||
6 | # Modified for restarting / starting / stopping single tunnels by Richard Mueller <mueller@teamix.net> | ||
7 | |||
8 | test $DEBIAN_SCRIPT_DEBUG && set -v -x | ||
9 | |||
10 | DAEMON=/usr/sbin/openvpn | ||
11 | CONFIG_DIR=/etc/openvpn | ||
12 | test -x $DAEMON || exit 0 | ||
13 | test -d $CONFIG_DIR || exit 0 | ||
14 | |||
15 | start_vpn () { | ||
16 | modprobe tun >/dev/null 2>&1 || true | ||
17 | $DAEMON --daemon --writepid /var/run/openvpn.$NAME.pid \ | ||
18 | --config $CONFIG_DIR/$NAME.conf --cd $CONFIG_DIR || echo -n " FAILED->" | ||
19 | echo -n " $NAME" | ||
20 | } | ||
21 | stop_vpn () { | ||
22 | kill `cat $PIDFILE` || true | ||
23 | rm $PIDFILE | ||
24 | } | ||
25 | |||
26 | case "$1" in | ||
27 | start) | ||
28 | echo -n "Starting openvpn:" | ||
29 | |||
30 | if test -z $2 ; then | ||
31 | for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`; do | ||
32 | NAME=${CONFIG%%.conf} | ||
33 | start_vpn | ||
34 | done | ||
35 | else | ||
36 | if test -e $CONFIG_DIR/$2.conf ; then | ||
37 | NAME=$2 | ||
38 | start_vpn | ||
39 | else | ||
40 | echo -n " No such VPN: $2" | ||
41 | fi | ||
42 | fi | ||
43 | echo "." | ||
44 | |||
45 | ;; | ||
46 | stop) | ||
47 | echo -n "Stopping openvpn:" | ||
48 | |||
49 | if test -z $2 ; then | ||
50 | for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do | ||
51 | NAME=`echo $PIDFILE | cut -c18-` | ||
52 | NAME=${NAME%%.pid} | ||
53 | stop_vpn | ||
54 | echo -n " $NAME" | ||
55 | done | ||
56 | else | ||
57 | if test -e /var/run/openvpn.$2.pid ; then | ||
58 | PIDFILE=`ls /var/run/openvpn.$2.pid 2> /dev/null` | ||
59 | NAME=`echo $PIDFILE | cut -c18-` | ||
60 | NAME=${NAME%%.pid} | ||
61 | stop_vpn | ||
62 | echo -n " $NAME" | ||
63 | else | ||
64 | echo -n " No such VPN: $2" | ||
65 | fi | ||
66 | fi | ||
67 | echo "." | ||
68 | ;; | ||
69 | # We only 'reload' for running VPNs. New ones will only start with 'start' or 'restart'. | ||
70 | reload|force-reload) | ||
71 | echo -n "Reloading openvpn:" | ||
72 | for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do | ||
73 | NAME=`echo $PIDFILE | cut -c18-` | ||
74 | NAME=${NAME%%.pid} | ||
75 | # If openvpn if running under a different user than root we'll need to restart | ||
76 | if egrep '^( |\t)*user' $CONFIG_DIR/$NAME.conf > /dev/null 2>&1 ; then | ||
77 | stop_vpn | ||
78 | sleep 1 | ||
79 | start_vpn | ||
80 | echo -n "(restarted)" | ||
81 | else | ||
82 | kill -HUP `cat $PIDFILE` || true | ||
83 | # start-stop-daemon --stop --signal HUP --quiet --oknodo \ | ||
84 | # --exec $DAEMON --pidfile $PIDFILE | ||
85 | echo -n " $NAME" | ||
86 | fi | ||
87 | done | ||
88 | echo "." | ||
89 | ;; | ||
90 | |||
91 | restart) | ||
92 | $0 stop $2 | ||
93 | sleep 1 | ||
94 | $0 start $2 | ||
95 | ;; | ||
96 | *) | ||
97 | echo "Usage: $0 {start|stop|reload|restart|force-reload}" >&2 | ||
98 | exit 1 | ||
99 | ;; | ||
100 | esac | ||
101 | |||
102 | exit 0 | ||
103 | |||
104 | # vim:set ai et sts=2 sw=2 tw=0: | ||
diff --git a/meta-oe/recipes-connectivity/openvpn/openvpn_2.1.3.bb b/meta-oe/recipes-connectivity/openvpn/openvpn_2.1.3.bb new file mode 100644 index 000000000..34567bc59 --- /dev/null +++ b/meta-oe/recipes-connectivity/openvpn/openvpn_2.1.3.bb | |||
@@ -0,0 +1,26 @@ | |||
1 | DESCRIPTION = "A full-featured SSL VPN solution via tun device." | ||
2 | HOMEPAGE = "http://openvpn.sourceforge.net" | ||
3 | SECTION = "console/network" | ||
4 | LICENSE = "GPLv2" | ||
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=5aac200199fde47501876cba7263cb0c" | ||
6 | DEPENDS = "lzo openssl" | ||
7 | RRECOMMENDS_${PN} = "kernel-module-tun" | ||
8 | |||
9 | inherit autotools | ||
10 | |||
11 | SRC_URI = "http://openvpn.net/release/openvpn-${PV}.tar.gz \ | ||
12 | file://openvpn" | ||
13 | |||
14 | CFLAGS += "-fno-inline" | ||
15 | |||
16 | # I want openvpn to be able to read password from file (hrw) | ||
17 | EXTRA_OECONF += "--enable-password-save" | ||
18 | |||
19 | do_install_append() { | ||
20 | install -d ${D}/${sysconfdir}/init.d | ||
21 | install -d ${D}/${sysconfdir}/openvpn | ||
22 | install -m 755 ${WORKDIR}/openvpn ${D}/${sysconfdir}/init.d | ||
23 | } | ||
24 | |||
25 | SRC_URI[md5sum] = "7486d3e270ba4b033e311d3e022a0ad7" | ||
26 | SRC_URI[sha256sum] = "5185181df2e6043bd667377bc92e36ea5a5bd7600af209654f109b6403ca5b36" | ||