diff options
author | Jackie Huang <jackie.huang@windriver.com> | 2017-06-02 16:04:57 +0800 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-06-12 06:56:44 +0200 |
commit | cb375270e8d2949e6b5667ffbac30bcccb19564c (patch) | |
tree | 37c5cdf91808cae24499535c69595f237674c016 /meta-oe/recipes-connectivity | |
parent | b58c258b6e93d4f932faf526a8b32434b1d440e7 (diff) | |
download | meta-openembedded-cb375270e8d2949e6b5667ffbac30bcccb19564c.tar.gz |
umip: add systemd and sysvinit support
Add systemd service and and sysvinit script
so it's easy to manage the mip6d daemon.
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-connectivity')
-rwxr-xr-x | meta-oe/recipes-connectivity/umip/files/mip6d | 112 | ||||
-rw-r--r-- | meta-oe/recipes-connectivity/umip/files/mip6d.service | 10 | ||||
-rw-r--r-- | meta-oe/recipes-connectivity/umip/umip_1.0.bb | 18 |
3 files changed, 139 insertions, 1 deletions
diff --git a/meta-oe/recipes-connectivity/umip/files/mip6d b/meta-oe/recipes-connectivity/umip/files/mip6d new file mode 100755 index 0000000000..ebd70a6cca --- /dev/null +++ b/meta-oe/recipes-connectivity/umip/files/mip6d | |||
@@ -0,0 +1,112 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # mip6d Start script for the Mobile IPv6 daemon | ||
4 | # | ||
5 | # chkconfig: - 55 25 | ||
6 | # description: The mobile IPv6 daemon allows nodes to remain \ | ||
7 | # reachable while moving around in the IPv6 Internet. | ||
8 | # processname: mip6d | ||
9 | # config: /etc/mip6d.conf | ||
10 | # config: /etc/sysconfig/mip6d | ||
11 | # | ||
12 | ### BEGIN INIT INFO | ||
13 | # Provides: mipv6-daemon | ||
14 | # Required-Start: $local_fs $remote_fs $network $named | ||
15 | # Required-Stop: $local_fs $remote_fs $network | ||
16 | # Should-Start: $syslog | ||
17 | # Should-Stop: $network $syslog | ||
18 | # Default-Start: | ||
19 | # Default-Stop: 0 1 6 | ||
20 | # Short-Description: Start and stop Mobile IPV6 daemon | ||
21 | # Description: The mobile IPv6 daemon allows nodes to remain | ||
22 | # reachable while moving around in the IPv6 Internet. | ||
23 | ### END INIT INFO | ||
24 | |||
25 | # Source function library. | ||
26 | . /etc/init.d/functions | ||
27 | |||
28 | if [ -f /etc/sysconfig/mip6d ]; then | ||
29 | . /etc/sysconfig/mip6d | ||
30 | fi | ||
31 | |||
32 | mip6d=/usr/sbin/mip6d | ||
33 | prog="mip6d" | ||
34 | lockfile=/var/lock/subsys/$prog | ||
35 | |||
36 | start() { | ||
37 | [ -x $mip6d ] || exit 5 | ||
38 | echo -n $"Starting $prog: " | ||
39 | start-stop-daemon -S -x ${mip6d} && success || failure | ||
40 | retval=$? | ||
41 | echo | ||
42 | [ $retval -eq 0 ] && touch ${lockfile} | ||
43 | return $retval | ||
44 | } | ||
45 | |||
46 | stop() { | ||
47 | echo -n $"Stopping $prog: " | ||
48 | start-stop-daemon -K -x $mip6d | ||
49 | retval=$? | ||
50 | echo | ||
51 | [ $retval -eq 0 ] && rm -f ${lockfile} | ||
52 | return $retval | ||
53 | } | ||
54 | |||
55 | restart() { | ||
56 | stop | ||
57 | start | ||
58 | } | ||
59 | |||
60 | reload() | ||
61 | { | ||
62 | echo -n $"Reloading $prog configuration: " | ||
63 | killproc $mip6d -HUP | ||
64 | retval=$? | ||
65 | echo | ||
66 | return $retval | ||
67 | } | ||
68 | |||
69 | force_reload() { | ||
70 | restart | ||
71 | } | ||
72 | |||
73 | rh_status() { | ||
74 | status $prog | ||
75 | } | ||
76 | |||
77 | rh_status_q() { | ||
78 | rh_status > /dev/null 2>&1 | ||
79 | } | ||
80 | |||
81 | case "$1" in | ||
82 | start) | ||
83 | rh_status_q && exit 0 | ||
84 | $1 | ||
85 | ;; | ||
86 | stop) | ||
87 | rh_status_q || exit 0 | ||
88 | $1 | ||
89 | ;; | ||
90 | restart) | ||
91 | $1 | ||
92 | ;; | ||
93 | reload) | ||
94 | rh_status_q || exit 7 | ||
95 | $1 | ||
96 | ;; | ||
97 | force-reload) | ||
98 | force_reload | ||
99 | ;; | ||
100 | status) | ||
101 | rh_status | ||
102 | ;; | ||
103 | condrestart|try-restart) | ||
104 | rh_status_q || exit 0 | ||
105 | restart | ||
106 | ;; | ||
107 | *) | ||
108 | echo $"Usage: $prog {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" | ||
109 | exit 2 | ||
110 | esac | ||
111 | |||
112 | exit $? | ||
diff --git a/meta-oe/recipes-connectivity/umip/files/mip6d.service b/meta-oe/recipes-connectivity/umip/files/mip6d.service new file mode 100644 index 0000000000..2b5a5b9f1d --- /dev/null +++ b/meta-oe/recipes-connectivity/umip/files/mip6d.service | |||
@@ -0,0 +1,10 @@ | |||
1 | [Unit] | ||
2 | Description=MIPL Mobile IPv6 | ||
3 | After=network.target | ||
4 | |||
5 | [Service] | ||
6 | EnvironmentFile=-@SYSCONFDIR@/sysconfig/mip6d | ||
7 | ExecStart=@SBINDIR@/mip6d $ARGS | ||
8 | |||
9 | [Install] | ||
10 | WantedBy=multi-user.target | ||
diff --git a/meta-oe/recipes-connectivity/umip/umip_1.0.bb b/meta-oe/recipes-connectivity/umip/umip_1.0.bb index e97dd48f69..b8b90eb81c 100644 --- a/meta-oe/recipes-connectivity/umip/umip_1.0.bb +++ b/meta-oe/recipes-connectivity/umip/umip_1.0.bb | |||
@@ -11,10 +11,26 @@ DEPENDS = "rpm indent-native" | |||
11 | 11 | ||
12 | SRC_URI = "git://git.umip.org/umip.git \ | 12 | SRC_URI = "git://git.umip.org/umip.git \ |
13 | file://add-dependency-to-support-parallel-compilation.patch \ | 13 | file://add-dependency-to-support-parallel-compilation.patch \ |
14 | file://mip6d \ | ||
15 | file://mip6d.service \ | ||
14 | " | 16 | " |
15 | SRCREV = "428974c2d0d8e75a2750a3ab0488708c5dfdd8e3" | 17 | SRCREV = "428974c2d0d8e75a2750a3ab0488708c5dfdd8e3" |
16 | 18 | ||
17 | S = "${WORKDIR}/git" | 19 | S = "${WORKDIR}/git" |
18 | EXTRA_OE_CONF = "--enable-vt" | 20 | EXTRA_OE_CONF = "--enable-vt" |
19 | 21 | ||
20 | inherit autotools-brokensep | 22 | inherit autotools-brokensep systemd update-rc.d |
23 | |||
24 | INITSCRIPT_NAME = "mip6d" | ||
25 | INITSCRIPT_PARAMS = "start 64 . stop 36 0 1 2 3 4 5 6 ." | ||
26 | |||
27 | SYSTEMD_SERVICE_${PN} = "mip6d.service" | ||
28 | SYSTEMD_AUTO_ENABLE = "disable" | ||
29 | |||
30 | do_install_append() { | ||
31 | install -D -m 0755 ${WORKDIR}/mip6d ${D}${sysconfdir}/init.d/mip6d | ||
32 | install -D -m 0644 ${WORKDIR}/mip6d.service ${D}${systemd_system_unitdir}/mip6d.service | ||
33 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | ||
34 | -e 's,@SBINDIR@,${sbindir},g' \ | ||
35 | ${D}${systemd_system_unitdir}/mip6d.service | ||
36 | } | ||