diff options
author | Richard Tollerton <rich.tollerton@ni.com> | 2014-07-17 16:56:54 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-19 00:08:59 +0100 |
commit | 769b0f3018358b276e1a12b0a6f621412f2ccbcd (patch) | |
tree | 1cba243f57bd9ac48d01d0449aec584acd581f3c /meta/recipes-core | |
parent | 00017b4dd895afff9ff613d511cea373f13a96ea (diff) | |
download | poky-769b0f3018358b276e1a12b0a6f621412f2ccbcd.tar.gz |
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.
(From OE-Core rev: 558ba23cfdd60bf64b9214460a2772be70079796)
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')
-rwxr-xr-x | meta/recipes-core/initscripts/initscripts-1.0/urandom | 13 |
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 @@ | |||
12 | ### END INIT INFO | 12 | ### END INIT INFO |
13 | 13 | ||
14 | test -c /dev/urandom || exit 0 | 14 | test -c /dev/urandom || exit 0 |
15 | |||
16 | RANDOM_SEED_FILE=/var/lib/urandom/random-seed | ||
17 | |||
15 | . /etc/default/rcS | 18 | . /etc/default/rcS |
16 | 19 | ||
17 | case "$1" in | 20 | case "$1" in |
@@ -19,13 +22,13 @@ case "$1" in | |||
19 | test "$VERBOSE" != no && echo "Initializing random number generator..." | 22 | test "$VERBOSE" != no && echo "Initializing random number generator..." |
20 | # Load and then save 512 bytes, | 23 | # Load and then save 512 bytes, |
21 | # which is the size of the entropy pool | 24 | # which is the size of the entropy pool |
22 | if test -f /var/lib/urandom/random-seed | 25 | if test -f "$RANDOM_SEED_FILE" |
23 | then | 26 | then |
24 | cat /var/lib/urandom/random-seed >/dev/urandom | 27 | cat "$RANDOM_SEED_FILE" >/dev/urandom |
25 | fi | 28 | fi |
26 | rm -f /var/lib/urandom/random-seed | 29 | rm -f "$RANDOM_SEED_FILE" |
27 | umask 077 | 30 | umask 077 |
28 | dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \ | 31 | dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \ |
29 | >/dev/null 2>&1 || echo "urandom start: failed." | 32 | >/dev/null 2>&1 || echo "urandom start: failed." |
30 | umask 022 | 33 | umask 022 |
31 | ;; | 34 | ;; |
@@ -34,7 +37,7 @@ case "$1" in | |||
34 | # see documentation in linux/drivers/char/random.c | 37 | # see documentation in linux/drivers/char/random.c |
35 | test "$VERBOSE" != no && echo "Saving random seed..." | 38 | test "$VERBOSE" != no && echo "Saving random seed..." |
36 | umask 077 | 39 | umask 077 |
37 | dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \ | 40 | dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \ |
38 | >/dev/null 2>&1 || echo "urandom stop: failed." | 41 | >/dev/null 2>&1 || echo "urandom stop: failed." |
39 | ;; | 42 | ;; |
40 | *) | 43 | *) |