From patchwork Tue Oct 13 10:26:40 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: 529670 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 97B361402B7 for ; Tue, 13 Oct 2015 21:27:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D73C789354; Tue, 13 Oct 2015 10:27:02 +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 Ekk6azo8nC4x; Tue, 13 Oct 2015 10:27:02 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 4B3489307D; Tue, 13 Oct 2015 10:27:02 +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 C73481C0FE9 for ; Tue, 13 Oct 2015 10:27:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id F29E289354 for ; Tue, 13 Oct 2015 10:26:50 +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 IkqlHT1X8oe5 for ; Tue, 13 Oct 2015 10:26:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from authsmtp.register.it (authsmtp70.register.it [195.110.101.54]) by hemlock.osuosl.org (Postfix) with ESMTP id BE6AE89341 for ; Tue, 13 Oct 2015 10:26:49 +0000 (UTC) Received: from rad-ubuntu.home ([90.49.67.218]) by paganini31 with id UaSk1r01F4iYwqa01aSnHL; Tue, 13 Oct 2015 12:26:48 +0200 X-Rid: benoit@wsystem.com@90.49.67.218 From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= To: buildroot@buildroot.org Date: Tue, 13 Oct 2015 12:26:40 +0200 Message-Id: <1444732000-48622-1-git-send-email-benoit@wsystem.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1440086344-100325-1-git-send-email-benoit@wsystem.com> References: <1440086344-100325-1-git-send-email-benoit@wsystem.com> MIME-Version: 1.0 Cc: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Subject: [Buildroot] [PATCH v2] 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 --- Changes v1 -> v2: - Use 'printf' instead of 'echo -n' following 0f75b2635ee564fbbdb9ea631cf39fa8731d6d6c. --- 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..3cdbc38 --- /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() +{ + printf "Starting ${NAME}: " + start-stop-daemon -S -q -x "${DAEMON}" -- ${DAEMON_ARGS} && + echo "done" || echo "failed" +} + +stop() +{ + printf "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 7e975e0..cc07bdf 100644 --- a/package/rng-tools/rng-tools.mk +++ b/package/rng-tools/rng-tools.mk @@ -22,6 +22,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