mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
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>
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
Busybox does not support ps -p so use pgrep
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [embedded specific]
|
||||||
|
Based on changes from Diego Sueiro <Diego.Sueiro@arm.com>
|
||||||
|
|
||||||
|
Signed-off-by: Armin kuster <akuster808@gmail.com>
|
||||||
|
|
||||||
|
Index: kea-1.7.10/src/bin/keactrl/keactrl.in
|
||||||
|
===================================================================
|
||||||
|
--- kea-1.7.10.orig/src/bin/keactrl/keactrl.in
|
||||||
|
+++ kea-1.7.10/src/bin/keactrl/keactrl.in
|
||||||
|
@@ -137,8 +137,8 @@ check_running() {
|
||||||
|
# Get the PID from the PID file (if it exists)
|
||||||
|
get_pid_from_file "${proc_name}"
|
||||||
|
if [ ${_pid} -gt 0 ]; then
|
||||||
|
- # Use ps to check if PID is alive
|
||||||
|
- ps -p ${_pid} 1>/dev/null
|
||||||
|
+ # Use pgrep and grep to check if PID is alive
|
||||||
|
+ pgrep -v 1 | grep ${_pid} 1>/dev/null
|
||||||
|
retcode=$?
|
||||||
|
if [ $retcode -eq 0 ]; then
|
||||||
|
# No error, so PID IS ALIVE
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: kea-dhcp-ddns-server
|
||||||
|
# Required-Start: $local_fs $network $remote_fs $syslog
|
||||||
|
# Required-Stop: $local_fs $network $remote_fs $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: ISC KEA DHCP IPv6 Server
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||||
|
DESC="kea-dhcp-ddns-server"
|
||||||
|
NAME=kea-dhcp-ddns
|
||||||
|
DAEMON=/usr/sbin/keactrl
|
||||||
|
DAEMON_ARGS=" -s dhcp_ddns"
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
echo -n "Starting $DESC: "
|
||||||
|
start-stop-daemon -S -b -n $NAME -x $DAEMON -- start $DAEMON_ARGS
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo -n "Stopping $DESC: "
|
||||||
|
kpid=`pidof $NAME`
|
||||||
|
kill $kpid
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
restart|force-reload)
|
||||||
|
#
|
||||||
|
$0 stop
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: kea-dhcp4-server
|
||||||
|
# Required-Start: $local_fs $network $remote_fs $syslog
|
||||||
|
# Required-Stop: $local_fs $network $remote_fs $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: ISC KEA DHCP IPv6 Server
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||||
|
DESC="kea-dhcp4-server"
|
||||||
|
NAME=kea-dhcp4
|
||||||
|
DAEMON=/usr/sbin/keactrl
|
||||||
|
DAEMON_ARGS=" -s dhcp4"
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
echo -n "Starting $DESC: "
|
||||||
|
start-stop-daemon -S -b -n $NAME -x $DAEMON -- start $DAEMON_ARGS
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo -n "Stopping $DESC: "
|
||||||
|
kpid=`pidof $NAME`
|
||||||
|
kill $kpid
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
restart|force-reload)
|
||||||
|
#
|
||||||
|
$0 stop
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: kea-dhcp6-server
|
||||||
|
# Required-Start: $local_fs $network $remote_fs $syslog
|
||||||
|
# Required-Stop: $local_fs $network $remote_fs $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: ISC KEA DHCP IPv6 Server
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||||
|
DESC="kea-dhcp6-server"
|
||||||
|
NAME=kea-dhcp6
|
||||||
|
DAEMON=/usr/sbin/keactrl
|
||||||
|
DAEMON_ARGS=" -s dhcp6"
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
echo -n "Starting $DESC: "
|
||||||
|
start-stop-daemon -S -b -n $NAME -x $DAEMON -- start $DAEMON_ARGS
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo -n "Stopping $DESC: "
|
||||||
|
kpid=`pidof $NAME`
|
||||||
|
kill $kpid
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
restart|force-reload)
|
||||||
|
#
|
||||||
|
$0 stop
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@@ -13,11 +13,18 @@ SRC_URI = "\
|
|||||||
file://kea-dhcp4.service \
|
file://kea-dhcp4.service \
|
||||||
file://kea-dhcp6.service \
|
file://kea-dhcp6.service \
|
||||||
file://kea-dhcp-ddns.service \
|
file://kea-dhcp-ddns.service \
|
||||||
|
file://kea-dhcp4-server \
|
||||||
|
file://kea-dhcp6-server \
|
||||||
|
file://kea-dhcp-ddns-server \
|
||||||
file://fix-multilib-conflict.patch \
|
file://fix-multilib-conflict.patch \
|
||||||
|
file://fix_pid_keactrl.patch \
|
||||||
"
|
"
|
||||||
SRC_URI[sha256sum] = "4e121f0e58b175a827581c69cb1d60778647049fa47f142940dddc9ce58f3c82"
|
SRC_URI[sha256sum] = "4e121f0e58b175a827581c69cb1d60778647049fa47f142940dddc9ce58f3c82"
|
||||||
|
|
||||||
inherit autotools systemd
|
inherit autotools systemd update-rc.d
|
||||||
|
|
||||||
|
INITSCRIPT_NAME = "kea-dhcp4-server"
|
||||||
|
INITSCRIPT_PARAMS = "defaults 30"
|
||||||
|
|
||||||
SYSTEMD_SERVICE_${PN} = "kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service"
|
SYSTEMD_SERVICE_${PN} = "kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service"
|
||||||
SYSTEMD_AUTO_ENABLE = "disable"
|
SYSTEMD_AUTO_ENABLE = "disable"
|
||||||
@@ -44,8 +51,11 @@ do_configure_prepend() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_install_append() {
|
do_install_append() {
|
||||||
|
install -d ${D}${sysconfdir}/init.d
|
||||||
install -d ${D}${systemd_system_unitdir}
|
install -d ${D}${systemd_system_unitdir}
|
||||||
|
|
||||||
install -m 0644 ${WORKDIR}/kea-dhcp*service ${D}${systemd_system_unitdir}
|
install -m 0644 ${WORKDIR}/kea-dhcp*service ${D}${systemd_system_unitdir}
|
||||||
|
install -m 0755 ${WORKDIR}/kea-*-server ${D}${sysconfdir}/init.d
|
||||||
sed -i -e 's,@SBINDIR@,${sbindir},g' -e 's,@BASE_BINDIR@,${base_bindir},g' \
|
sed -i -e 's,@SBINDIR@,${sbindir},g' -e 's,@BASE_BINDIR@,${base_bindir},g' \
|
||||||
-e 's,@LOCALSTATEDIR@,${localstatedir},g' -e 's,@SYSCONFDIR@,${sysconfdir},g' \
|
-e 's,@LOCALSTATEDIR@,${localstatedir},g' -e 's,@SYSCONFDIR@,${sysconfdir},g' \
|
||||||
${D}${systemd_system_unitdir}/kea-dhcp*service ${D}${sbindir}/keactrl
|
${D}${systemd_system_unitdir}/kea-dhcp*service ${D}${sbindir}/keactrl
|
||||||
@@ -55,6 +65,8 @@ do_install_append() {
|
|||||||
rm -rf "${D}${localstatedir}"
|
rm -rf "${D}${localstatedir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CONFFILES_${PN} = "${sysconfdir}/kea/keactrl.conf"
|
||||||
|
|
||||||
FILES_${PN}-staticdev += "${libdir}/kea/hooks/*.a ${libdir}/hooks/*.a"
|
FILES_${PN}-staticdev += "${libdir}/kea/hooks/*.a ${libdir}/hooks/*.a"
|
||||||
FILES_${PN} += "${libdir}/hooks/*.so"
|
FILES_${PN} += "${libdir}/hooks/*.so"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user