rngd.init 640 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2011-2014 OpenWrt.org
  3. START=25
  4. USE_PROCD=1
  5. PROG=/sbin/rngd
  6. start_service() {
  7. local enabled=$(uci -q get system.@rngd[0].enabled)
  8. local precmd=$(uci -q get system.@rngd[0].precmd)
  9. local device=$(uci -q get system.@rngd[0].device)
  10. local watermark=$(uci -q get system.@rngd[0].fill_watermark)
  11. [ "$enabled" = "1" ] || return
  12. [ -z "$precmd" ] || ${precmd} ${device}
  13. [ -z "$device" ] || device="-r ${device}"
  14. [ -z "$watermark" ] || watermark="-W ${watermark}"
  15. procd_open_instance
  16. procd_set_param command "$PROG" -f ${device} ${watermark}
  17. procd_set_param stderr 1
  18. procd_close_instance
  19. }