Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/3] package/ifupdown-scripts: add openrc support
Date: Wed, 11 Mar 2020 22:15:35 +0100	[thread overview]
Message-ID: <20200311211535.GB705@scaer> (raw)
In-Reply-To: <20200309025003.26466-4-unixmania@gmail.com>

CarloS< All,

On 2020-03-08 23:50 -0300, unixmania@gmail.com spake thusly:
> From: Carlos Santos <unixmania@gmail.com>
> 
> The "network" script allows configuring an interface by means of two
> /etc/ifup.<if_name> and /etc/ifdown.<if_name> files with the commands
> required to bring it up and down, respectively. So we can support the
> BR2_SYSTEM_DHCP config if netifrc is not selected.
> 
> - Replace the dependency on !BR2_PACKAGE_OPENRC in Config.in by a
>   dependency on !BR2_PACKAGE_NETIFRC.
> 
> - Add an IFUPDOWN_SCRIPTS_PREAMBLE macro to create an empty interfaces
>   file.

I've split that to its own patch. Thus, the patch adding openrc support
is smaller and more self-contained.

Thanks for your work on OpenRC, it's nice to see someone taking care of
it :-) Now, if we could have even more runtime test of it (network,
etc..) that would be even better! ;-]

Regards,
Yann E. MORIN.

