From patchwork Mon Nov 11 15:05:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grzegorz Blach X-Patchwork-Id: 1192972 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=blach.pl Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47BZ8Z0JjYz9sPc for ; Tue, 12 Nov 2019 02:11:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8AAE41FFFE; Mon, 11 Nov 2019 15:11:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OKYNMarRUhsZ; Mon, 11 Nov 2019 15:11:23 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 1F25D2000A; Mon, 11 Nov 2019 15:11:23 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id A38241BF3D9 for ; Mon, 11 Nov 2019 15:11:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A0C4786BDC for ; Mon, 11 Nov 2019 15:11:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6kDBy55sfqj2 for ; Mon, 11 Nov 2019 15:11:20 +0000 (UTC) X-Greylist: delayed 00:05:28 by SQLgrey-1.7.6 Received: from 14.mo4.mail-out.ovh.net (14.mo4.mail-out.ovh.net [46.105.40.29]) by whitealder.osuosl.org (Postfix) with ESMTPS id 4854F8462F for ; Mon, 11 Nov 2019 15:11:20 +0000 (UTC) Received: from player770.ha.ovh.net (unknown [10.108.35.95]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 6E83C2111F3 for ; Mon, 11 Nov 2019 16:05:49 +0100 (CET) Received: from blach.pl (adlh130.neoplus.adsl.tpnet.pl [79.185.11.130]) (Authenticated sender: grzegorz@blach.pl) by player770.ha.ovh.net (Postfix) with ESMTPSA id 9BC46BFA18C9; Mon, 11 Nov 2019 15:05:46 +0000 (UTC) From: Grzegorz Blach To: buildroot@buildroot.org Date: Mon, 11 Nov 2019 15:05:34 +0000 Message-Id: <20191111150534.1181-1-grzegorz@blach.pl> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 X-Ovh-Tracer-Id: 8704332184048262814 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedruddvjedgjeehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdqfffguegfifdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepifhriigvghhorhiiuceulhgrtghhuceoghhriigvghhorhiisegslhgrtghhrdhplheqnecukfhppedtrddtrddtrddtpdejledrudekhedruddurddufedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejjedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepghhriigvghhorhiisegslhgrtghhrdhplhdprhgtphhtthhopegsuhhilhgurhhoohhtsegsuhhilhgurhhoohhtrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd Subject: [Buildroot] [PATCH 1/1] package/pigpio: add sysv and systemd init scripts X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Grzegorz Blach Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Grzegorz Blach --- package/pigpio/S50pigpio | 40 +++++++++++++++++++++++++++++++++++ package/pigpio/pigpio.mk | 13 ++++++++++++ package/pigpio/pigpio.service | 10 +++++++++ 3 files changed, 63 insertions(+) create mode 100644 package/pigpio/S50pigpio create mode 100644 package/pigpio/pigpio.service diff --git a/package/pigpio/S50pigpio b/package/pigpio/S50pigpio new file mode 100644 index 0000000000..7b2e979600 --- /dev/null +++ b/package/pigpio/S50pigpio @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Starts pigpio daemon. +# + +# Allow a few customizations from a config file +test -r /etc/default/pigpio && . /etc/default/pigpio + +start() { + printf "Starting pigpio daemon: " + umask 077 + pigpiod $PIGPIOD_ARGS + [ $? = 0 ] && echo "OK" || echo "FAIL" +} +stop() { + printf "Stopping pigpio daemon: " + start-stop-daemon -K -q -p /var/run/pigpio.pid + [ $? = 0 ] && echo "OK" || echo "FAIL" +} +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? diff --git a/package/pigpio/pigpio.mk b/package/pigpio/pigpio.mk index 1cf8f50afc..e8c37621d9 100644 --- a/package/pigpio/pigpio.mk +++ b/package/pigpio/pigpio.mk @@ -38,4 +38,17 @@ define PIGPIO_INSTALL_STAGING_CMDS ln -sf libpigpiod_if2.so.1 $(STAGING_DIR)/usr/lib/libpigpiod_if2.so endef +define PIGPIO_INSTALL_INIT_SYSV + $(INSTALL) -D -m 755 package/pigpio/S50pigpio \ + $(TARGET_DIR)/etc/init.d/S50pigpio +endef + +define PIGPIO_INSTALL_INIT_SYSTEMD + $(INSTALL) -D -m 644 package/pigpio/pigpio.service \ + $(TARGET_DIR)/usr/lib/systemd/system/pigpio.service + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + ln -fs ../../../../usr/lib/systemd/system/pigpio.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/pigpio.service +endef + $(eval $(generic-package)) diff --git a/package/pigpio/pigpio.service b/package/pigpio/pigpio.service new file mode 100644 index 0000000000..135624cc43 --- /dev/null +++ b/package/pigpio/pigpio.service @@ -0,0 +1,10 @@ +[Unit] +Description=Pigpio daemon +After=network.target + +[Service] +EnvironmentFile=-/etc/default/pigpio +ExecStart=/usr/bin/pigpiod -g $PIGPIOD_ARGS + +[Install] +WantedBy=multi-user.target