From 3bf49a9bd19d5bbcf6976dd42b4f87f1b173e287 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 11 Jan 2008 12:13:46 +0000 Subject: Adopt a more C style for scripts and remove vim settings. --- init.d/urandom | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'init.d/urandom') diff --git a/init.d/urandom b/init.d/urandom index 9e2632fd..f6585deb 100755 --- a/init.d/urandom +++ b/init.d/urandom @@ -6,24 +6,27 @@ urandom_seed=${urandom_seed:-${URANDOM_SEED:-/var/run/random-seed}} description="Initializes the random number generator." -depend() { +depend() +{ need localmount } -save_seed() { - local poolsize=1 +save_seed() +{ + local psz=1 if [ -e /proc/sys/kernel/random/poolsize ]; then - poolsize=$(($(cat /proc/sys/kernel/random/poolsize) / 4096)) + psz=$(($(cat /proc/sys/kernel/random/poolsize) / 4096)) fi ( # sub shell to prevent umask pollution umask 077 - dd if=/dev/urandom of="${urandom_seed}" count=${poolsize} 2>/dev/null + dd if=/dev/urandom of="${urandom_seed}" count=${psz} 2>/dev/null ) } -start() { +start() +{ [ -c /dev/urandom ] || return if [ -f "${urandom_seed}" ]; then ebegin "Initializing random number generator" @@ -34,10 +37,9 @@ start() { return 0 } -stop() { +stop() +{ ebegin "Saving random seed" save_seed eend $? "Failed to save random seed" } - -# vim: set ts=4 : -- cgit v1.2.3