aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2004-07-07 20:38:02 +0000
committerBill Nottingham <notting@redhat.com>2004-07-07 20:38:02 +0000
commit179e85006c4b278860d4effbc4ddfc06779acc81 (patch)
treee6d8653e829dc503473336c0af06e747d13f87cd
parent59f9e229092c5fd41d5a8cad5a7655a610ca01e5 (diff)
downloadinitscripts-179e85006c4b278860d4effbc4ddfc06779acc81.tar
initscripts-179e85006c4b278860d4effbc4ddfc06779acc81.tar.gz
initscripts-179e85006c4b278860d4effbc4ddfc06779acc81.tar.bz2
initscripts-179e85006c4b278860d4effbc4ddfc06779acc81.tar.xz
initscripts-179e85006c4b278860d4effbc4ddfc06779acc81.zip
move random stuff to rc.sysinit/halt; move all swap to after this.
prereq of bug #123278
-rw-r--r--initscripts.spec18
-rwxr-xr-xrc.d/init.d/halt5
-rwxr-xr-xrc.d/init.d/random59
-rwxr-xr-xrc.d/rc.sysinit22
4 files changed, 27 insertions, 77 deletions
diff --git a/initscripts.spec b/initscripts.spec
index 8e068332..1d78d719 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -71,10 +71,9 @@ touch /var/run/utmp
chown root:utmp /var/log/wtmp /var/run/utmp
chmod 664 /var/log/wtmp /var/run/utmp
-chkconfig --add random
-chkconfig --add netfs
-chkconfig --add network
-chkconfig --add rawdevices
+/sbin/chkconfig --add netfs
+/sbin/chkconfig --add network
+/sbin/chkconfig --add rawdevices
# handle serial installs semi gracefully
if [ $1 = 0 ]; then
@@ -97,14 +96,15 @@ fi
%preun
if [ $1 = 0 ]; then
- chkconfig --del random
- chkconfig --del netfs
- chkconfig --del network
- chkconfig --del rawdevices
+ /sbin/chkconfig --del netfs
+ /sbin/chkconfig --del network
+ /sbin/chkconfig --del rawdevices
fi
+%triggerun -- initscripts <= 7.59
+/sbin/chkconfig --del random
+
%triggerpostun -- initscripts <= 5.04
-/sbin/chkconfig --add random
/sbin/chkconfig --add netfs
/sbin/chkconfig --add network
diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt
index 42a40650..89ef597f 100755
--- a/rc.d/init.d/halt
+++ b/rc.d/init.d/halt
@@ -69,6 +69,11 @@ if [ $? = 0 -a -x /usr/sbin/alsactl ]; then
runcmd $"Saving mixer settings" alsactl store
fi
+# Save random seed
+touch /var/lib/random_seed
+chmod 600 /var/lib/random_seed
+runcmd $"Saving random seed: " dd if=/dev/urandom of=/var/lib/random_seed count=1 bs=512 2>/dev/null
+
# Sync the system clock.
ARC=0
SRM=0
diff --git a/rc.d/init.d/random b/rc.d/init.d/random
deleted file mode 100755
index 09ddd881..00000000
--- a/rc.d/init.d/random
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-#
-# random Script to snapshot random state and reload it at boot time.
-#
-# Author: Theodore Ts'o <tytso@mit.edu>
-#
-# chkconfig: 2345 20 80
-# description: Saves and restores system entropy pool for higher quality \
-# random number generation.
-
-. /etc/init.d/functions
-
-random_seed=/var/lib/random-seed
-
-# See how we were called.
-case "$1" in
- start)
- # Carry a random seed from start-up to start-up
- # Load and then save 512 bytes, which is the size of the entropy pool
- if [ -f $random_seed ]; then
- cat $random_seed >/dev/urandom
- else
- touch $random_seed
- fi
- action $"Initializing random number generator: " /bin/true
- chmod 600 $random_seed
- dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
- touch /var/lock/subsys/random
-
- ;;
- stop)
- # Carry a random seed from shut-down to start-up
- # Save 512 bytes, which is the size of the entropy pool
- touch $random_seed
- chmod 600 $random_seed
- action $"Saving random seed: " dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
-
- rm -f /var/lock/subsys/random
- ;;
- status)
- # this is way overkill, but at least we have some status output...
- if [ -c /dev/random ] ; then
- echo $"The random data source exists"
- else
- echo $"The random data source is missing"
- fi
- ;;
- restart|reload)
- # do not do anything; this is unreasonable
- :
- ;;
- *)
- # do not advertise unreasonable commands that there is no reason
- # to use with this device
- echo $"Usage: $0 {start|stop|status|restart|reload}"
- exit 1
-esac
-
-exit 0
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index 30530c05..de29ff4a 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -403,10 +403,6 @@ if [ -f /etc/lvmtab ]; then
fi
fi
-# Start up swapping.
-update_boot_stage RCswap
-action $"Activating swap partitions: " swapon -a -e
-
# Clean up SELinux labels
if [ -n "$SELINUX" ]; then
for file in /etc/mtab /etc/ld.so.cache ; do
@@ -428,8 +424,6 @@ mount -f /dev/pts
[ -f /proc/bus/usb/devices ] && mount -f -t usbdevfs usbdevfs /proc/bus/usb
[ -e /dev/.devfsd ] && mount -f -t devfs devfs /dev
-
-
# The root filesystem is now read-write, so we can now log
# via syslog() directly..
if [ -n "$IN_INITLOG" ]; then
@@ -643,6 +637,16 @@ if [ -x /sbin/quotaon ]; then
action $"Enabling local filesystem quotas: " /sbin/quotaon -aug
fi
+# Initialize pseudo-random number generator
+if [ -f "/var/lib/random-seed" ]; then
+ cat /var/lib/random-seed > /dev/urandom
+else
+ touch /var/lib/random-seed
+fi
+chmod 600 /var/lib/random-seed
+dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 2>/dev/null
+
+
# Configure machine if necessary.
if [ -f /.unconfigured ]; then
if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then
@@ -732,9 +736,9 @@ mkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1
chown root:root /tmp/.ICE-unix
[ -n "$SELINUX" ] && restorecon /tmp/.ICE-unix
-# Now turn on swap in case we swap to files.
-swapon -a
-action $"Enabling swap space: " /bin/true
+# Start up swapping.
+update_boot_stage RCswap
+action $"Enabling swap space: " swapon -a -e
# Initialize the serial ports.
if [ -f /etc/rc.serial ]; then