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