diff options
| -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 | *) |
