summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initscripts
diff options
context:
space:
mode:
authorRichard Tollerton <rich.tollerton@ni.com>2014-07-17 16:56:54 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-19 00:08:47 +0100
commit558ba23cfdd60bf64b9214460a2772be70079796 (patch)
tree45ebfd83eb86c116318a2a7b124c3caabbba4cd6 /meta/recipes-core/initscripts
parent8fed53e4e72230c61f23cb36eda36c228aede1e0 (diff)
downloadopenembedded-core-contrib-558ba23cfdd60bf64b9214460a2772be70079796.tar.gz
openembedded-core-contrib-558ba23cfdd60bf64b9214460a2772be70079796.tar.bz2
openembedded-core-contrib-558ba23cfdd60bf64b9214460a2772be70079796.zip
initscripts: parametrize random seed file location
Currently, the random seed file location is hardcoded to /var/lib/urandom/random-seed. Refactor it to a parameter (RANDOM_SEED_FILE) so the file location is defined in only one place. Signed-off-by: Richard Tollerton <rich.tollerton@ni.com> Signed-off-by: Ben Shelton <ben.shelton@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initscripts')
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/urandom13
1 files changed, 8 insertions, 5 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/urandom b/meta/recipes-core/initscripts/initscripts-1.0/urandom
index eb3a7c3359..a0549dec25 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/urandom
+++ b/meta/recipes-core/initscripts/initscripts-1.0/urandom
@@ -12,6 +12,9 @@
### END INIT INFO
test -c /dev/urandom || exit 0
+
+RANDOM_SEED_FILE=/var/lib/urandom/random-seed
+
. /etc/default/rcS
case "$1" in
@@ -19,13 +22,13 @@ case "$1" in
test "$VERBOSE" != no && echo "Initializing random number generator..."
# Load and then save 512 bytes,
# which is the size of the entropy pool
- if test -f /var/lib/urandom/random-seed
+ if test -f "$RANDOM_SEED_FILE"
then
- cat /var/lib/urandom/random-seed >/dev/urandom
+ cat "$RANDOM_SEED_FILE" >/dev/urandom
fi
- rm -f /var/lib/urandom/random-seed
+ rm -f "$RANDOM_SEED_FILE"
umask 077
- dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+ dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \
>/dev/null 2>&1 || echo "urandom start: failed."
umask 022
;;
@@ -34,7 +37,7 @@ case "$1" in
# see documentation in linux/drivers/char/random.c
test "$VERBOSE" != no && echo "Saving random seed..."
umask 077
- dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
+ dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \
>/dev/null 2>&1 || echo "urandom stop: failed."
;;
*)