summaryrefslogtreecommitdiff
path: root/s6/sv/random-seed/up
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-03-01 22:01:26 +0000
committerdavidovski <david@davidovski.xyz>2022-03-01 22:01:26 +0000
commitefee4ebf43e376a7cd8b8abcef0c70aa90427bb4 (patch)
tree13956b6dbca8622b71edbdd3a1c2a949c5d1aac8 /s6/sv/random-seed/up
initial commit
Diffstat (limited to 's6/sv/random-seed/up')
-rw-r--r--s6/sv/random-seed/up8
1 files changed, 8 insertions, 0 deletions
diff --git a/s6/sv/random-seed/up b/s6/sv/random-seed/up
new file mode 100644
index 0000000..9591e6c
--- /dev/null
+++ b/s6/sv/random-seed/up
@@ -0,0 +1,8 @@
+#!/bin/execlineb -P
+if { s6-echo "[ ReadWrite Mode ] 4/6 : Restoring random seed" }
+#foreground { umask 077; cp /var/lib/random-seed /dev/urandom }
+foreground { cp /var/lib/random-seed /dev/urandom }
+backtick -n bytes { cat /proc/sys/kernel/random/poolsize }
+importas -iu bytes bytes
+foreground { if { s6-test -z $bytes } define bytes 512 }
+foreground { redirfd -w 2 /dev/null dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes }