mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
Merge from bittboy/buildroot@db180c0
This commit is contained in:
51
package/initscripts/init.d/S20urandom
Normal file
51
package/initscripts/init.d/S20urandom
Normal file
@@ -0,0 +1,51 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# urandom This script saves the random seed between reboots.
|
||||
# It is called from the boot, halt and reboot scripts.
|
||||
#
|
||||
# Version: @(#)urandom 1.33 22-Jun-1998 miquels@cistron.nl
|
||||
#
|
||||
|
||||
[ -c /dev/urandom ] || exit 0
|
||||
#. /etc/default/rcS
|
||||
|
||||
case "$1" in
|
||||
start|"")
|
||||
# check for read only file system
|
||||
if ! touch /etc/random-seed 2>/dev/null
|
||||
then
|
||||
echo "read-only file system detected...done"
|
||||
exit
|
||||
fi
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
printf "Initializing random number generator... "
|
||||
fi
|
||||
# Load and then save 512 bytes,
|
||||
# which is the size of the entropy pool
|
||||
cat /etc/random-seed >/dev/urandom
|
||||
rm -f /etc/random-seed
|
||||
umask 077
|
||||
dd if=/dev/urandom of=/etc/random-seed count=1 \
|
||||
>/dev/null 2>&1 || echo "urandom start: failed."
|
||||
umask 022
|
||||
[ "$VERBOSE" != no ] && echo "done."
|
||||
;;
|
||||
stop)
|
||||
if ! touch /etc/random-seed 2>/dev/null
|
||||
then
|
||||
exit
|
||||
fi
|
||||
# Carry a random seed from shut-down to start-up;
|
||||
# see documentation in linux/drivers/char/random.c
|
||||
[ "$VERBOSE" != no ] && printf "Saving random seed... "
|
||||
umask 077
|
||||
dd if=/dev/urandom of=/etc/random-seed count=1 \
|
||||
>/dev/null 2>&1 || echo "urandom stop: failed."
|
||||
[ "$VERBOSE" != no ] && echo "done."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: urandom {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
27
package/initscripts/init.d/rcK
Executable file
27
package/initscripts/init.d/rcK
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# Stop all init scripts in /etc/init.d
|
||||
# executing them in reversed numerical order.
|
||||
#
|
||||
for i in $(ls -r /etc/init.d/S??*) ;do
|
||||
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set stop
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
$i stop
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
27
package/initscripts/init.d/rcS
Executable file
27
package/initscripts/init.d/rcS
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# Start all init scripts in /etc/init.d
|
||||
# executing them in numerical order.
|
||||
#
|
||||
for i in /etc/init.d/S??* ;do
|
||||
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set start
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
$i start
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user