From patchwork Thu Aug 20 15:59:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau?= X-Patchwork-Id: 509087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id D45FC1402AC for ; Fri, 21 Aug 2015 01:59:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2BC61A1BD2; Thu, 20 Aug 2015 15:59:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pzkNUA2pnwZ0; Thu, 20 Aug 2015 15:59:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 44EEFA1AE8; Thu, 20 Aug 2015 15:59:16 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 441781BF974 for ; Thu, 20 Aug 2015 15:59:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 415D195F82 for ; Thu, 20 Aug 2015 15:59:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id peAM+pCUKfNZ for ; Thu, 20 Aug 2015 15:59:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from authsmtp.register.it (authsmtp71.register.it [195.110.101.55]) by hemlock.osuosl.org (Postfix) with ESMTP id 6BB3D95F81 for ; Thu, 20 Aug 2015 15:59:12 +0000 (UTC) Received: from localhost.localdomain ([88.172.188.148]) by paganini33 with id 73z71r0173CYkgw013zAow; Thu, 20 Aug 2015 17:59:11 +0200 X-Rid: benoit@wsystem.com@88.172.188.148 From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= To: buildroot@buildroot.org Date: Thu, 20 Aug 2015 17:59:04 +0200 Message-Id: <1440086344-100325-1-git-send-email-benoit@wsystem.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Cc: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Subject: [Buildroot] [PATCH 1/1] package/rng-tools: add SysV init script X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Benoît Thébaudeau --- package/rng-tools/S21rngd | 48 ++++++++++++++++++++++++++++++++++++++++++ package/rng-tools/rng-tools.mk | 5 +++++ 2 files changed, 53 insertions(+) create mode 100755 package/rng-tools/S21rngd diff --git a/package/rng-tools/S21rngd b/package/rng-tools/S21rngd new file mode 100755 index 0000000..09e23c0 --- /dev/null +++ b/package/rng-tools/S21rngd @@ -0,0 +1,48 @@ +#!/bin/sh + +NAME="rngd" +DAEMON="/usr/sbin/${NAME}" +DAEMON_ARGS="" +CFG_FILE="/etc/default/${NAME}" +PID_FILE="/var/run/${NAME}.pid" + +# Read configuration variable file if it is present +[ -r "${CFG_FILE}" ] && . "${CFG_FILE}" + +start() +{ + echo -n "Starting ${NAME}: " + start-stop-daemon -S -q -x "${DAEMON}" -- ${DAEMON_ARGS} && + echo "done" || echo "failed" +} + +stop() +{ + echo -n "Stopping ${NAME}: " + # This daemon does not exit properly with the default TERM signal unless + # it's forced to work by something reading /dev/random. Killing it and + # removing its PID file is more straightforward. + if start-stop-daemon -K -q -s KILL -p "${PID_FILE}" -n "${NAME}"; then + rm -f "${PID_FILE}" + echo "done" + else + echo "failed" + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart|reload}" >&2 + exit 1 + ;; +esac diff --git a/package/rng-tools/rng-tools.mk b/package/rng-tools/rng-tools.mk index 8648c4f..fc656ef 100644 --- a/package/rng-tools/rng-tools.mk +++ b/package/rng-tools/rng-tools.mk @@ -21,6 +21,11 @@ else RNG_TOOLS_CONF_OPTS += --without-libgcrypt endif +define RNG_TOOLS_INSTALL_INIT_SYSV + $(INSTALL) -D -m 755 package/rng-tools/S21rngd \ + $(TARGET_DIR)/etc/init.d/S21rngd +endef + define RNG_TOOLS_INSTALL_INIT_SYSTEMD $(INSTALL) -D -m 644 package/rng-tools/rngd.service \ $(TARGET_DIR)/usr/lib/systemd/system/rngd.service