summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/rng-tools
diff options
context:
space:
mode:
authorNicola Lunghi <nick83ola@gmail.com>2019-06-12 14:00:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-14 22:48:22 +0100
commit6f7eaf80f71aa17124c7f0be8f52902a5194ca7b (patch)
treefe0fd00d8a777add3f778b153be43cd6242f3ecc /meta/recipes-support/rng-tools
parente00d88475d0ed7b161f5f58dd13bc9a72e3efdf9 (diff)
downloadpoky-6f7eaf80f71aa17124c7f0be8f52902a5194ca7b.tar.gz
rng-tools: harmonise systemd and sysvinit
this commit will permit to read the option from /etc/default/rng-tools both from systemd and sysvinit unit file. (From OE-Core rev: 16ced1a253c74c01ca414db2f1a010c083213b91) Signed-off-by: Nicola Lunghi <nick83ola@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/rng-tools')
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/default3
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/init21
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/rngd.service4
-rw-r--r--meta/recipes-support/rng-tools/rng-tools_6.6.bb23
4 files changed, 19 insertions, 32 deletions
diff --git a/meta/recipes-support/rng-tools/rng-tools/default b/meta/recipes-support/rng-tools/rng-tools/default
index ab7cd9327f..b9f8e03635 100644
--- a/meta/recipes-support/rng-tools/rng-tools/default
+++ b/meta/recipes-support/rng-tools/rng-tools/default
@@ -1,2 +1 @@
1# Specify rng device EXTRA_ARGS="-r /dev/hwrng"
2RNG_DEVICE=/dev/hwrng
diff --git a/meta/recipes-support/rng-tools/rng-tools/init b/meta/recipes-support/rng-tools/rng-tools/init
index 7cf78393a4..13f0ecd37c 100644
--- a/meta/recipes-support/rng-tools/rng-tools/init
+++ b/meta/recipes-support/rng-tools/rng-tools/init
@@ -1,26 +1,19 @@
1#! /bin/sh 1#!/bin/sh
2# 2#
3# This is an init script for openembedded 3# This is an init script for openembedded
4# Copy it to /etc/init.d/rng-tools and type 4# Copy it to @SYSCONFDIR@/init.d/rng-tools and type
5# > update-rc.d rng-tools defaults 60 5# > update-rc.d rng-tools defaults 60
6# 6#
7 7
8rngd=/usr/sbin/rngd 8rngd=@SBINDIR@/rngd
9test -x "$rngd" || exit 1 9test -x "$rngd" || exit 1
10 10
11if [ -e /etc/default/rng-tools ]; then 11[ -r @SYSCONFDIR@/default/rng-tools ] && . "@SYSCONFDIR@/default/rng-tools"
12 . /etc/default/rng-tools
13fi
14
15if [ -n "$RNG_DEVICE" ]; then
16 EXTRA_ARGS="-- -r $RNG_DEVICE"
17fi
18
19 12
20case "$1" in 13case "$1" in
21 start) 14 start)
22 echo -n "Starting random number generator daemon" 15 echo -n "Starting random number generator daemon"
23 start-stop-daemon -S -q -x $rngd $EXTRA_ARGS 16 start-stop-daemon -S -q -x $rngd -- $EXTRA_ARGS
24 echo "." 17 echo "."
25 ;; 18 ;;
26 stop) 19 stop)
@@ -38,11 +31,11 @@ case "$1" in
38 start-stop-daemon -K -q -n rngd 31 start-stop-daemon -K -q -n rngd
39 echo "." 32 echo "."
40 echo -n "Starting random number generator daemon" 33 echo -n "Starting random number generator daemon"
41 start-stop-daemon -S -q -x $rngd $EXTRA_ARGS 34 start-stop-daemon -S -q -x $rngd -- $EXTRA_ARGS
42 echo "." 35 echo "."
43 ;; 36 ;;
44 *) 37 *)
45 echo "Usage: /etc/init.d/rng-tools {start|stop|reload|restart|force-reload}" 38 echo "Usage: @SYSCONFDIR@/init.d/rng-tools {start|stop|reload|restart|force-reload}"
46 exit 1 39 exit 1
47esac 40esac
48 41
diff --git a/meta/recipes-support/rng-tools/rng-tools/rngd.service b/meta/recipes-support/rng-tools/rng-tools/rngd.service
index f0355db14f..b1a78527be 100644
--- a/meta/recipes-support/rng-tools/rng-tools/rngd.service
+++ b/meta/recipes-support/rng-tools/rng-tools/rngd.service
@@ -5,8 +5,8 @@ After=systemd-udev-settle.service
5Before=sysinit.target 5Before=sysinit.target
6 6
7[Service] 7[Service]
8ExecStart=@SBINDIR@/rngd -f -r /dev/hwrng 8EnvironmentFile=-@SYSCONFDIR@/default/rng-tools
9SuccessExitStatus=66 9ExecStart=@SBINDIR@/rngd -f $EXTRA_ARGS
10 10
11[Install] 11[Install]
12WantedBy=multi-user.target 12WantedBy=multi-user.target
diff --git a/meta/recipes-support/rng-tools/rng-tools_6.6.bb b/meta/recipes-support/rng-tools/rng-tools_6.6.bb
index 41959a2695..b0afa4b0eb 100644
--- a/meta/recipes-support/rng-tools/rng-tools_6.6.bb
+++ b/meta/recipes-support/rng-tools/rng-tools_6.6.bb
@@ -44,18 +44,13 @@ do_configure_prepend() {
44} 44}
45 45
46do_install_append() { 46do_install_append() {
47 install -d "${D}${sysconfdir}/init.d" 47 install -Dm 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/rng-tools
48 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/rng-tools 48 install -Dm 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/rng-tools
49 sed -i -e 's,/etc/,${sysconfdir}/,' -e 's,/usr/sbin/,${sbindir}/,' \ 49 install -Dm 0644 ${WORKDIR}/rngd.service \
50 ${D}${sysconfdir}/init.d/rng-tools 50 ${D}${systemd_system_unitdir}/rngd.service
51 51 sed -i \
52 # Only install the default script when 'sysvinit' is in DISTRO_FEATURES. 52 -e 's,@SYSCONFDIR@,${sysconfdir},' \
53 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then 53 -e 's,@SBINDIR@,${sbindir},' \
54 install -d "${D}${sysconfdir}/default" 54 ${D}${sysconfdir}/init.d/rng-tools \
55 install -m 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/rng-tools 55 ${D}${systemd_system_unitdir}/rngd.service
56 fi
57
58 install -d ${D}${systemd_unitdir}/system
59 install -m 644 ${WORKDIR}/rngd.service ${D}${systemd_unitdir}/system
60 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/rngd.service
61} 56}