aboutsummaryrefslogtreecommitdiff
path: root/rc.lib
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-05-16 12:55:12 +0300
committerCem Keylan <cem@ckyln.com>2020-05-16 12:55:12 +0300
commitc140ff0ad691a34ecf9b46ea471ba6a6fc4dfd32 (patch)
treed183fd2112bc989e26b9d4c36e0a789c60dc975a /rc.lib
parent8c876541ee2e9f1240edf9c9a150f7c19dc9cf61 (diff)
downloadinit-c140ff0ad691a34ecf9b46ea471ba6a6fc4dfd32.tar.gz
init: multiple changes
- added a random function for random seed - if svctl exists, kill sysmgr services
Diffstat (limited to 'rc.lib')
-rw-r--r--rc.lib20
1 files changed, 20 insertions, 0 deletions
diff --git a/rc.lib b/rc.lib
index 412f98b..8d65dd9 100644
--- a/rc.lib
+++ b/rc.lib
@@ -17,3 +17,23 @@ run_hook() {
. "$hook"
done
}
+
+random() {
+ seed=/var/random.seed
+ case "$1" in
+ load)
+ out "Seeding random..."
+ [ -f "$seed" ] || {
+ out "Generating entropy, this might take a while..."
+ dd count=1 bs=512 if=/dev/random of="$seed" 2>/dev/null
+ }
+ cat "$seed" > /dev/urandom
+ ;;
+ save)
+ mkdir -p "${seed%/*}"
+ out "Saving random seed..."
+ dd count=1 bs=512 if=/dev/urandom of="$seed" 2>/dev/null
+ ;;
+ esac
+}
+