diff options
author | Jackie Huang <jackie.huang@windriver.com> | 2017-07-28 15:20:17 +0800 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2017-09-12 10:37:17 -0400 |
commit | a5846fc960ac002a35455916eb78ba156b1d9005 (patch) | |
tree | 30ae4b4de9ad379ee6a1be8e23dda5ac980cb941 /meta-networking/recipes-protocols | |
parent | 3381e8fdcc65f91a1885599d9f877664f41c5542 (diff) | |
download | meta-openembedded-a5846fc960ac002a35455916eb78ba156b1d9005.tar.gz |
openl2tp: add init script and systemd support
- Add patches to fix init script issues
- Add openl2tpd.service to add systemd support
- Add runtime dependency on ppp and ppp-l2tp
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-protocols')
5 files changed, 161 insertions, 1 deletions
diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-sysconfig.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-sysconfig.patch new file mode 100644 index 000000000..3119425e6 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-sysconfig.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | commit 6ea3125e2bec15004f312814022335d94cdf7e94 | ||
2 | Author: Aws Ismail <aws.ismail@windriver.com> | ||
3 | Date: Wed Sep 19 11:34:48 2012 -0400 | ||
4 | |||
5 | Fix openl2tp config script location | ||
6 | |||
7 | Correct the location of the sysconfig | ||
8 | script. Use /etc/default/ instead of | ||
9 | /etc/sysconfig/ | ||
10 | |||
11 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
12 | |||
13 | Upstream-Status: Inappropriate [configuration] | ||
14 | |||
15 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
16 | |||
17 | diff --git a/etc/rc.d/init.d/openl2tpd b/etc/rc.d/init.d/openl2tpd | ||
18 | index 7f27bb7..4194f63 100755 | ||
19 | --- a/etc/rc.d/init.d/openl2tpd | ||
20 | +++ b/etc/rc.d/init.d/openl2tpd | ||
21 | @@ -8,12 +8,12 @@ | ||
22 | # can be used to implement L2TP VPNs. As a server, it can handle | ||
23 | # hundreds of tunnels and sessions. | ||
24 | # processname: openl2tpd | ||
25 | -# config: /etc/sysconfig/openl2tpd | ||
26 | +# config: /etc/default/openl2tpd | ||
27 | # pidfile: /var/run/openl2tpd.pid | ||
28 | |||
29 | # Source function library. | ||
30 | . /etc/init.d/functions | ||
31 | -. /etc/sysconfig/openl2tpd | ||
32 | +. /etc/default/openl2tpd | ||
33 | |||
34 | # See how we were called. | ||
35 | |||
diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-warning.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-warning.patch new file mode 100644 index 000000000..15a8c5b08 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix-warning.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | openl2tp: eliminate warning from modprobe | ||
2 | |||
3 | modprobe will emit alarming warnings if it cannot | ||
4 | find a module, but we only care that it find one | ||
5 | of two possible modules when we start openl2tpd. | ||
6 | |||
7 | Suppress messages from modprobe. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Joe Slater <jslater@windriver.com> | ||
12 | |||
13 | --- a/etc/rc.d/init.d/openl2tpd | ||
14 | +++ b/etc/rc.d/init.d/openl2tpd | ||
15 | @@ -29,7 +29,7 @@ start() { | ||
16 | return 1 | ||
17 | fi | ||
18 | fi | ||
19 | - modprobe -s pppol2tp || modprobe -s l2tp_ppp | ||
20 | + modprobe -sq pppol2tp || modprobe -sq l2tp_ppp | ||
21 | RETVAL=$? | ||
22 | if [ $RETVAL -eq 0 ]; then | ||
23 | start-stop-daemon --start --exec openl2tpd $OPENL2TPDARGS | ||
24 | @@ -57,7 +57,7 @@ stop() { | ||
25 | return 1; | ||
26 | fi | ||
27 | killproc openl2tpd | ||
28 | - modprobe -s -r pppol2tp || modprobe -s -r l2tp_ppp | ||
29 | + modprobe -srq pppol2tp || modprobe -srq l2tp_ppp | ||
30 | echo | ||
31 | rm -f /var/run/openl2tpd.pid | ||
32 | rm -f /var/lock/subsys/openl2tpd | ||
diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix.patch new file mode 100644 index 000000000..9ecd4b072 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-initscript-fix.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | commit 7c58a1e244ea83a9e7bbd51a6d354cee25cdbd33 | ||
2 | Author: Aws Ismail <aws.ismail@windriver.com> | ||
3 | Date: Wed Sep 12 23:35:40 2012 -0400 | ||
4 | |||
5 | Fix openl2tpd initscript | ||
6 | |||
7 | - Correct the location of the retval statement. | ||
8 | - use start-stop-daemon instead of daemon. | ||
9 | |||
10 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
11 | |||
12 | Upstream-Status: Inappropriate [OE specific] | ||
13 | |||
14 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
15 | |||
16 | diff --git a/etc/rc.d/init.d/openl2tpd b/etc/rc.d/init.d/openl2tpd | ||
17 | index ce21b50..7f27bb7 100755 | ||
18 | --- a/etc/rc.d/init.d/openl2tpd | ||
19 | +++ b/etc/rc.d/init.d/openl2tpd | ||
20 | @@ -24,7 +24,7 @@ start() { | ||
21 | if [ -e /var/lock/subsys/openl2tpd ]; then | ||
22 | if [ -e /var/run/openl2tpd.pid ] && [ -e /proc/`cat /var/run/openl2tpd.pid` ]; then | ||
23 | echo -n $"cannot start openl2tpd: openl2tpd is already running."; | ||
24 | - failure $"cannot start openl2tpd: openl2tpd already running."; | ||
25 | + #failure $"cannot start openl2tpd: openl2tpd already running."; | ||
26 | echo | ||
27 | return 1 | ||
28 | fi | ||
29 | @@ -32,9 +32,9 @@ start() { | ||
30 | modprobe -s pppol2tp || modprobe -s l2tp_ppp | ||
31 | RETVAL=$? | ||
32 | if [ $RETVAL -eq 0 ]; then | ||
33 | - daemon openl2tpd $OPENL2TPDARGS | ||
34 | + start-stop-daemon --start --exec openl2tpd $OPENL2TPDARGS | ||
35 | + RETVAL=$? | ||
36 | fi | ||
37 | - RETVAL=$? | ||
38 | echo | ||
39 | if [ $RETVAL -eq 0 ]; then | ||
40 | touch /var/lock/subsys/openl2tpd | ||
41 | @@ -52,7 +52,7 @@ stop() { | ||
42 | echo -n $"Stopping $prog: " | ||
43 | if [ ! -e /var/lock/subsys/openl2tpd ]; then | ||
44 | echo -n $"cannot stop openl2tpd: openl2tpd is not running." | ||
45 | - failure $"cannot stop openl2tpd: openl2tpd is not running." | ||
46 | + #failure $"cannot stop openl2tpd: openl2tpd is not running." | ||
47 | echo | ||
48 | return 1; | ||
49 | fi | ||
diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd.service b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd.service new file mode 100644 index 000000000..7b3faf672 --- /dev/null +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd.service | |||
@@ -0,0 +1,17 @@ | |||
1 | [Unit] | ||
2 | Description=The open L2TP implementation | ||
3 | After=network.target remote-fs.target nss-lookup.target rpcbind.target | ||
4 | Requires=rpcbind.service | ||
5 | |||
6 | [Service] | ||
7 | Type=forking | ||
8 | PIDFile=@STATEDIR@/run/openl2tpd.pid | ||
9 | EnvironmentFile=@SYSCONFDIR@/default/openl2tpd | ||
10 | ExecStartPre=@BASE_BINDIR@/sh -c "@BASE_SBINDIR@/modprobe -sq l2tp_ppp || @BASE_SBINDIR@/modprobe -sq pppol2tp" | ||
11 | ExecStart=@SBINDIR@/openl2tpd $OPENL2TPDARGS | ||
12 | ExecStartPost=@BASE_BINDIR@/sh -c 'if [ -n "$OPENL2TPD_CONFIG_FILE" ]; then sleep 1; @BINDIR@/l2tpconfig config restore file=$OPENL2TPD_CONFIG_FILE; fi' | ||
13 | ExecStopPost=@BASE_BINDIR@/sh -c "@BASE_SBINDIR@/modprobe -rsq l2tp_ppp || @BASE_SBINDIR@/modprobe -rsq pppol2tp" | ||
14 | SuccessExitStatus=1 | ||
15 | |||
16 | [Install] | ||
17 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb b/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb index 9be1c7956..1e5bfe264 100644 --- a/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb +++ b/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb | |||
@@ -27,6 +27,10 @@ SRC_URI = "ftp://ftp.openl2tp.org/releases/${BP}/${BP}.tar.gz \ | |||
27 | file://0002-cli-include-fcntl.h-for-O_CREAT-define.patch \ | 27 | file://0002-cli-include-fcntl.h-for-O_CREAT-define.patch \ |
28 | file://0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch \ | 28 | file://0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch \ |
29 | file://0001-l2tp_api-Included-needed-headers.patch \ | 29 | file://0001-l2tp_api-Included-needed-headers.patch \ |
30 | file://openl2tpd-initscript-fix.patch \ | ||
31 | file://openl2tpd-initscript-fix-sysconfig.patch \ | ||
32 | file://openl2tpd-initscript-fix-warning.patch \ | ||
33 | file://openl2tpd.service \ | ||
30 | " | 34 | " |
31 | 35 | ||
32 | SRC_URI_append_libc-musl = "\ | 36 | SRC_URI_append_libc-musl = "\ |
@@ -36,7 +40,10 @@ SRC_URI_append_libc-musl = "\ | |||
36 | SRC_URI[md5sum] = "e3d08dedfb9e6a9a1e24f6766f6dadd0" | 40 | SRC_URI[md5sum] = "e3d08dedfb9e6a9a1e24f6766f6dadd0" |
37 | SRC_URI[sha256sum] = "1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f" | 41 | SRC_URI[sha256sum] = "1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f" |
38 | 42 | ||
39 | inherit autotools-brokensep pkgconfig | 43 | inherit autotools-brokensep pkgconfig systemd |
44 | |||
45 | SYSTEMD_SERVICE_${PN} = "openl2tpd.service" | ||
46 | SYSTEMD_AUTO_ENABLE = "disable" | ||
40 | 47 | ||
41 | DEPENDS_append_libc-musl = " libtirpc" | 48 | DEPENDS_append_libc-musl = " libtirpc" |
42 | CPPFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc" | 49 | CPPFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc" |
@@ -58,3 +65,23 @@ do_compile_prepend() { | |||
58 | -e 's:CPPFLAGS-y:CPPFLAGS:g' \ | 65 | -e 's:CPPFLAGS-y:CPPFLAGS:g' \ |
59 | ${S}/Makefile | 66 | ${S}/Makefile |
60 | } | 67 | } |
68 | |||
69 | do_install_append () { | ||
70 | install -d ${D}${sysconfdir}/init.d | ||
71 | install -d ${D}${sysconfdir}/default | ||
72 | install -m 0755 ${S}/etc/rc.d/init.d/openl2tpd ${D}${sysconfdir}/init.d/openl2tpd | ||
73 | install -m 0755 ${S}/etc/sysconfig/openl2tpd ${D}${sysconfdir}/default/openl2tpd | ||
74 | |||
75 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
76 | install -D -m 0644 ${WORKDIR}/openl2tpd.service ${D}${systemd_system_unitdir}/openl2tpd.service | ||
77 | sed -i -e 's,@STATEDIR@,${localstatedir},g' \ | ||
78 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | ||
79 | -e 's,@SBINDIR@,${sbindir},g' \ | ||
80 | -e 's,@BINDIR@,${bindir},g' \ | ||
81 | -e 's,@BASE_SBINDIR@,${base_sbindir},g' \ | ||
82 | -e 's,@BASE_BINDIR@,${base_bindir},g' \ | ||
83 | ${D}${systemd_system_unitdir}/openl2tpd.service | ||
84 | fi | ||
85 | } | ||
86 | |||
87 | RDEPENDS_${PN} = "ppp ppp-l2tp" | ||