2017-07-02 16:35:50 +02:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# ifupdown-scripts
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
package/ifupdown-scripts: do not expect localhost to precede DHCP
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@gmail.com>
[yann.morin.1998@free.fr: split off to its own patch]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-03-11 21:46:22 +01:00
|
|
|
define IFUPDOWN_SCRIPTS_PREAMBLE
|
|
|
|
echo "# interface file auto-generated by buildroot" \
|
|
|
|
> $(TARGET_DIR)/etc/network/interfaces
|
|
|
|
endef
|
|
|
|
|
2017-07-02 16:35:50 +02:00
|
|
|
define IFUPDOWN_SCRIPTS_LOCALHOST
|
|
|
|
( \
|
|
|
|
echo ; \
|
|
|
|
echo "auto lo"; \
|
|
|
|
echo "iface lo inet loopback"; \
|
package/ifupdown-scripts: do not expect localhost to precede DHCP
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@gmail.com>
[yann.morin.1998@free.fr: split off to its own patch]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-03-11 21:46:22 +01:00
|
|
|
) >> $(TARGET_DIR)/etc/network/interfaces
|
2017-07-02 16:35:50 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
IFUPDOWN_SCRIPTS_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
|
|
|
|
|
|
|
|
ifneq ($(IFUPDOWN_SCRIPTS_DHCP_IFACE),)
|
|
|
|
define IFUPDOWN_SCRIPTS_DHCP
|
|
|
|
( \
|
|
|
|
echo ; \
|
|
|
|
echo "auto $(IFUPDOWN_SCRIPTS_DHCP_IFACE)"; \
|
|
|
|
echo "iface $(IFUPDOWN_SCRIPTS_DHCP_IFACE) inet dhcp"; \
|
|
|
|
echo " pre-up /etc/network/nfs_check"; \
|
|
|
|
echo " wait-delay 15"; \
|
2018-10-30 18:16:14 +01:00
|
|
|
echo " hostname \$$(hostname)"; \
|
2017-07-02 16:35:50 +02:00
|
|
|
) >> $(TARGET_DIR)/etc/network/interfaces
|
|
|
|
endef
|
2020-03-09 03:50:03 +01:00
|
|
|
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
|
2017-07-02 16:35:50 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
define IFUPDOWN_SCRIPTS_INSTALL_TARGET_CMDS
|
2020-03-09 03:50:01 +01:00
|
|
|
$(INSTALL) -m 0755 -D $(IFUPDOWN_SCRIPTS_PKGDIR)/nfs_check \
|
|
|
|
$(TARGET_DIR)/etc/network/nfs_check
|
2017-10-15 02:57:19 +02:00
|
|
|
$(call SYSTEM_RSYNC,$(IFUPDOWN_SCRIPTS_PKGDIR)/network,$(TARGET_DIR)/etc/network)
|
2017-07-02 16:35:50 +02:00
|
|
|
endef
|
|
|
|
|
2020-03-09 03:50:03 +01:00
|
|
|
define IFUPDOWN_SCRIPTS_INSTALL_INIT_OPENRC
|
|
|
|
$(IFUPDOWN_SCRIPTS_PREAMBLE)
|
|
|
|
$(IFUPDOWN_SCRIPTS_DHCP)
|
|
|
|
$(IFUPDOWN_SCRIPTS_DHCP_OPENRC)
|
|
|
|
endef
|
|
|
|
|
2017-07-02 16:35:50 +02:00
|
|
|
define IFUPDOWN_SCRIPTS_INSTALL_INIT_SYSV
|
|
|
|
$(INSTALL) -D -m 0755 $(IFUPDOWN_SCRIPTS_PKGDIR)/S40network \
|
|
|
|
$(TARGET_DIR)/etc/init.d/S40network
|
package/ifupdown-scripts: do not expect localhost to precede DHCP
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@gmail.com>
[yann.morin.1998@free.fr: split off to its own patch]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-03-11 21:46:22 +01:00
|
|
|
$(IFUPDOWN_SCRIPTS_PREAMBLE)
|
2020-03-09 03:50:02 +01:00
|
|
|
$(IFUPDOWN_SCRIPTS_LOCALHOST)
|
|
|
|
$(IFUPDOWN_SCRIPTS_DHCP)
|
2017-07-02 16:35:50 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
# ifupdown-scripts can not be selected when systemd-networkd is
|
|
|
|
# enabled, so if we are enabled with systemd, we must install our
|
|
|
|
# own service file.
|
|
|
|
define IFUPDOWN_SCRIPTS_INSTALL_INIT_SYSTEMD
|
|
|
|
$(INSTALL) -D -m 644 $(IFUPDOWN_SCRIPTS_PKGDIR)/network.service \
|
|
|
|
$(TARGET_DIR)/etc/systemd/system/network.service
|
package/ifupdown-scripts: do not expect localhost to precede DHCP
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@gmail.com>
[yann.morin.1998@free.fr: split off to its own patch]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-03-11 21:46:22 +01:00
|
|
|
$(IFUPDOWN_SCRIPTS_PREAMBLE)
|
2020-03-09 03:50:02 +01:00
|
|
|
$(IFUPDOWN_SCRIPTS_LOCALHOST)
|
|
|
|
$(IFUPDOWN_SCRIPTS_DHCP)
|
2017-07-02 16:35:50 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(generic-package))
|