From dc445cc2424647edda73e7d4e41a0d69421f6913 Mon Sep 17 00:00:00 2001 From: Stefan Hellermann Date: Wed, 9 Nov 2016 18:41:13 +0100 Subject: [PATCH] rng-tools: Fixup Makefile and initscript - typo in path of uci-defaults scripts - fix init script when there is no rngd config - convert init script to procd Signed-off-by: Stefan Hellermann --- utils/rng-tools/Makefile | 6 +++--- utils/rng-tools/files/rngd.init | 30 ++++++++++++++++-------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/utils/rng-tools/Makefile b/utils/rng-tools/Makefile index 0aad15b52..d69832759 100644 --- a/utils/rng-tools/Makefile +++ b/utils/rng-tools/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rng-tools PKG_VERSION:=5 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/gkernel/rng-tools/$(PKG_VERSION)/ @@ -52,8 +52,8 @@ CONFIGURE_ARGS += \ define Package/rng-tools/install $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/rngd.init $(1)/etc/init.d/rngd - $(INSTALL_DIR) $(1)/etc/uci_defaults - $(INSTALL_BIN) ./files/rngd.uci_defaults $(1)/etc/uci_defaults/rngd + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/rngd.uci_defaults $(1)/etc/uci-defaults/rngd $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/rngtest $(1)/usr/bin/ $(INSTALL_DIR) $(1)/sbin diff --git a/utils/rng-tools/files/rngd.init b/utils/rng-tools/files/rngd.init index e18288e53..c9cead3bc 100644 --- a/utils/rng-tools/files/rngd.init +++ b/utils/rng-tools/files/rngd.init @@ -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 }