> - Make the IFUPDOWN_SCRIPTS_LOCALHOST macro append the "lo" setup to the
>   interfaces file.
> 
> - Add an IFUPDOWN_SCRIPTS_DHCP_OPENRC macro to create the ifup.<if_name>
>   and ifdown.<if_name> files.
> 
> - Add an IFUPDOWN_SCRIPTS_INSTALL_INIT_OPENRC hook that includes the
>   IFUPDOWN_SCRIPTS_{PREAMBLE,DHCP,DHCP_OPENRC} macros. LOCALHOST is not
>   required, since "lo" is configured by the "loopback" script.
> 
> Signed-off-by: Carlos Santos <unixmania@gmail.com>
> ---
>  package/ifupdown-scripts/Config.in           |  2 +-
>  package/ifupdown-scripts/ifupdown-scripts.mk | 22 ++++++++++++++++++--
>  2 files changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/package/ifupdown-scripts/Config.in b/package/ifupdown-scripts/Config.in
> index 4b984bc30c..166094c511 100644
> --- a/package/ifupdown-scripts/Config.in
> +++ b/package/ifupdown-scripts/Config.in
> @@ -1,7 +1,7 @@
>  config BR2_PACKAGE_IFUPDOWN_SCRIPTS
>  	bool "ifupdown scripts"
>  	default y if BR2_ROOTFS_SKELETON_DEFAULT
> -	depends on !BR2_PACKAGE_SYSTEMD_NETWORKD && !BR2_PACKAGE_OPENRC
> +	depends on !BR2_PACKAGE_SYSTEMD_NETWORKD && !BR2_PACKAGE_NETIFRC
>  	help
>  	  Set of scripts used by ifupdown (either the standalone one,
>  	  or the busybox one) to bring network up, or tear it down.
> diff --git a/package/ifupdown-scripts/ifupdown-scripts.mk b/package/ifupdown-scripts/ifupdown-scripts.mk
> index 16fef783dd..5ef032142c 100644
> --- a/package/ifupdown-scripts/ifupdown-scripts.mk
> +++ b/package/ifupdown-scripts/ifupdown-scripts.mk
> @@ -4,13 +4,17 @@
>  #
>  ################################################################################
>  
> +define IFUPDOWN_SCRIPTS_PREAMBLE
> +	echo "# interface file auto-generated by buildroot" \
> +		> $(TARGET_DIR)/etc/network/interfaces
> +endef
> +
>  define IFUPDOWN_SCRIPTS_LOCALHOST
>  	( \
> -		echo "# interface file auto-generated by buildroot"; \
>  		echo ; \
>  		echo "auto lo"; \
>  		echo "iface lo inet loopback"; \
> -	) > $(TARGET_DIR)/etc/network/interfaces
> +	) >> $(TARGET_DIR)/etc/network/interfaces
>  endef
>  
>  IFUPDOWN_SCRIPTS_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
> @@ -26,6 +30,12 @@ define IFUPDOWN_SCRIPTS_DHCP
>  		echo "  hostname \$$(hostname)"; \
>  	) >> $(TARGET_DIR)/etc/network/interfaces
>  endef
> +define IFUPDOWN_SCRIPTS_DHCP_OPENRC
> +	echo "ifup $(IFUPDOWN_SCRIPTS_DHCP_IFACE)" \
> +		> $(TARGET_DIR)/etc/ifup.$(IFUPDOWN_SCRIPTS_DHCP_IFACE)
> +	echo "ifdown $(IFUPDOWN_SCRIPTS_DHCP_IFACE)" \
> +		> $(TARGET_DIR)/etc/ifdown.$(IFUPDOWN_SCRIPTS_DHCP_IFACE)
> +endef
>  endif
>  
>  define IFUPDOWN_SCRIPTS_INSTALL_TARGET_CMDS
> @@ -34,9 +44,16 @@ define IFUPDOWN_SCRIPTS_INSTALL_TARGET_CMDS
>  	$(call SYSTEM_RSYNC,$(IFUPDOWN_SCRIPTS_PKGDIR)/network,$(TARGET_DIR)/etc/network)
>  endef
>  
> +define IFUPDOWN_SCRIPTS_INSTALL_INIT_OPENRC
> +	$(IFUPDOWN_SCRIPTS_PREAMBLE)
> +	$(IFUPDOWN_SCRIPTS_DHCP)
> +	$(IFUPDOWN_SCRIPTS_DHCP_OPENRC)
> +endef
> +
>  define IFUPDOWN_SCRIPTS_INSTALL_INIT_SYSV
>  	$(INSTALL) -D -m 0755 $(IFUPDOWN_SCRIPTS_PKGDIR)/S40network \
>  		$(TARGET_DIR)/etc/init.d/S40network
> +	$(IFUPDOWN_SCRIPTS_PREAMBLE)
>  	$(IFUPDOWN_SCRIPTS_LOCALHOST)
>  	$(IFUPDOWN_SCRIPTS_DHCP)
>  endef
> @@ -47,6 +64,7 @@ endef
>  define IFUPDOWN_SCRIPTS_INSTALL_INIT_SYSTEMD
>  	$(INSTALL) -D -m 644 $(IFUPDOWN_SCRIPTS_PKGDIR)/network.service \
>  		$(TARGET_DIR)/etc/systemd/system/network.service
> +	$(IFUPDOWN_SCRIPTS_PREAMBLE)
>  	$(IFUPDOWN_SCRIPTS_LOCALHOST)
>  	$(IFUPDOWN_SCRIPTS_DHCP)
>  endef
> -- 
> 2.18.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

      reply	other threads:[~2020-03-11 21:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09  2:50 [Buildroot] [PATCH 0/3] package/ifupdown-scripts: add openrc support unixmania at gmail.com
2020-03-09  2:50 ` [Buildroot] [PATCH 1/3] package/ifupdown-scripts: always install /etc/network/nfs_check unixmania at gmail.com
2020-03-11 20:31   ` Yann E. MORIN
2020-03-09  2:50 ` [Buildroot] [PATCH 2/3] package/ifupdown-scripts: relocate the generation the interfaces file unixmania at gmail.com
2020-03-11 21:13   ` Yann E. MORIN
2020-03-09  2:50 ` [Buildroot] [PATCH 3/3] package/ifupdown-scripts: add openrc support unixmania at gmail.com
2020-03-11 21:15   ` Yann E. MORIN [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200311211535.GB705@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox