aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/rng-tools/rng-tools/init
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-12 23:15:45 +0100
commit16ced1a253c74c01ca414db2f1a010c083213b91 (patch)
treea66a3b9824a5c47dfb00ed3d7a99c2e45a340eb7 /meta/recipes-support/rng-tools/rng-tools/init
parentca737408bb7e9dd24f3a18e60fad290c6e539b7b (diff)
downloadopenembedded-core-contrib-16ced1a253c74c01ca414db2f1a010c083213b91.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. 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/rng-tools/init')
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/init21
1 files changed, 7 insertions, 14 deletions
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 @@
-#! /bin/sh
+#!/bin/sh
#
# This is an init script for openembedded
-# Copy it to /etc/init.d/rng-tools and type
+# Copy it to @SYSCONFDIR@/init.d/rng-tools and type
# > update-rc.d rng-tools defaults 60
#
-rngd=/usr/sbin/rngd
+rngd=@SBINDIR@/rngd
test -x "$rngd" || exit 1
-if [ -e /etc/default/rng-tools ]; then
- . /etc/default/rng-tools
-fi
-
-if [ -n "$RNG_DEVICE" ]; then
- EXTRA_ARGS="-- -r $RNG_DEVICE"
-fi
-
+[ -r @SYSCONFDIR@/default/rng-tools ] && . "@SYSCONFDIR@/default/rng-tools"
case "$1" in
start)
echo -n "Starting random number generator daemon"
- start-stop-daemon -S -q -x $rngd $EXTRA_ARGS
+ start-stop-daemon -S -q -x $rngd -- $EXTRA_ARGS
echo "."
;;
stop)
@@ -38,11 +31,11 @@ case "$1" in
start-stop-daemon -K -q -n rngd
echo "."
echo -n "Starting random number generator daemon"
- start-stop-daemon -S -q -x $rngd $EXTRA_ARGS
+ start-stop-daemon -S -q -x $rngd -- $EXTRA_ARGS
echo "."
;;
*)
- echo "Usage: /etc/init.d/rng-tools {start|stop|reload|restart|force-reload}"
+ echo "Usage: @SYSCONFDIR@/init.d/rng-tools {start|stop|reload|restart|force-reload}"
exit 1
esac