aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/rcS.d/220-random.sh
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2010-08-03 18:14:03 +0200
committerHarald Hoyer <harald@redhat.com>2010-08-03 18:21:38 +0200
commit34dd409cb1199e3573655293475a76beb86931cd (patch)
treebacd86bd6923ac5c0147411305425fc7f5ca1237 /rc.d/rcS.d/220-random.sh
parente127d5bcfe2e0175e88e8afdd644ee05a22538a5 (diff)
downloadinitscripts-9.16.0.2.systemd-1.tar
initscripts-9.16.0.2.systemd-1.tar.gz
initscripts-9.16.0.2.systemd-1.tar.bz2
initscripts-9.16.0.2.systemd-1.tar.xz
initscripts-9.16.0.2.systemd-1.zip
add systemd servicesinitscripts-9.16.0.2.systemd-1
Diffstat (limited to 'rc.d/rcS.d/220-random.sh')
-rwxr-xr-xrc.d/rcS.d/220-random.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/rc.d/rcS.d/220-random.sh b/rc.d/rcS.d/220-random.sh
new file mode 100755
index 00000000..fa1102ad
--- /dev/null
+++ b/rc.d/rcS.d/220-random.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+[[ $(type -t strstr) = "function" ]] || . /etc/init.d/functions
+[[ $cmdline ]] || cmdline=$(cat /proc/cmdline)
+
+READONLY=no
+if [ -f /etc/sysconfig/readonly-root ]; then
+ . /etc/sysconfig/readonly-root
+fi
+if strstr "$cmdline" readonlyroot ; then
+ READONLY=yes
+ [ -z "$RW_MOUNT" ] && RW_MOUNT=/var/lib/stateless/writable
+ [ -z "$STATE_MOUNT" ] && STATE_MOUNT=/var/lib/stateless/state
+fi
+if strstr "$cmdline" noreadonlyroot ; then
+ READONLY=no
+fi
+
+# Initialize pseudo-random number generator
+if [ -f "/var/lib/random-seed" ]; then
+ cat /var/lib/random-seed > /dev/urandom
+else
+ [ "$READONLY" != "yes" ] && touch /var/lib/random-seed
+fi
+if [ "$READONLY" != "yes" ]; then
+ chmod 600 /var/lib/random-seed
+ dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 2>/dev/null
+fi
+: