summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity
diff options
context:
space:
mode:
authorakuster <akuster808@gmail.com>2020-10-14 22:48:31 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-10-17 12:34:29 +0100
commitd4ecc90268438900ccbef6020cdb15c054fb4027 (patch)
tree5e90660082b80f65467f53e36c5389d5991d0c90 /meta/recipes-connectivity
parent044b20737a6b4647852637437a5c97a17274cea8 (diff)
downloadpoky-d4ecc90268438900ccbef6020cdb15c054fb4027.tar.gz
kea: add init scripts
[ Yocto # 14074 ] Add init scripts for dhcp4,6 and ddns (From OE-Core rev: 6d20bfda696fc6c6c3989ecf9996d2494953e232) Signed-off-by: Armin kuster <akuster808@gmail.com> -- V2] remove 'status' from usage add patch to fix ps -p in keactrl.in Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity')
-rw-r--r--meta/recipes-connectivity/kea/files/fix_pid_keactrl.patch22
-rw-r--r--meta/recipes-connectivity/kea/files/kea-dhcp-ddns-server46
-rw-r--r--meta/recipes-connectivity/kea/files/kea-dhcp4-server46
-rw-r--r--meta/recipes-connectivity/kea/files/kea-dhcp6-server47
-rw-r--r--meta/recipes-connectivity/kea/kea_1.7.10.bb14
5 files changed, 174 insertions, 1 deletions
diff --git a/meta/recipes-connectivity/kea/files/fix_pid_keactrl.patch b/meta/recipes-connectivity/kea/files/fix_pid_keactrl.patch
new file mode 100644
index 0000000000..eeeb89942b
--- /dev/null
+++ b/meta/recipes-connectivity/kea/files/fix_pid_keactrl.patch
@@ -0,0 +1,22 @@
1Busybox does not support ps -p so use pgrep
2
3Upstream-Status: Inappropriate [embedded specific]
4Based on changes from Diego Sueiro <Diego.Sueiro@arm.com>
5
6Signed-off-by: Armin kuster <akuster808@gmail.com>
7
8Index: kea-1.7.10/src/bin/keactrl/keactrl.in
9===================================================================
10--- kea-1.7.10.orig/src/bin/keactrl/keactrl.in
11+++ kea-1.7.10/src/bin/keactrl/keactrl.in
12@@ -137,8 +137,8 @@ check_running() {
13 # Get the PID from the PID file (if it exists)
14 get_pid_from_file "${proc_name}"
15 if [ ${_pid} -gt 0 ]; then
16- # Use ps to check if PID is alive
17- ps -p ${_pid} 1>/dev/null
18+ # Use pgrep and grep to check if PID is alive
19+ pgrep -v 1 | grep ${_pid} 1>/dev/null
20 retcode=$?
21 if [ $retcode -eq 0 ]; then
22 # No error, so PID IS ALIVE
diff --git a/meta/recipes-connectivity/kea/files/kea-dhcp-ddns-server b/meta/recipes-connectivity/kea/files/kea-dhcp-ddns-server
new file mode 100644
index 0000000000..50fe40d439
--- /dev/null
+++ b/meta/recipes-connectivity/kea/files/kea-dhcp-ddns-server
@@ -0,0 +1,46 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: kea-dhcp-ddns-server
4# Required-Start: $local_fs $network $remote_fs $syslog
5# Required-Stop: $local_fs $network $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: ISC KEA DHCP IPv6 Server
9### END INIT INFO
10
11PATH=/sbin:/usr/sbin:/bin:/usr/bin
12DESC="kea-dhcp-ddns-server"
13NAME=kea-dhcp-ddns
14DAEMON=/usr/sbin/keactrl
15DAEMON_ARGS=" -s dhcp_ddns"
16
17set -e
18
19# Exit if the package is not installed
20[ -x "$DAEMON" ] || exit 0
21
22# Source function library.
23. /etc/init.d/functions
24
25case "$1" in
26 start)
27 echo -n "Starting $DESC: "
28 start-stop-daemon -S -b -n $NAME -x $DAEMON -- start $DAEMON_ARGS
29 echo "done."
30 ;;
31 stop)
32 echo -n "Stopping $DESC: "
33 kpid=`pidof $NAME`
34 kill $kpid
35 echo "done."
36 ;;
37 restart|force-reload)
38 #
39 $0 stop
40 $0 start
41 ;;
42 *)
43 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
44 exit 1
45 ;;
46esac
diff --git a/meta/recipes-connectivity/kea/files/kea-dhcp4-server b/meta/recipes-connectivity/kea/files/kea-dhcp4-server
new file mode 100644
index 0000000000..e83e51025d
--- /dev/null
+++ b/meta/recipes-connectivity/kea/files/kea-dhcp4-server
@@ -0,0 +1,46 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: kea-dhcp4-server
4# Required-Start: $local_fs $network $remote_fs $syslog
5# Required-Stop: $local_fs $network $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: ISC KEA DHCP IPv6 Server
9### END INIT INFO
10
11PATH=/sbin:/usr/sbin:/bin:/usr/bin
12DESC="kea-dhcp4-server"
13NAME=kea-dhcp4
14DAEMON=/usr/sbin/keactrl
15DAEMON_ARGS=" -s dhcp4"
16
17set -e
18
19# Exit if the package is not installed
20[ -x "$DAEMON" ] || exit 0
21
22# Source function library.
23. /etc/init.d/functions
24
25case "$1" in
26 start)
27 echo -n "Starting $DESC: "
28 start-stop-daemon -S -b -n $NAME -x $DAEMON -- start $DAEMON_ARGS
29 echo "done."
30 ;;
31 stop)
32 echo -n "Stopping $DESC: "
33 kpid=`pidof $NAME`
34 kill $kpid
35 echo "done."
36 ;;
37 restart|force-reload)
38 #
39 $0 stop
40 $0 start
41 ;;
42 *)
43 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
44 exit 1
45 ;;
46esac
diff --git a/meta/recipes-connectivity/kea/files/kea-dhcp6-server b/meta/recipes-connectivity/kea/files/kea-dhcp6-server
new file mode 100644
index 0000000000..10f2d22641
--- /dev/null
+++ b/meta/recipes-connectivity/kea/files/kea-dhcp6-server
@@ -0,0 +1,47 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: kea-dhcp6-server
4# Required-Start: $local_fs $network $remote_fs $syslog
5# Required-Stop: $local_fs $network $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: ISC KEA DHCP IPv6 Server
9### END INIT INFO
10
11# PATH should only include /usr/* if it runs after the mountnfs.sh script
12PATH=/sbin:/usr/sbin:/bin:/usr/bin
13DESC="kea-dhcp6-server"
14NAME=kea-dhcp6
15DAEMON=/usr/sbin/keactrl
16DAEMON_ARGS=" -s dhcp6"
17
18set -e
19
20# Exit if the package is not installed
21[ -x "$DAEMON" ] || exit 0
22
23# Source function library.
24. /etc/init.d/functions
25
26case "$1" in
27 start)
28 echo -n "Starting $DESC: "
29 start-stop-daemon -S -b -n $NAME -x $DAEMON -- start $DAEMON_ARGS
30 echo "done."
31 ;;
32 stop)
33 echo -n "Stopping $DESC: "
34 kpid=`pidof $NAME`
35 kill $kpid
36 echo "done."
37 ;;
38 restart|force-reload)
39 #
40 $0 stop
41 $0 start
42 ;;
43 *)
44 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
45 exit 1
46 ;;
47esac
diff --git a/meta/recipes-connectivity/kea/kea_1.7.10.bb b/meta/recipes-connectivity/kea/kea_1.7.10.bb
index 2ea4b12758..c9a5819e47 100644
--- a/meta/recipes-connectivity/kea/kea_1.7.10.bb
+++ b/meta/recipes-connectivity/kea/kea_1.7.10.bb
@@ -13,11 +13,18 @@ SRC_URI = "\
13 file://kea-dhcp4.service \ 13 file://kea-dhcp4.service \
14 file://kea-dhcp6.service \ 14 file://kea-dhcp6.service \
15 file://kea-dhcp-ddns.service \ 15 file://kea-dhcp-ddns.service \
16 file://kea-dhcp4-server \
17 file://kea-dhcp6-server \
18 file://kea-dhcp-ddns-server \
16 file://fix-multilib-conflict.patch \ 19 file://fix-multilib-conflict.patch \
20 file://fix_pid_keactrl.patch \
17" 21"
18SRC_URI[sha256sum] = "4e121f0e58b175a827581c69cb1d60778647049fa47f142940dddc9ce58f3c82" 22SRC_URI[sha256sum] = "4e121f0e58b175a827581c69cb1d60778647049fa47f142940dddc9ce58f3c82"
19 23
20inherit autotools systemd 24inherit autotools systemd update-rc.d
25
26INITSCRIPT_NAME = "kea-dhcp4-server"
27INITSCRIPT_PARAMS = "defaults 30"
21 28
22SYSTEMD_SERVICE_${PN} = "kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service" 29SYSTEMD_SERVICE_${PN} = "kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service"
23SYSTEMD_AUTO_ENABLE = "disable" 30SYSTEMD_AUTO_ENABLE = "disable"
@@ -44,8 +51,11 @@ do_configure_prepend() {
44} 51}
45 52
46do_install_append() { 53do_install_append() {
54 install -d ${D}${sysconfdir}/init.d
47 install -d ${D}${systemd_system_unitdir} 55 install -d ${D}${systemd_system_unitdir}
56
48 install -m 0644 ${WORKDIR}/kea-dhcp*service ${D}${systemd_system_unitdir} 57 install -m 0644 ${WORKDIR}/kea-dhcp*service ${D}${systemd_system_unitdir}
58 install -m 0755 ${WORKDIR}/kea-*-server ${D}${sysconfdir}/init.d
49 sed -i -e 's,@SBINDIR@,${sbindir},g' -e 's,@BASE_BINDIR@,${base_bindir},g' \ 59 sed -i -e 's,@SBINDIR@,${sbindir},g' -e 's,@BASE_BINDIR@,${base_bindir},g' \
50 -e 's,@LOCALSTATEDIR@,${localstatedir},g' -e 's,@SYSCONFDIR@,${sysconfdir},g' \ 60 -e 's,@LOCALSTATEDIR@,${localstatedir},g' -e 's,@SYSCONFDIR@,${sysconfdir},g' \
51 ${D}${systemd_system_unitdir}/kea-dhcp*service ${D}${sbindir}/keactrl 61 ${D}${systemd_system_unitdir}/kea-dhcp*service ${D}${sbindir}/keactrl
@@ -55,6 +65,8 @@ do_install_append() {
55 rm -rf "${D}${localstatedir}" 65 rm -rf "${D}${localstatedir}"
56} 66}
57 67
68CONFFILES_${PN} = "${sysconfdir}/kea/keactrl.conf"
69
58FILES_${PN}-staticdev += "${libdir}/kea/hooks/*.a ${libdir}/hooks/*.a" 70FILES_${PN}-staticdev += "${libdir}/kea/hooks/*.a ${libdir}/hooks/*.a"
59FILES_${PN} += "${libdir}/hooks/*.so" 71FILES_${PN} += "${libdir}/hooks/*.so"
60 72