|
|
@ -3,22 +3,24 @@ |
|
|
|
|
|
|
|
START=98 |
|
|
|
|
|
|
|
RNGD_FILLWATER=$(uci -q get system.@rngd[0].fill_watermark) |
|
|
|
RNGD_DEVICE=$(uci -q get system.@rngd[0].device) |
|
|
|
RNGD_ENABLED=$(uci -q get system.@rngd[0].enabled) |
|
|
|
RNGD_PRECMD=$(uci -q get system.@rngd[0].precmd) |
|
|
|
USE_PROCD=1 |
|
|
|
PROG=/sbin/rngd |
|
|
|
|
|
|
|
: ${RNGD_FILLWATER:=4000} |
|
|
|
start_service() { |
|
|
|
local enabled=$(uci -q get system.@rngd[0].enabled) |
|
|
|
local precmd=$(uci -q get system.@rngd[0].precmd) |
|
|
|
local device=$(uci -q get system.@rngd[0].device) |
|
|
|
local watermark=$(uci -q get system.@rngd[0].fill_watermark) |
|
|
|
|
|
|
|
echo PRECMD=\'$RNGD_PRECMD\' |
|
|
|
[ "$enabled" = "1" ] || return |
|
|
|
|
|
|
|
start() { |
|
|
|
[ 1 -eq "$RNGD_ENABLED" ] && { |
|
|
|
[ -z "${RNGD_PRECMD}" ] || ${RNGD_PRECMD} ${RNGD_DEVICE} |
|
|
|
service_start /sbin/rngd -r ${RNGD_DEVICE} -W ${RNGD_FILLWATER} |
|
|
|
} |
|
|
|
} |
|
|
|
[ -z "$precmd" ] || ${precmd} ${device} |
|
|
|
|
|
|
|
[ -z "$device" ] || device="-r ${device}" |
|
|
|
[ -z "$watermark" ] || watermark="-W ${watermark}" |
|
|
|
|
|
|
|
stop() { |
|
|
|
service_stop /sbin/rngd |
|
|
|
procd_open_instance |
|
|
|
procd_set_param command "$PROG" -f ${device} ${watermark} |
|
|
|
procd_set_param stderr 1 |
|
|
|
procd_close_instance |
|
|
|
} |