1From 26614b6578056ec30b95013592e308bf24d924c2 Mon Sep 17 00:00:00 2001
2From: Beniamin Sandu <beniaminsandu@gmail.com>
3Date: Fri, 20 Nov 2020 23:00:20 +0200
4Subject: [PATCH] contrib: add yocto compatible init script
5
6Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
7---
8 contrib/unbound.init | 20 ++++++++++----------
9 1 file changed, 10 insertions(+), 10 deletions(-)
10
11diff --git a/contrib/unbound.init b/contrib/unbound.init
12index c5bb52bb..4eba752b 100644
13--- a/contrib/unbound.init
14+++ b/contrib/unbound.init
15@@ -19,11 +19,11 @@
16 ### END INIT INFO
17
18 # Source function library.
19-. /etc/rc.d/init.d/functions
20+. /etc/init.d/functions
21
22 exec="/usr/sbin/unbound"
23 prog="unbound"
24-config="/var/unbound/unbound.conf"
25+config="/etc/unbound/unbound.conf"
26 pidfile="/var/unbound/unbound.pid"
27 rootdir="/var/unbound"
28
29@@ -54,14 +54,14 @@ start() {
30 	[ -e ${rootdir}/dev/log ] || touch ${rootdir}/dev/log
31 	mount --bind -n /dev/log ${rootdir}/dev/log >/dev/null 2>&1;
32     fi;
33-    if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/urandom' /proc/mounts; then
34+    if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/random' /proc/mounts; then
35 	[ -d ${rootdir}/dev ] || mkdir -p ${rootdir}/dev ;
36-	[ -e ${rootdir}/dev/urandom ] || touch ${rootdir}/dev/urandom
37-	mount --bind -n /dev/urandom ${rootdir}/dev/urandom >/dev/null 2>&1;
38+	[ -e ${rootdir}/dev/random ] || touch ${rootdir}/dev/random
39+	mount --bind -n /dev/random ${rootdir}/dev/random >/dev/null 2>&1;
40     fi;
41
42     # if not running, start it up here
43-    daemon $exec
44+    daemonize $exec
45     retval=$?
46     echo
47     [ $retval -eq 0 ] && touch $lockfile
48@@ -71,15 +71,15 @@ start() {
49 stop() {
50     echo -n $"Stopping $prog: "
51     # stop it here, often "killproc $prog"
52-    killproc -p $pidfile $prog
53+    killproc $prog
54     retval=$?
55     echo
56     [ $retval -eq 0 ] && rm -f $lockfile
57     if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/log' /proc/mounts; then
58 	umount ${rootdir}/dev/log >/dev/null 2>&1
59     fi;
60-    if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/urandom' /proc/mounts; then
61-	umount ${rootdir}/dev/urandom >/dev/null 2>&1
62+    if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/random' /proc/mounts; then
63+	umount ${rootdir}/dev/random >/dev/null 2>&1
64     fi;
65     return $retval
66 }
67@@ -99,7 +99,7 @@ force_reload() {
68
69 rh_status() {
70     # run checks to determine if the service is running or use generic status
71-    status -p $pidfile $prog
72+    status $prog
73 }
74
75 rh_status_q() {
76--
772.25.1
78
79