summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/default3
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/init49
-rw-r--r--meta/recipes-support/rng-tools/rng-tools_5.bb38
3 files changed, 90 insertions, 0 deletions
diff --git a/meta/recipes-support/rng-tools/rng-tools/default b/meta/recipes-support/rng-tools/rng-tools/default
new file mode 100644
index 0000000000..7aede9be03
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools/default
@@ -0,0 +1,3 @@
1# Specify rng device
2#RNG_DEVICE=/dev/hwrng
3RNG_DEVICE=/dev/urandom
diff --git a/meta/recipes-support/rng-tools/rng-tools/init b/meta/recipes-support/rng-tools/rng-tools/init
new file mode 100644
index 0000000000..7cf78393a4
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools/init
@@ -0,0 +1,49 @@
1#! /bin/sh
2#
3# This is an init script for openembedded
4# Copy it to /etc/init.d/rng-tools and type
5# > update-rc.d rng-tools defaults 60
6#
7
8rngd=/usr/sbin/rngd
9test -x "$rngd" || exit 1
10
11if [ -e /etc/default/rng-tools ]; then
12 . /etc/default/rng-tools
13fi
14
15if [ -n "$RNG_DEVICE" ]; then
16 EXTRA_ARGS="-- -r $RNG_DEVICE"
17fi
18
19
20case "$1" in
21 start)
22 echo -n "Starting random number generator daemon"
23 start-stop-daemon -S -q -x $rngd $EXTRA_ARGS
24 echo "."
25 ;;
26 stop)
27 echo -n "Stopping random number generator daemon"
28 start-stop-daemon -K -q -n rngd
29 echo "."
30 ;;
31 reload|force-reload)
32 echo -n "Signalling rng daemon restart"
33 start-stop-daemon -K -q -s 1 -x $rngd
34 start-stop-daemon -K -q -s 1 -x $rngd
35 ;;
36 restart)
37 echo -n "Stopping random number generator daemon"
38 start-stop-daemon -K -q -n rngd
39 echo "."
40 echo -n "Starting random number generator daemon"
41 start-stop-daemon -S -q -x $rngd $EXTRA_ARGS
42 echo "."
43 ;;
44 *)
45 echo "Usage: /etc/init.d/rng-tools {start|stop|reload|restart|force-reload}"
46 exit 1
47esac
48
49exit 0
diff --git a/meta/recipes-support/rng-tools/rng-tools_5.bb b/meta/recipes-support/rng-tools/rng-tools_5.bb
new file mode 100644
index 0000000000..67f53f2998
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools_5.bb
@@ -0,0 +1,38 @@
1SUMMARY = "Random number generator daemon"
2LICENSE = "GPLv2"
3LIC_FILES_CHKSUM = "file://COPYING;md5=0b6f033afe6db235e559456585dc8cdc"
4DEPENDS_append_libc-uclibc = " argp-standalone"
5
6SRC_URI = "http://heanet.dl.sourceforge.net/sourceforge/gkernel/${BP}.tar.gz \
7 file://init \
8 file://default"
9
10SRC_URI[md5sum] = "6726cdc6fae1f5122463f24ae980dd68"
11SRC_URI[sha256sum] = "60a102b6603bbcce2da341470cad42eeaa9564a16b4490e7867026ca11a3078e"
12
13# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
14# manually to avoid unnecessary postinst/preinst generated.
15python () {
16 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
17 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
18}
19
20inherit autotools update-rc.d
21
22RDEPENDS_${PN} = "libgcrypt"
23
24do_install_append() {
25 # Only install the init script when 'sysvinit' is in DISTRO_FEATURES.
26 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
27 install -d "${D}${sysconfdir}/init.d"
28 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/rng-tools
29 sed -i -e 's,/etc/,${sysconfdir}/,' -e 's,/usr/sbin/,${sbindir}/,' \
30 ${D}${sysconfdir}/init.d/rng-tools
31
32 install -d "${D}${sysconfdir}/default"
33 install -m 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/rng-tools
34 fi
35}
36
37INITSCRIPT_NAME = "rng-tools"
38INITSCRIPT_PARAMS = "start 30 S . stop 30 0 6 1 ."