Index: head/etc/rc.d/cleanvar =================================================================== --- head/etc/rc.d/cleanvar (revision 169923) +++ head/etc/rc.d/cleanvar (revision 169924) @@ -1,73 +1,73 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: cleanvar # REQUIRE: FILESYSTEMS var . /etc/rc.subr name="cleanvar" rcvar=`set_rcvar` start_precmd="${name}_prestart" start_cmd="${name}_start" stop_cmd=":" extra_commands="reload" reload_cmd="${name}_start" purgedir() { local dir file if [ $# -eq 0 ]; then purgedir . else for dir do ( cd "$dir" && for file in .* * do # Skip over logging sockets [ -S "$file" -a "$file" = "log" ] && continue [ -S "$file" -a "$file" = "logpriv" ] && continue [ ."$file" = .. -o ."$file" = ... ] && continue if [ -d "$file" -a ! -L "$file" ] then purgedir "$file" else rm -f -- "$file" fi done ) done fi } cleanvar_prestart() { # These files must be removed only the first time this script is run # on boot. # rm -f /var/run/clean_var /var/spool/lock/clean_var } cleanvar_start () { if [ -d /var/run -a ! -f /var/run/clean_var ]; then purgedir /var/run # And an initial utmp file - (cd /var/run && cp /dev/null utmp && chmod 644 utmp;) + (cd /var/run && cp /dev/null utmp && chmod 644 utmp) >/var/run/clean_var fi if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then purgedir /var/spool/lock >/var/spool/lock/clean_var fi rm -rf /var/spool/uucp/.Temp/* } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/initrandom =================================================================== --- head/etc/rc.d/initrandom (revision 169923) +++ head/etc/rc.d/initrandom (revision 169924) @@ -1,79 +1,79 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: initrandom # BEFORE: disks # KEYWORD: nojail . /etc/rc.subr name="initrandom" start_cmd="initrandom_start" stop_cmd=":" feed_dev_random() { if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null fi } initrandom_start() { soft_random_generator=`sysctl kern.random 2>/dev/null` echo -n 'Entropy harvesting:' if [ \! -z "${soft_random_generator}" ] ; then if checkyesno harvest_interrupt; then if [ -w /dev/random ]; then ${SYSCTL_W} kern.random.sys.harvest.interrupt=1 >/dev/null echo -n ' interrupts' fi fi if checkyesno harvest_ethernet; then if [ -w /dev/random ]; then ${SYSCTL_W} kern.random.sys.harvest.ethernet=1 >/dev/null echo -n ' ethernet' fi fi if checkyesno harvest_p_to_p; then if [ -w /dev/random ]; then ${SYSCTL_W} kern.random.sys.harvest.point_to_point=1 >/dev/null echo -n ' point_to_point' fi fi # XXX temporary until we can improve the entropy # harvesting rate. # Entropy below is not great, but better than nothing. # This unblocks the generator at startup - ( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; ) \ + ( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww ) \ | dd of=/dev/random bs=8k 2>/dev/null cat /bin/ls | dd of=/dev/random bs=8k 2>/dev/null # First pass at reseeding /dev/random. # case ${entropy_file} in [Nn][Oo] | '') ;; *) if [ -w /dev/random ]; then feed_dev_random "${entropy_file}" fi ;; esac echo -n ' kickstart' fi echo '.' } load_rc_config random run_rc_command "$1"