[Buildroot] [git commit] package/ifupdown-scripts: do not expect localhost to precede DHCP
Yann E. MORIN
yann.morin.1998 at free.fr
Wed Mar 11 21:12:17 UTC 2020
commit: https://git.buildroot.net/buildroot/commit/?id=48c73e0c5f840fc67adfa3ec58dba90768d384e9
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
Currently, we always suppose that localhost settings will always come
before the (optional) DHCP ones. This is always true when using
sysvinit/busybox or systemd.
However, with openrc, this will no longer be the case: only the DHCP
settings will be present (OpenRC handles lo on his own).
So, prepare the macros to be independent one from the other, and for
symetry, in both:
- use append-redirection >> to populate the interfaces file,
- prepend a leading empty line at the beginning of each section.
The origianl singe '>' redirection would ensure the file would not grow
on a reinstall, but that's no longer the case, so reset the file prior
to filling it, using the canned preamble.
Signed-off-by: Carlos Santos <unixmania at gmail.com>
[yann.morin.1998 at free.fr: split off to its own patch]
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
package/ifupdown-scripts/ifupdown-scripts.mk | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/package/ifupdown-scripts/ifupdown-scripts.mk b/package/ifupdown-scripts/ifupdown-scripts.mk
index 16fef783dd..8a2337e46b 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))
@@ -37,6 +41,7 @@ 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 +52,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
More information about the buildroot
mailing list