/[baselayout]/branches/bsd-porting-2/init.d/urandom
Gentoo

Contents of /branches/bsd-porting-2/init.d/urandom

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1869 - (hide annotations) (download)
Mon Feb 13 20:16:12 2006 UTC (7 years, 3 months ago) by flameeyes
Original Path: bsd-porting-2/init.d/urandom
File size: 920 byte(s)
Branching for new porting trial.


1 drobbins 2 #!/sbin/runscript
2 vapier 1781 # Copyright 1999-2006 Gentoo Foundation
3 azarah 266 # Distributed under the terms of the GNU General Public License v2
4 drobbins 2
5     depend() {
6     need localmount
7     }
8    
9     start() {
10 vapier 901 [[ -c /dev/urandom ]] || return
11     if [[ -f /var/run/random-seed ]] ; then
12 vapier 935 cat /var/run/random-seed > /dev/urandom
13 jerrya 64 fi
14 vapier 901 if ! rm -f /var/run/random-seed &> /dev/null ; then
15 vapier 1640 ewarn $"Skipping /var/run/random-seed initialization (ro root?)"
16 vapier 630 return 0
17     fi
18 vapier 1640 ebegin $"Initializing random number generator"
19 jerrya 64 umask 077
20 vapier 901 dd if=/dev/urandom of=/var/run/random-seed count=1 &> /dev/null
21 vapier 1640 eend $? $"Error initializing random number generator"
22 drobbins 2 umask 022
23     }
24    
25     stop() {
26 vapier 901 [[ -n ${CDBOOT} ]] && return 0
27 vapier 630
28 vapier 1640 ebegin $"Saving random seed"
29 jerrya 64 # Carry a random seed from shut-down to start-up;
30     # see documentation in linux/drivers/char/random.c
31     umask 077
32 vapier 901 dd if=/dev/urandom of=/var/run/random-seed count=1 &> /dev/null
33 vapier 1640 eend $? $"Failed to save random seed"
34 drobbins 2 }
35 azarah 143
36 azarah 144
37     # vim:ts=4

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.13