From: Carlos Santos Date: Mon, 9 Mar 2020 02:50:03 +0000 (-0300) Subject: package/ifupdown-scripts: add openrc support X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=57f3685bc19d94e50b2e63463bc4a71ec2e0503f;p=buildroot.git package/ifupdown-scripts: add openrc support The "network" script allows configuring an interface by means of two /etc/ifup. and /etc/ifdown. 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_DHCP_OPENRC macro to create the ifup. and ifdown. 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 [yann.morin.1998@free.fr: - adapt after the preamble was spit to itw own patch ] Signed-off-by: Yann E. MORIN --- 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 8a2337e46b..5ef032142c 100644 --- a/package/ifupdown-scripts/ifupdown-scripts.mk +++ b/package/ifupdown-scripts/ifupdown-scripts.mk @@ -30,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 @@ -38,6 +44,12 @@ 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