All of lore.kernel.org
 help / color / mirror / Atom feed
From: Otavio Salvador <otavio@ossystems.com.br>
To: Meta-OpenEmbedded Mailing listing
	<openembedded-devel@lists.openembedded.org>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Subject: [meta-oe PATCH] haveged: Add sysvinit support
Date: Mon, 13 Nov 2017 17:29:07 -0200	[thread overview]
Message-ID: <20171113192907.27387-1-otavio@ossystems.com.br> (raw)

The haveged daemon is also useful on sysvinit-based systems, so we add
a init script for this use-case.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

 .../haveged/haveged/haveged.sysvinit               | 35 ++++++++++++++++++++++
 meta-oe/recipes-extended/haveged/haveged_1.9.1.bb  |  9 +++++-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100755 meta-oe/recipes-extended/haveged/haveged/haveged.sysvinit

diff --git a/meta-oe/recipes-extended/haveged/haveged/haveged.sysvinit b/meta-oe/recipes-extended/haveged/haveged/haveged.sysvinit
new file mode 100755
index 000000000..98b8857e7
--- /dev/null
+++ b/meta-oe/recipes-extended/haveged/haveged/haveged.sysvinit
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+pidfile=/var/run/haveged.pid
+
+# source function library
+. /etc/init.d/functions
+
+case "$1" in
+    start)
+    echo -n "Starting havege entropy daemon... "
+    start-stop-daemon --start --quiet --pidfile $pidfile --name haveged --startas haveged --  -w 1024 -v 0 && success || failure
+    echo
+    ;;
+    stop)
+    echo -n "Stopping havege entropy daemon... "
+    start-stop-daemon --stop --quiet --pidfile $pidfile --name haveged
+    success
+    echo
+    ;;
+    restart)
+    $0 stop
+    sleep 1
+    $0 start
+    ;;
+    status)
+    status haveged
+    ;;
+    *)
+    echo "Usage: /etc/init.d/haveged {start|stop|restart|status}"
+    exit 1
+esac
+
+exit 0
diff --git a/meta-oe/recipes-extended/haveged/haveged_1.9.1.bb b/meta-oe/recipes-extended/haveged/haveged_1.9.1.bb
index bb44c4138..419c85f51 100644
--- a/meta-oe/recipes-extended/haveged/haveged_1.9.1.bb
+++ b/meta-oe/recipes-extended/haveged/haveged_1.9.1.bb
@@ -7,12 +7,13 @@ LIC_FILES_CHKSUM="file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 SRC_URI = "http://www.issihosts.com/haveged/haveged-${PV}.tar.gz \
     file://remove-systemd-unit-503.patch \
+    file://haveged.sysvinit \
 "
 
 SRC_URI[md5sum] = "015ff58cd10607db0e0de60aeca2f5f8"
 SRC_URI[sha256sum] = "9c2363ed9542a6784ff08e247182137e71f2ddb79e8e6c1ac4ad50d21ced3715"
 
-inherit autotools systemd
+inherit autotools update-rc.d systemd
 
 EXTRA_OECONF = "\
     --enable-init=service.redhat \
@@ -21,10 +22,16 @@ EXTRA_OECONF = "\
     --enable-threads=no \
 "
 
+INITSCRIPT_PACKAGES = "${PN}"
+INITSCRIPT_NAME = "haveged"
+INITSCRIPT_PARAMS_${PN} = "defaults 9"
+
 SYSTEMD_PACKAGES = "${PN}"
 SYSTEMD_SERVICE_${PN} = "haveged.service"
 
 do_install_append() {
+    install -D -m 755 ${WORKDIR}/haveged.sysvinit ${D}${sysconfdir}/init.d/haveged
+
     mkdir -p ${D}${systemd_unitdir}/system
     install -p -m644 ${B}/init.d/haveged.service ${D}${systemd_unitdir}/system
 }
-- 
2.15.0



                 reply	other threads:[~2017-11-13 19:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171113192907.27387-1-otavio@ossystems.com.br \
    --to=otavio@ossystems.com.br \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.