S01seedrng 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #! /bin/sh
  2. #
  3. # Preserve the random seed between reboots. See urandom(4).
  4. #
  5. # This script can be called multiple times during operation (e.g. with
  6. # "reload" argument) to refresh the seed.
  7. # The following arguments can be added to SEEDRNG_ARGS in
  8. # /etc/default/seedrng:
  9. # --seed-dir=/path/to/seed/directory
  10. # Path to the directory where the seed and the lock files are stored.
  11. # for optimal operation, this should be a persistent, writeable
  12. # location. Default is /var/lib/seedrng
  13. #
  14. # --skip-credit
  15. # Set this to true only if you do not want seed files to actually
  16. # credit the RNG, for example if you plan to replicate this file
  17. # system image and do not have the wherewithal to first delete the
  18. # contents of /var/lib/seedrng.
  19. #
  20. # Example:
  21. # SEEDRNG_ARGS="--seed-dir=/data/seedrng --skip-credit"
  22. #
  23. DAEMON="seedrng"
  24. SEEDRNG_ARGS=""
  25. # shellcheck source=/dev/null
  26. [ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
  27. case "$1" in
  28. start|stop|restart|reload)
  29. # Never fail, as this isn't worth making a fuss
  30. # over if it doesn't go as planned.
  31. # shellcheck disable=SC2086 # we need the word splitting
  32. seedrng $SEEDRNG_ARGS || true;;
  33. *)
  34. echo "Usage: $0 {start|stop|restart|reload}"
  35. exit 1
  36. esac