From patchwork Fri Nov 30 10:19:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: initscripts/urandom: change random-seed directory Date: Fri, 30 Nov 2012 10:19:28 -0000 From: Ming Liu X-Patchwork-Id: 39945 Message-Id: <1354270768-5265-1-git-send-email-ming.liu@windriver.com> To: /etc/init.d/urandom fails to start/stop because it tries to save random-seed into /var/lib/urandom folder which does not exist in the file system. Fixed by using /var/lib/misc instead of /var/lib/urandom. Signed-off-by: Ming Liu --- meta/recipes-core/initscripts/initscripts-1.0/urandom | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/meta/recipes-core/initscripts/initscripts-1.0/urandom b/meta/recipes-core/initscripts/initscripts-1.0/urandom index eb3a7c3..1cf7c5c 100755 --- a/meta/recipes-core/initscripts/initscripts-1.0/urandom +++ b/meta/recipes-core/initscripts/initscripts-1.0/urandom @@ -14,18 +14,19 @@ test -c /dev/urandom || exit 0 . /etc/default/rcS +SAVEDFILE=/var/lib/misc/random-seed case "$1" in start|"") 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 $SAVEDFILE then - cat /var/lib/urandom/random-seed >/dev/urandom + cat $SAVEDFILE >/dev/urandom fi - rm -f /var/lib/urandom/random-seed + rm -f $SAVEDFILE umask 077 - dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \ + dd if=/dev/urandom of=$SAVEDFILE count=1 \ >/dev/null 2>&1 || echo "urandom start: failed." umask 022 ;; @@ -34,7 +35,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=$SAVEDFILE count=1 \ >/dev/null 2>&1 || echo "urandom stop: failed." ;; *)