package/initscripts: refactor S20urandom
Adapt the format to the current template, used in other init scripts,
but do not use start/stop functions due to peculiarities.
Treat RNG initialization and random seed backup as separate operations.
Read /proc/sys/kernel/random/poolsize to calculate the pool size, as
suggestred by the urandom manual page.
Ensure that the random seed file has the correct size to prevent dumping
an empty file to /dev/urandom on the first boot.
Save the seed at /var/lib/random-seed as other non-systemd distributions
do (e.g. RHEL6), since /etc can be in a red-only rootfs. The Filesystem
Hierarchy Standard defines that /var/lib holds persistent data modified
by programs as they run.
Users willing to use a different path just need to redefine URANDOM_SEED
in /etc/default/urandom instead of rewriting the init script.
[Peter: save/restore umask]
Signed-off-by: Carlos Santos <unixmania@gmail.com>
Tested-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>