From patchwork Sun Aug 4 12:14:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1141727 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Yx8KIeb+"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 461fw707Gvz9sMr for ; Sun, 4 Aug 2019 22:14:30 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7DB5387A4D; Sun, 4 Aug 2019 12:14:29 +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 7cIYSjYsrkbY; Sun, 4 Aug 2019 12:14:28 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id B390D878ED; Sun, 4 Aug 2019 12:14:28 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 994CD1BF417 for ; Sun, 4 Aug 2019 12:14:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 96502203C0 for ; Sun, 4 Aug 2019 12:14:23 +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 hCkG+zu5Z8Bq for ; Sun, 4 Aug 2019 12:14:22 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by silver.osuosl.org (Postfix) with ESMTPS id 881AD203AC for ; Sun, 4 Aug 2019 12:14:22 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id p13so7083666wru.10 for ; Sun, 04 Aug 2019 05:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UTMx2i7kn61eK+5YxtS1fly71U84kZZHNk0vkk9f2nM=; b=Yx8KIeb+gQeb+9bsEwdnDw8RDMMMZl8Rg35yL7LqJ2zgk6+x9C+AwACxDK+bfPkmTW ZxJvrkndP5G0fy61epIW6hoRdq6+qlvIyIBN709mkvYC1WSr8a76pcmzEGtUsqamlGXD sK0x/IVjeLWNervX7QMfhaCGdX7iGiVrAnetgAsUHMpC9GQDismJBI+SI2xEa1vJH4GY jVD6qCDrkiWHEG2jlLpr4WEUmV97pDUrYtiI4fbPpxud3lqAT9fTWBq5xeV6B3j4+RHI jFDOIIvCctXu8bgmyh6nbP/h3cn+5sPRrJUTNJgtvbeDDJ5xeVIwprNvErk8HyVE+kdj Eysg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=UTMx2i7kn61eK+5YxtS1fly71U84kZZHNk0vkk9f2nM=; b=CT1+wstOqeoJBp1EKYgB3S32oLGlkgxJlDc9T5rohEykzARk/0VqrrgKsFIPht2zec eurChdvoLYroksX7lt0/V4rXn0+Plwu3AGE/7P1r9UrAjMhzJkVBH8FFRGAlRFiLftH7 u/aVUsA1aN5hFIoCTRwAIktJJBbMpL9jE+gyz4eB9hEAI0c+9H9rS1aO7dGEYf73iQMi m2ZbXexWTJ1sfCwoW4Wa4v/zccG0eBrBVCioGe8w+v9VxpQycqxspw0Nmba8sEEHnW7i 32j6lxSYG3RuxCWzIm7s2XiekxNJ/uPTHXYJQ2fLWK3DCmk25yWYtoCyE6mI1VVoXpcF qVPg== X-Gm-Message-State: APjAAAXTK9SrHimkx9LASbrRiDYWX/hrB3BG5PvIBxlhdFLdfumraXBH +hoPIcbS38+ou7gEe3Ftq+p0voqz X-Google-Smtp-Source: APXvYqwSq990LZkiHTfFoEdKV08MYeSdiHCKIqRiInS2FPl9Fr6/6TO6SJWwYqqH0ERyHPEMIQE9bA== X-Received: by 2002:adf:eacf:: with SMTP id o15mr36125034wrn.171.1564920860856; Sun, 04 Aug 2019 05:14:20 -0700 (PDT) Received: from scaer.home (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id u1sm76939800wml.14.2019.08.04.05.14.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 04 Aug 2019 05:14:20 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 4 Aug 2019 14:14:15 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/5 v3] package/skeleton-init-openrc: add support for starting sysv 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: "Yann E . MORIN" , =?utf-8?b?TWljaGHFgiDFgXlz?= =?utf-8?q?zczek?= Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Michał Łyszczek Add an OpenRC service that starts and stops sysv-init scripts. We order that scrpt 'after local' so that it is started after all other native openrc services. Signed-off-by: Michał Łyszczek [yann.morin.1998@free.fr: - don't propagate the micro optimisation for running .sh scripts - use spaces, not TABs - stop services in reverse order - reword commit log ] Signed-off-by: Yann E. MORIN --- docs/manual/adding-packages-generic.txt | 5 +++- package/openrc/sysv-rcs | 25 +++++++++++++++++++ package/pkg-generic.mk | 3 ++- .../skeleton/etc/runlevels/default/sysv-rcs | 1 + 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 package/openrc/sysv-rcs create mode 120000 package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs diff --git a/docs/manual/adding-packages-generic.txt b/docs/manual/adding-packages-generic.txt index 5ac07a81b4..b402767b05 100644 --- a/docs/manual/adding-packages-generic.txt +++ b/docs/manual/adding-packages-generic.txt @@ -542,7 +542,10 @@ different steps of the build process. sysvinit, etc.), openrc or for the systemd units. These commands will be run only when the relevant init system is installed (i.e. if systemd is selected as the init system in the configuration, - only +LIBFOO_INSTALL_INIT_SYSTEMD+ will be run). + only +LIBFOO_INSTALL_INIT_SYSTEMD+ will be run). The only exception + is when openrc is chosen as init system and +LIBFOO_INSTALL_INIT_OPENRC+ + has not been set, in such situation +LIBFOO_INSTALL_INIT_SYSV+ will + be called, since openrc supports sysv init scripts. * +LIBFOO_HELP_CMDS+ lists the actions to print the package help, which is included to the main +make help+ output. These commands can print diff --git a/package/openrc/sysv-rcs b/package/openrc/sysv-rcs new file mode 100755 index 0000000000..606a73d2b4 --- /dev/null +++ b/package/openrc/sysv-rcs @@ -0,0 +1,25 @@ +#!/sbin/openrc-run + +description="start or stop sysv rc[S,K] scripts" + +depend() { + after local +} + +start() { + einfo "Starting sysv rc scripts" + for i in /etc/init.d/S??*; do + # Ignore dangling symlinks (if any). + [ -e "$i" ] || continue + $i start + done +} + +stop() { + einfo "Stopping sysv rc scripts" + for i in $(ls -r /etc/init.d/S??*); do + # Ignore dangling symlinks (if any). + [ -e "$i" ] || continue + $i stop + done +} diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 9620dec524..1f24b52a69 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -338,7 +338,8 @@ $(BUILD_DIR)/%/.stamp_target_installed: $(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\ $($(PKG)_INSTALL_INIT_SYSV)) $(if $(BR2_INIT_OPENRC), \ - $($(PKG)_INSTALL_INIT_OPENRC)) + $(or $($(PKG)_INSTALL_INIT_OPENRC), \ + $($(PKG)_INSTALL_INIT_SYSV))) $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep)) $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \ $(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \ diff --git a/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs new file mode 120000 index 0000000000..ef5e00823c --- /dev/null +++ b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs @@ -0,0 +1 @@ +/etc/init.d/sysv-rcs \ No newline at end of file