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 From patchwork Sun Aug 4 12:14:16 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: 1141728 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="HBCHnulx"; 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 461fwD5YwSz9sMr for ; Sun, 4 Aug 2019 22:14:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D24BF8776C; Sun, 4 Aug 2019 12:14:31 +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 L41Kki5K9587; Sun, 4 Aug 2019 12:14:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 921BD87A4F; Sun, 4 Aug 2019 12:14:29 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 57D4B1BF417 for ; Sun, 4 Aug 2019 12:14:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5104D8598E for ; Sun, 4 Aug 2019 12:14:25 +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 EUmpTEqQJJf3 for ; Sun, 4 Aug 2019 12:14:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 6525F858B8 for ; Sun, 4 Aug 2019 12:14:23 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id n9so81765212wru.0 for ; Sun, 04 Aug 2019 05:14:23 -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=eY89aFOUsT2zo4zMxSfjwKsRRnkoJ1ObJYVUGj1xm6Q=; b=HBCHnulx4wY2pkMwup6ICgNr7GLNPXFhEuSD4YYT2+5Xs/SUdeDXya/6n1EDW1GezQ 5qkfyHPnQoFScE4tDobGaME+seXLEVVcUizkC0lCUjO3WN/1HFxruCrfk15bdJgiunds wFtFK0YEbbAoHMvoU8btzHh5qisUOOXwnj/vWBwhWPaClzodiA+3rtsMX0r2VytU7Fxu wCfau9+X2pa7YrEt12VhaHU3br8ra2jEYj1PfDqEYq/Uy5oN1V0loZjWKY9wvTqzbjVI 6wNjDRmjdLEWAsDLz7OUIVPUlHL9eyD+CWoax4tue0/0Zclt/v6dhcLMKEuncBJi56C+ XqTQ== 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=eY89aFOUsT2zo4zMxSfjwKsRRnkoJ1ObJYVUGj1xm6Q=; b=AgeriN+8sAyBKFaaAIMxdSQIg7gEFjfIWaKddcFID1UnTNzB9h7HUMfSi46qdHs/rk VjlkWqQgYTzLIzrhd/O4YnDFk0EjPD2Hyl21oIN5cRUjzg/sULMQLZCKvqOvJxJRrvVY K32GQXehgdzKBKcxSHmg0BsnHroXp96p3Qy3swmiMRtw9NA0Ag8phcqwrfehT5TlzQ7X rZBFYuzlJ9u1tEM3qWzVi1qvtZyMQalqdgqGijQuP5TnlAQei7YgQgowWsCI8lmv8Jlj 9SYhiSI765TXAcH7EExosiPqIpTxulwd/CMYc3bxBTGGuOarT6qJucb5bLA6JVUL0kfh dkvQ== X-Gm-Message-State: APjAAAVDbxqsL4QMA/uNTNIFReTzK7sIyh5zCMfEidZuwhILbejw07ek 9uICNSrPusg36W1pUH9zM8QVYwPt X-Google-Smtp-Source: APXvYqxdqz88dBEsbsLZ9DP5SsG9/KnA331RWN09x+eReRvlCjSan+dzuE1DoPgRN6Lq8PnRvq8Sdg== X-Received: by 2002:a05:6000:187:: with SMTP id p7mr31986047wrx.189.1564920861745; Sun, 04 Aug 2019 05:14:21 -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:21 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 4 Aug 2019 14:14:16 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/5 v3] package/skeleton-init-openrc: add support to remount rootfs as rw 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 a pseudo entry for /dev/root in fstab, to tell openrc to prperly remount or not remount / read-write. For consistency with systemd (which is the only other init system to tweak an fstab basd on / being rw or not), we do this change in the openrc skeleton rahter than in the openrc package. Signed-off-by: Michał Łyszczek [yann.morin.1998@free.fr: - tweak the sed expressions - reword commit log ] Signed-off-by: Yann E. MORIN --- .../skeleton-init-openrc/skeleton-init-openrc.mk | 15 +++++++++++++++ package/skeleton-init-openrc/skeleton/etc/fstab | 1 + 2 files changed, 16 insertions(+) diff --git a/package/skeleton-init-openrc/skeleton-init-openrc.mk b/package/skeleton-init-openrc/skeleton-init-openrc.mk index 5ee2192093..656fc531d7 100644 --- a/package/skeleton-init-openrc/skeleton-init-openrc.mk +++ b/package/skeleton-init-openrc/skeleton-init-openrc.mk @@ -15,8 +15,23 @@ SKELETON_INIT_OPENRC_DEPENDENCIES = skeleton-init-common SKELETON_INIT_OPENRC_PROVIDES = skeleton +ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y) +# Comment /dev/root entry in fstab. When openrc does not find fstab entry for +# "/", it will try to remount "/" as "rw". +define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW + $(SED) '\:^/dev/root :s/^/# /' $(TARGET_DIR)/etc/fstab +endef +else +# Uncomment /dev/root entry in fstab which has "ro" option so openrc notices +# it and doesn't remount root to rw. +define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW + $(SED) '\:^# /dev/root:s/^# //' $(TARGET_DIR)/etc/fstab +endef +endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW + define SKELETON_INIT_OPENRC_INSTALL_TARGET_CMDS $(call SYSTEM_RSYNC,$(SKELETON_INIT_OPENRC_PKGDIR)/skeleton,$(TARGET_DIR)) + $(SKELETON_INIT_OPENRC_ROOT_RO_OR_RW) endef $(eval $(generic-package)) diff --git a/package/skeleton-init-openrc/skeleton/etc/fstab b/package/skeleton-init-openrc/skeleton/etc/fstab index 3ec96cf634..21cf49ba5a 100644 --- a/package/skeleton-init-openrc/skeleton/etc/fstab +++ b/package/skeleton-init-openrc/skeleton/etc/fstab @@ -1,3 +1,4 @@ # +/dev/root / ext2 ro,noauto 0 0 tmpfs /tmp tmpfs mode=1777 0 0 tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0 From patchwork Sun Aug 4 12:14:17 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: 1141731 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.136; helo=silver.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="J5BFxH4Z"; dkim-atps=neutral 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 461fwW22Qtz9sNy for ; Sun, 4 Aug 2019 22:14:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3281420406; Sun, 4 Aug 2019 12:14:49 +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 lj2Xngi6nEk1; Sun, 4 Aug 2019 12:14:38 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 88BB62040E; Sun, 4 Aug 2019 12:14:33 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 847721BF868 for ; Sun, 4 Aug 2019 12:14:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 52A6E85A00 for ; Sun, 4 Aug 2019 12:14:27 +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 b2PMA3oWhj1M for ; Sun, 4 Aug 2019 12:14:25 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 617368592F for ; Sun, 4 Aug 2019 12:14:24 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id s3so72218668wms.2 for ; Sun, 04 Aug 2019 05:14:24 -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=3LnQFv15PWxSEJq1cXPvIBh6TdyOly9kZccOpsn/gAE=; b=J5BFxH4ZZlBmRbf61u2Ll+7iRo1aIDktXsFpf3K39mWi1gn5Y7VCBZHlNbu57QJbPj yG6NFp326Cos8dMShTop661HUNqpdTI3rD2u9JfJl98etPbjso2xCxzi8CM5uL0sC+P6 O5sb9cGK5DX6N8ZSpVKIsOLWMBHXAYJ/1XcmZcS7eTh3ihGFFHuTIbQwc7I9tYMxUs9O t5xTRNqekFEEKWIypPANrvr5UbH2R6TFAcAzgeGakbEMw3Tu2F7ouy7eLGz8yjnR2NuS RoKW4PL/9wEzwMMRVxfkYnmHy1aN87GL2ibFKQUQlohLVU1H4LF8fXgbV7lCmgLtG7w2 JH+Q== 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=3LnQFv15PWxSEJq1cXPvIBh6TdyOly9kZccOpsn/gAE=; b=gpWqNUpyDXR50UI7WSJbRibaj5sUAtDNdMUcQeB3+U7dinKoyMcq0e5yx7qPYTAi3b gVpXZz2LXxUsxNYHRKBMSFgUUvAk+POqVZgOV+bdfwHLheDlXqHTeblAA0F6k1l7Cxor Pw7ccffU79lCzNJRsFmwGuFoNVhg0W6TYUs9DET4sh9tDJKrv8shty9xE1sz5oDq7kJz +U1o9yUPNosEmRlCt47LeeNFsTlJv1QKpHyJ3LDLuvjuai3nYTxipnG+/B+kXmVj2GyB //NU/HGArTDLhIopYpsWAE/hMC02cBxfCymyImvsNyQFWhKjO1h9Vo9GNPRbm9Proq2b Wcbw== X-Gm-Message-State: APjAAAWrfUNdZ2GhZoK1KycCkqmxmJRuvbevbNnI6chWBNhjOOb8PoPr 4bkaGiVgjdoMy+fAeKMINXQSJ8lg X-Google-Smtp-Source: APXvYqyidrocHDgJrULVI2NCYcWjC5yK43lYiC8ZlakDa/hIMNBulgmax2aIfZ1QvLJjWkoketrjNQ== X-Received: by 2002:a1c:3142:: with SMTP id x63mr13966467wmx.169.1564920862628; Sun, 04 Aug 2019 05:14:22 -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.21 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 04 Aug 2019 05:14:22 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 4 Aug 2019 14:14:17 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 3/5 v3] package/openrc: add support for spawning getty 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: Thomas Petazzoni , "Yann E . MORIN" , =?utf-8?b?TWljaGHFgiDFgXlzemN6ZWs=?= Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Michał Łyszczek We install a template getty service, and we 'instanciate' it in the default runlevel, using the configured tty. Ideally, packages that provide a getty program would be responsible for installing the corresponding service file. However, to keep consistency with the existing init systems (busybox, systemd, and sysv), we do do provide it from the openrc package itself. OpenrRC only acts on the files in a runlevel sub-directory, but the documentation [0] actually suggests that the instance symlink be done in init.d, and then again symlinked into the actual runlevel sub-directory. So, we abide by the rules. Also, to be noted, the getty service file is installed without ensuring that a getty command is available. This again is not unlike other init systems, sysvinit and busybox, which behave the same. [0] https://wiki.gentoo.org/wiki/OpenRC Signed-off-by: Michał Łyszczek [yann.morin.1998@free.fr: - move getty template to openrc package (Thomas) - fix namespace of the vaiables (Thomas) - simplify creation of the defaults file - rewrite commit log ] Signed-off-by: Yann E. MORIN Cc: Thomas Petazzoni --- package/openrc/getty | 24 +++++++++++++++++++ package/openrc/openrc.mk | 18 ++++++++++++++ .../skeleton/etc/conf.d/.empty | 0 .../skeleton/etc/runlevels/default/.empty | 0 system/Config.in | 8 +++---- 5 files changed, 46 insertions(+), 4 deletions(-) create mode 100755 package/openrc/getty create mode 100644 package/skeleton-init-openrc/skeleton/etc/conf.d/.empty create mode 100644 package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty diff --git a/package/openrc/getty b/package/openrc/getty new file mode 100755 index 0000000000..8fcb071f8a --- /dev/null +++ b/package/openrc/getty @@ -0,0 +1,24 @@ +#!/sbin/openrc-run +# based on agetty service from OpenRC package + +description="start getty on terminal" +supervisor=supervise-daemon +port="${RC_SVCNAME#*.}" +term_type="${term_type:-linux}" +command=/sbin/getty +command_args_foreground="${getty_options} ${baud} ${port} ${term_type}" +pidfile="/run/${RC_SVCNAME}.pid" + +depend() { + # start getty at the very end of init + after * + keyword -prefix +} + +start_pre() { + export EINFO_QUIET="${quiet:-yes}" +} + +stop_pre() { + export EINFO_QUIET="${quiet:-yes}" +} diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk index 53f2947dcc..5978b6de5d 100644 --- a/package/openrc/openrc.mk +++ b/package/openrc/openrc.mk @@ -42,4 +42,22 @@ define OPENRC_REMOVE_UNNEEDED endef OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED +ifeq ($(BR2_TARGET_GENERIC_GETTY),y) +OPENRC_GETTY_SVCNAME = getty.$(SYSTEM_GETTY_PORT) +OPENRC_GETTY_CONF_D = $(TARGET_DIR)/etc/conf.d/$(OPENRC_GETTY_SVCNAME) +define OPENRC_SET_GETTY + { \ + echo "baud=\"$(SYSTEM_GETTY_BAUDRATE)\""; \ + echo "term_type=\"$(SYSTEM_GETTY_TERM)\"" ; \ + echo "getty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\""; \ + } > $(OPENRC_GETTY_CONF_D) + $(INSTALL) -D -m 0755 $(OPENRC_PKGDIR)/getty \ + $(TARGET_DIR)/etc/init.d/getty + ln -sf getty $(TARGET_DIR)/etc/init.d/$(OPENRC_GETTY_SVCNAME) + ln -sf /etc/init.d/$(OPENRC_GETTY_SVCNAME) \ + $(TARGET_DIR)/etc/runlevels/default/$(OPENRC_GETTY_SVCNAME) +endef +OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_SET_GETTY +endif # BR2_TARGET_GENERIC_GETTY + $(eval $(generic-package)) diff --git a/package/skeleton-init-openrc/skeleton/etc/conf.d/.empty b/package/skeleton-init-openrc/skeleton/etc/conf.d/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system/Config.in b/system/Config.in index af7d8566d3..1bfe069b2e 100644 --- a/system/Config.in +++ b/system/Config.in @@ -348,16 +348,16 @@ config BR2_TARGET_GENERIC_GETTY_BAUDRATE config BR2_TARGET_GENERIC_GETTY_TERM string "TERM environment variable" default "vt100" - # currently observed only by busybox and sysvinit - depends on BR2_INIT_BUSYBOX || BR2_INIT_SYSV + # currently observed by all but systemd + depends on !BR2_INIT_SYSTEMD help Specify a TERM type. config BR2_TARGET_GENERIC_GETTY_OPTIONS string "other options to pass to getty" default "" - # currently observed only by busybox and sysvinit - depends on BR2_INIT_BUSYBOX || BR2_INIT_SYSV + # currently observed by all but systemd + depends on !BR2_INIT_SYSTEMD help Any other flags you want to pass to getty, Refer to getty --help for details. From patchwork Sun Aug 4 12:14:18 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: 1141729 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="lgN6IMrP"; 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 461fwF1fklz9sNy for ; Sun, 4 Aug 2019 22:14:37 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5ACE1879C3; Sun, 4 Aug 2019 12:14:32 +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 qTMIm309c-wo; Sun, 4 Aug 2019 12:14:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 7DD9487B05; Sun, 4 Aug 2019 12:14:31 +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 9120C1BF417 for ; Sun, 4 Aug 2019 12:14:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8DDFC87938 for ; Sun, 4 Aug 2019 12:14:26 +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 TD5bjN2koUfN for ; Sun, 4 Aug 2019 12:14:25 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by hemlock.osuosl.org (Postfix) with ESMTPS id 747FA8776C for ; Sun, 4 Aug 2019 12:14:25 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id w9so4719572wmd.1 for ; Sun, 04 Aug 2019 05:14:25 -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=d+sH24ha5DzKXmxHuIodOpax1KQ1bagmMXFy5gHZF3Y=; b=lgN6IMrPVW+t7vFW0W9s3JW3MYLwwrhcMjZAqrEU38o8o0blA7LVcFimdxqJvoDngO UtSohAF6BdeaiYwa6F2KaNWW0p2VhcGgyRKd09LFgO56ypkZQPvQZJFo23qmKSSz1VKB xZfEJh737MwyH2WHkhc43XIpHDqxZKZ9qFL6gKfYUlqAaGtblh0gJ7aWmFloUx/wVsvw 7FuSZzccHlhq5fIDjRs42KGKOxkhFOOqofS3tiUTLuneFEQD4Et0cEK/DbXCGaUSinH8 seMrDFY725qkEbKNMWjdUgDLHmtRwOhULE9841+2Vryh6BDxSUPTcATEZEVp0rEGfpr6 cgcA== 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=d+sH24ha5DzKXmxHuIodOpax1KQ1bagmMXFy5gHZF3Y=; b=V/y6kSql4FqjZ6Smsadk7/uTDA3vXZzUwHootrgG3ndm0DRN8mxqztjK8HeH5YiTV8 fr6rGHOZ4+G/wh53tQpJVkygKsUmwInvp5VxXJORMamJGzWmiXXEKCwHh5BYxEBwq/qe Y8PFsPv7I4yt5Ip3TqVRNMve1B4lz/RL1B4w8hzjrwWkOQdado29TKPlwLlt70NMazIm aryrqSs2kL8PT3xwu2zu0NNqY8yNKdlcFw9WLDUap2nwSBFRpw2CAOkpQAyUZl7YUym0 T/Y6TpUs8ZF63aJXEFLD3OqolY0l19RETZdomv4suxPJ1JYshg0pvxhL0RPFf1+gNcOs 2fXQ== X-Gm-Message-State: APjAAAXcNR8VgTGTjXhopxzLF4Fb7T5z639TZCa0X8r398BuJTdqnUww 5em/MVcLidn+dw5U1PCmXjRLIDha X-Google-Smtp-Source: APXvYqzdwMDGrdV7o/orIKn33q5XMGxL+vSi62dHs+jmfyq9sIx+UDQptgVAn6uXZeNox960JHMs+w== X-Received: by 2002:a1c:b146:: with SMTP id a67mr13556493wmf.124.1564920863688; Sun, 04 Aug 2019 05:14:23 -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.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 04 Aug 2019 05:14:23 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 4 Aug 2019 14:14:18 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 4/5 v3] package/netifrc: new package 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 netifrc entirely replaces openrc's basic network management. As such, it conflicts with the network services installed by openrc, so we remove them from openrc when netifrc is enabled. Currently, we only catter tfor the loopback interface, but we prepare for also handling the DHCP interface, to come in a latter patch. Signed-off-by: Michał Łyszczek [yann.morin.1998@free.fr: - remove openrc files within the openrc package itself - as it's a generic-package, no need to use post-install hooks - use description from the homepage in the help text - check-package fixes - rename package ] Signed-off-by: Yann E. MORIN --- DEVELOPERS | 1 + package/Config.in | 1 + package/netifrc/Config.in | 12 ++++++++++ package/netifrc/netifrc.hash | 3 +++ package/netifrc/netifrc.mk | 45 ++++++++++++++++++++++++++++++++++++ package/openrc/openrc.mk | 11 +++++++++ 6 files changed, 73 insertions(+) create mode 100644 package/netifrc/Config.in create mode 100644 package/netifrc/netifrc.hash create mode 100644 package/netifrc/netifrc.mk diff --git a/DEVELOPERS b/DEVELOPERS index d43a9f2c74..9483a5056a 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1646,6 +1646,7 @@ F: board/altera/socrates_cyclone5/ F: board/pine64/rock64 F: configs/rock64_defconfig F: configs/socrates_cyclone5_defconfig +F: package/netifrc/ F: package/openrc/ F: package/skeleton-init-openrc/ diff --git a/package/Config.in b/package/Config.in index cb0f89ad99..7d271117e3 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2220,6 +2220,7 @@ menu "System tools" source "package/mender-grubenv/Config.in" source "package/monit/Config.in" source "package/ncdu/Config.in" + source "package/netifrc/Config.in" source "package/numactl/Config.in" source "package/nut/Config.in" source "package/openrc/Config.in" diff --git a/package/netifrc/Config.in b/package/netifrc/Config.in new file mode 100644 index 0000000000..9347033d67 --- /dev/null +++ b/package/netifrc/Config.in @@ -0,0 +1,12 @@ +config BR2_PACKAGE_NETIFRC + bool "netifrc" + depends on BR2_PACKAGE_OPENRC + help + netifrc is a collection of modules created to configure and + manage network interfaces via individual, per-interface + scripts. + + https://wiki.gentoo.org/wiki/Netifrc + +comment "netifrc needs openrc as init system" + depends on !BR2_PACKAGE_OPENRC diff --git a/package/netifrc/netifrc.hash b/package/netifrc/netifrc.hash new file mode 100644 index 0000000000..d811acc4a2 --- /dev/null +++ b/package/netifrc/netifrc.hash @@ -0,0 +1,3 @@ +# Calculated manually +sha256 004907e0c3db2d106d6a51d604d79f971f1013fa7642054ad7efe5076e52f7b3 netifrc-0.6.1.tar.gz +sha256 da376c9e2244f2a7220767ea4dd88cf423ff5b548e7c2f96b0f3b9dac727748a LICENSE diff --git a/package/netifrc/netifrc.mk b/package/netifrc/netifrc.mk new file mode 100644 index 0000000000..4b9a0a8d39 --- /dev/null +++ b/package/netifrc/netifrc.mk @@ -0,0 +1,45 @@ +################################################################################ +# +# netifrc +# +################################################################################ + +NETIFRC_VERSION = 0.6.1 +NETIFRC_SITE = $(call github,gentoo,netifrc,$(NETIFRC_VERSION)) +NETIFRC_LICENSE = BSD-2-Clause +NETIFRC_LICENSE_FILES = LICENSE + +NETIFRC_DEPENDENCIES = openrc + +# set LIBNAME so netifrc puts files in proper directories and sets proper +# paths in installed files. Since in buildroot /lib64 and /lib32 always +# points to /lib, it's safe to hardcode it to "lib" +NETIFRC_MAKE_OPTS = \ + LIBNAME=lib \ + LIBEXECDIR=/usr/libexec/netifrc + +define NETIFRC_BUILD_CMDS + $(MAKE) $(NETIFRC_MAKE_OPTS) -C $(@D) +endef + +ifeq ($(BR2_PACKAGE_HAS_UDEV),) +define NETIFRC_REMOVE_UDEV + $(RM) $(TARGET_DIR)/lib/udev/net.sh + $(RM) $(TARGET_DIR)/lib/udev/rules.d/90-network.rules + rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/lib/udev/rules.d + rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/lib/udev +endef +endif # BR2_PACKAGE_HAS_UDEV + +define NETIFRC_NET_CFG + config_lo="127.0.0.1/8" +endef + +define NETIFRC_INSTALL_TARGET_CMDS + $(MAKE) $(NETIFRC_MAKE_OPTS) DESTDIR=$(TARGET_DIR) -C $(@D) install + $(NETIFRC_REMOVE_UDEV) + $(call PRINTF,$(NETIFRC_NET_CFG)) > $(TARGET_DIR)/etc/conf.d/net + ln -sf /etc/init.d/net.lo $(TARGET_DIR)/etc/runlevels/default/net.lo +endef + +$(eval $(generic-package)) diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk index 5978b6de5d..387962d4d5 100644 --- a/package/openrc/openrc.mk +++ b/package/openrc/openrc.mk @@ -37,6 +37,17 @@ define OPENRC_INSTALL_TARGET_CMDS $(MAKE) $(OPENRC_MAKE_OPTS) DESTDIR=$(TARGET_DIR) -C $(@D) install endef +ifeq ($(BR2_PACKAGE_NETIFRC),y) +# netifrc replaces network, staticroute and loopback services which are +# installed by openrc +define OPENRC_NO_NET + $(RM) $(TARGET_DIR)/etc/runlevels/boot/{network,staticroute,loopback} + $(RM) $(TARGET_DIR)/etc/init.d/{network,staticroute,loopback} + $(RM) $(TARGET_DIR)/etc/conf.d/{network,staticroute,loopback} +endef +OPENRC_POST_TARGET_INSTALL_HOOKS += OPENRC_NO_NET +endif + define OPENRC_REMOVE_UNNEEDED $(RM) -r $(TARGET_DIR)/usr/share/openrc endef From patchwork Sun Aug 4 12:14:19 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: 1141730 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.136; helo=silver.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="Z1OcbFuM"; dkim-atps=neutral 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 461fwQ0Nw6z9sMr for ; Sun, 4 Aug 2019 22:14:46 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8FFC9203C5; Sun, 4 Aug 2019 12:14:44 +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 G6j0otWyjobH; Sun, 4 Aug 2019 12:14:36 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id DA4F0203D4; Sun, 4 Aug 2019 12:14:32 +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 7A7241BF417 for ; Sun, 4 Aug 2019 12:14:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 77B788776C for ; Sun, 4 Aug 2019 12:14:27 +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 Yyc1j9r1rN-R for ; Sun, 4 Aug 2019 12:14:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by hemlock.osuosl.org (Postfix) with ESMTPS id 2607E878ED for ; Sun, 4 Aug 2019 12:14:26 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id l2so70491263wmg.0 for ; Sun, 04 Aug 2019 05:14:26 -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=6wWVw+0MVFWMF0ZSiqfo3TeVTxhup/3GOFe2gF7VBbA=; b=Z1OcbFuM4EyFUupoFOkYYqT2BmSKDpmYjzIXdI19jKk05I5Db/an7Cx8XI+Hs3apa/ kGNRjAY/rS4lGa7gwovr3PYM8mlnlPP9+pTs0hDLot703xXRsu0uLJcQZpK9+aD+ga0M sEuEw8gIFhBic+oI+TIRUPgXTCpR9evqytgnuWmVIdW/NlNaI/ETBOUz7IQuhQWgmEgW e56tCoF+416pJrpoSQuOrqBFojfOjafgfrvKUQUseSnr9zbGEOTHlTsC5s5yH46aN7xr iqbgNdVMWiaCsIIgxi9nwag6YSPQmq8Y1EEKc0LlNOBE4clo6selGdBoz8oUB6Oc0BN0 28gQ== 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=6wWVw+0MVFWMF0ZSiqfo3TeVTxhup/3GOFe2gF7VBbA=; b=GnzuPRh4e01LJVj5ru0qYQmcsg2ezgLaa6//ybKKP5NUuQcLGVdYoTqlGE5PaM8QmM xx84ddGoZNO4Z8phu4+QE/v7MTCjQLq9qZDTe8sdzB8bGgSGOANJkBGTKVbv0tLrmABR X3l2lDrqNre2q+NDNg10P5xrkdo+5LWlXEv7NiO2oY6lU3JgXndvkFUyKX4pxzpKufjL B0UYONLcUkfU1/fc12vtXwNSu/CjRYWE2Ilvcb2n1hLGcWjMvmo7HpTYCXoqbeLhhTMK u5wCnXnUEMJ3BQ9gucarwYS8vUXWTU4Xm7BknmsqMIEIVoZcXkvQp93iFSe0ngqlRsBP 34uw== X-Gm-Message-State: APjAAAXwqReXj5c6tpD+g/uokcLu/+kPXAdxw+2vDZ2+vfKpnI8CXfxR E8KFpgreRxSM4iJTHab4sQvhrQM4 X-Google-Smtp-Source: APXvYqwUpkJWIJb7oisUpchzXMZBRqnm7uSI1RqkdVujihb0ICJpPVELcrdH3rrf8pUHrmYo+rzxzw== X-Received: by 2002:a7b:ce95:: with SMTP id q21mr14014903wmj.65.1564920864478; Sun, 04 Aug 2019 05:14:24 -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.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 04 Aug 2019 05:14:24 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 4 Aug 2019 14:14:19 +0200 Message-Id: <30a72507b462c74206c354feae3887e54b96da09.1564920849.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 5/5 v3] package/netifrc: add support for BR2_SYSTEM_DHCP 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 This patch makes openrc-netifrc package aware of BR2_SYSTEM_DHCP config, and if set, will start dhcp daemon on configured interface. Signed-off-by: Michał Łyszczek [yann.morin.1998@free.fr: - simplify condition for BR2_SYSTEM_DHCP - reword commit log ] Signed-off-by: Yann E. MORIN --- package/netifrc/netifrc.mk | 12 ++++++++++++ system/Config.in | 8 +++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/package/netifrc/netifrc.mk b/package/netifrc/netifrc.mk index 4b9a0a8d39..15719ee8b4 100644 --- a/package/netifrc/netifrc.mk +++ b/package/netifrc/netifrc.mk @@ -31,8 +31,19 @@ define NETIFRC_REMOVE_UDEV endef endif # BR2_PACKAGE_HAS_UDEV +NETIFRC_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP)) +ifneq ($(NETIFRC_DHCP_IFACE),) +NETIFRC_DHCP_CFG = config_$(NETIFRC_DHCP_IFACE)="dhcp" +define NETIFRC_DHCP_SERVICE + ln -sf net.lo $(TARGET_DIR)/etc/init.d/net.$(NETIFRC_DHCP_IFACE) + ln -sf /etc/init.d/net.$(NETIFRC_DHCP_IFACE) \ + $(TARGET_DIR)/etc/runlevels/default/net.$(NETIFRC_DHCP_IFACE) +endef +endif # BR2_SYSTEM_DHCP != "" + define NETIFRC_NET_CFG config_lo="127.0.0.1/8" + $(NETIFRC_DHCP_CFG) endef define NETIFRC_INSTALL_TARGET_CMDS @@ -40,6 +51,7 @@ define NETIFRC_INSTALL_TARGET_CMDS $(NETIFRC_REMOVE_UDEV) $(call PRINTF,$(NETIFRC_NET_CFG)) > $(TARGET_DIR)/etc/conf.d/net ln -sf /etc/init.d/net.lo $(TARGET_DIR)/etc/runlevels/default/net.lo + $(NETIFRC_DHCP_SERVICE) endef $(eval $(generic-package)) diff --git a/system/Config.in b/system/Config.in index 1bfe069b2e..c87266f431 100644 --- a/system/Config.in +++ b/system/Config.in @@ -377,7 +377,8 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW config BR2_SYSTEM_DHCP string "Network interface to configure through DHCP" default "" - depends on BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || BR2_PACKAGE_SYSTEMD_NETWORKD + depends on BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || \ + BR2_PACKAGE_SYSTEMD_NETWORKD || BR2_PACKAGE_NETIFRC help Enter here the name of the network interface (E.G. eth0) to automatically configure through DHCP at bootup. @@ -388,8 +389,9 @@ config BR2_SYSTEM_DHCP overwrite /etc/network/interfaces or add a networkd configuration file. -comment "automatic network configuration via DHCP needs ifupdown or busybox or networkd" - depends on !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || BR2_PACKAGE_SYSTEMD_NETWORKD) +comment "automatic network configuration via DHCP needs ifupdown or busybox or networkd or netifrc" + depends on !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || \ + BR2_PACKAGE_SYSTEMD_NETWORKD || BR2_PACKAGE_NETIFRC) endif # BR2_ROOTFS_SKELETON_DEFAULT