All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] skeleton: /etc/network/interface.d/* support
@ 2016-08-16 15:38 Matt Weber
  2016-10-22 21:28 ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Matt Weber @ 2016-08-16 15:38 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
---

v1 -> v2
 - interfaces.d is only supported with full ifupdown package
---
 package/skeleton/skeleton.mk                    | 10 ++++++++++
 system/device_table.txt                         |  1 +
 system/skeleton/etc/network/interfaces.d/.empty |  0
 3 files changed, 11 insertions(+)
 create mode 100644 system/skeleton/etc/network/interfaces.d/.empty

diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index 1000161..39e2cbb 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -170,9 +170,19 @@ define SKELETON_SET_NETWORK_DHCP
 endef
 endif
 
+ifeq ($(BR2_PACKAGE_IFUPDOWN),y)
+define SKELETON_SET_NETWORK_SUPPORT_INTERFACES_D
+	( \
+		echo ;                                               \
+		echo "source interfaces.d/*";                        \
+	) >> $(TARGET_DIR)/etc/network/interfaces
+endef
+endif
+
 define SKELETON_SET_NETWORK
 	mkdir -p $(TARGET_DIR)/etc/network/
 	$(SKELETON_SET_NETWORK_LOCALHOST)
+	$(SKELETON_SET_NETWORK_SUPPORT_INTERFACES_D)
 	$(SKELETON_SET_NETWORK_DHCP)
 endef
 
diff --git a/system/device_table.txt b/system/device_table.txt
index dc1af51..69b1d46 100644
--- a/system/device_table.txt
+++ b/system/device_table.txt
@@ -17,5 +17,6 @@
 /etc/network/if-pre-up.d		d	755	0	0	-	-	-	-	-
 /etc/network/if-down.d			d	755	0	0	-	-	-	-	-
 /etc/network/if-post-down.d		d	755	0	0	-	-	-	-	-
+/etc/network/interfaces.d		d	755	0	0	-	-	-	-	-
 # uncomment this to allow starting x as non-root
 #/usr/X11R6/bin/Xfbdev		     	f	4755	0	0	-	-	-	-	-
diff --git a/system/skeleton/etc/network/interfaces.d/.empty b/system/skeleton/etc/network/interfaces.d/.empty
new file mode 100644
index 0000000..e69de29
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2] skeleton: /etc/network/interface.d/* support
  2016-08-16 15:38 [Buildroot] [PATCH v2] skeleton: /etc/network/interface.d/* support Matt Weber
@ 2016-10-22 21:28 ` Thomas Petazzoni
  2016-10-23 12:06   ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2016-10-22 21:28 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 16 Aug 2016 10:38:28 -0500, Matt Weber wrote:

> diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
> index 1000161..39e2cbb 100644
> --- a/package/skeleton/skeleton.mk
> +++ b/package/skeleton/skeleton.mk
> @@ -170,9 +170,19 @@ define SKELETON_SET_NETWORK_DHCP
>  endef
>  endif
>  
> +ifeq ($(BR2_PACKAGE_IFUPDOWN),y)
> +define SKELETON_SET_NETWORK_SUPPORT_INTERFACES_D
> +	( \
> +		echo ;                                               \
> +		echo "source interfaces.d/*";                        \
> +	) >> $(TARGET_DIR)/etc/network/interfaces
> +endef
> +endif
> +
>  define SKELETON_SET_NETWORK
>  	mkdir -p $(TARGET_DIR)/etc/network/
>  	$(SKELETON_SET_NETWORK_LOCALHOST)
> +	$(SKELETON_SET_NETWORK_SUPPORT_INTERFACES_D)
>  	$(SKELETON_SET_NETWORK_DHCP)
>  endef
>  
> diff --git a/system/device_table.txt b/system/device_table.txt
> index dc1af51..69b1d46 100644
> --- a/system/device_table.txt
> +++ b/system/device_table.txt
> @@ -17,5 +17,6 @@
>  /etc/network/if-pre-up.d		d	755	0	0	-	-	-	-	-
>  /etc/network/if-down.d			d	755	0	0	-	-	-	-	-
>  /etc/network/if-post-down.d		d	755	0	0	-	-	-	-	-
> +/etc/network/interfaces.d		d	755	0	0	-	-	-	-	-
>  # uncomment this to allow starting x as non-root
>  #/usr/X11R6/bin/Xfbdev		     	f	4755	0	0	-	-	-	-	-
> diff --git a/system/skeleton/etc/network/interfaces.d/.empty b/system/skeleton/etc/network/interfaces.d/.empty
> new file mode 100644
> index 0000000..e69de29

Sorry for the late answer. I believe none of this should go in the main
skeleton, as it is really specific to ifupdown. What about instead
adding the following in ifupdown.mk:

ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
define IFUPDOWN_TUNE_ETC_NETWORK_INTERFACES
	mkdir -p $(TARGET_DIR)/etc/network/interfaces.d
	echo "source interfaces.d/*" >> $(TARGET_DIR)/etc/network/interfaces
endef
IFUPDOWN_TARGET_FINALIZE_HOOKS += IFUPDOWN_TUNE_ETC_NETWORK_INTERFACES
endif

define IFUPDOWN_PERMISSIONS
/etc/network/interfaces.d		d	755	0	0	-	-	-	-	-
endef

This should do exactly the same thing, but is isolated in the ifupdown
package.

Could you look into this?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2] skeleton: /etc/network/interface.d/* support
  2016-10-22 21:28 ` Thomas Petazzoni
@ 2016-10-23 12:06   ` Peter Korsgaard
  2016-10-23 12:17     ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2016-10-23 12:06 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 > Sorry for the late answer. I believe none of this should go in the main
 > skeleton, as it is really specific to ifupdown.

Indeed. From what I can see, the busybox applet doesn't support
wildcards in the source lines (and doesn't support source-directory).

What is the reason to use source with a wildcard instead of
source-directory? From the man page:

       source interfaces.d/machine-dependent

       source-directory interfaces.d

It does say though:

Currently, "source-directory" isn't supported by network-manager and guessnet.

By default, on a freshly installed Debian system, the interfaces file
includes a line to source files in the /etc/network/interfaces.d
directory.

From the postinst script:

  if [ ! -f /etc/network/interfaces ] ; then
    if [ -z "$2" ]; then
      echo "Creating /etc/network/interfaces."
      echo "# interfaces(5) file used by ifup(8) and ifdown(8)" > /etc/network/interfaces
      echo "# Include files from /etc/network/interfaces.d:" >> /etc/network/interfaces
      echo "source-directory /etc/network/interfaces.d" >> /etc/network/interfaces

 > adding the following in ifupdown.mk:

 > ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
 > define IFUPDOWN_TUNE_ETC_NETWORK_INTERFACES
 > 	mkdir -p $(TARGET_DIR)/etc/network/interfaces.d
 > 	echo "source interfaces.d/*" >> $(TARGET_DIR)/etc/network/interfaces
 > endef
 > IFUPDOWN_TARGET_FINALIZE_HOOKS += IFUPDOWN_TUNE_ETC_NETWORK_INTERFACES

We afaik provide no explicit guarantees on the ordering of the various
_TARGET_FINALIZE hooks, but it afaik will run in (package-)alphabetical
order, E.G. before the finalize hooks of skeleton so this doesn't work
:/

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2] skeleton: /etc/network/interface.d/* support
  2016-10-23 12:06   ` Peter Korsgaard
@ 2016-10-23 12:17     ` Thomas Petazzoni
  2016-10-25  2:22       ` Matthew Weber
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2016-10-23 12:17 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 23 Oct 2016 14:06:12 +0200, Peter Korsgaard wrote:

> We afaik provide no explicit guarantees on the ordering of the various
> _TARGET_FINALIZE hooks

Correct.

>, but it afaik will run in (package-)alphabetical
> order, E.G. before the finalize hooks of skeleton so this doesn't work
> :/

Hum, my thinking was that it did not matter if the "source" line is
before or after the lo definition. However, the skeleton package
completely overwrites the file, so indeed, it doesn't work.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2] skeleton: /etc/network/interface.d/* support
  2016-10-23 12:17     ` Thomas Petazzoni
@ 2016-10-25  2:22       ` Matthew Weber
  2016-10-25  6:25         ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Matthew Weber @ 2016-10-25  2:22 UTC (permalink / raw)
  To: buildroot

Thomas/ Peter

On Sun, Oct 23, 2016 at 7:17 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
>
> Hello,
>
> On Sun, 23 Oct 2016 14:06:12 +0200, Peter Korsgaard wrote:
>
> > We afaik provide no explicit guarantees on the ordering of the various
> > _TARGET_FINALIZE hooks
>
> Correct.
>
> >, but it afaik will run in (package-)alphabetical
> > order, E.G. before the finalize hooks of skeleton so this doesn't work
> > :/
>
> Hum, my thinking was that it did not matter if the "source" line is
> before or after the lo definition. However, the skeleton package
> completely overwrites the file, so indeed, it doesn't work.


So leave it as is in the skeleton.mk?

-- 
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / Security Systems and Software / Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA
www.rockwellcollins.com

Note: Any Export License Required Information and License Restricted
Third Party Intellectual Property (TPIP) content must be encrypted and
sent to matthew.weber at corp.rockwellcollins.com.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2] skeleton: /etc/network/interface.d/* support
  2016-10-25  2:22       ` Matthew Weber
@ 2016-10-25  6:25         ` Peter Korsgaard
  2016-10-25 13:14           ` Matthew Weber
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2016-10-25  6:25 UTC (permalink / raw)
  To: buildroot

>>>>> "Matthew" == Matthew Weber <matthew.weber@rockwellcollins.com> writes:

Hi,

 >> > We afaik provide no explicit guarantees on the ordering of the various
 >> > _TARGET_FINALIZE hooks
 >> 
 >> Correct.
 >> 
 >> >, but it afaik will run in (package-)alphabetical
 >> > order, E.G. before the finalize hooks of skeleton so this doesn't work
 >> > :/
 >> 
 >> Hum, my thinking was that it did not matter if the "source" line is
 >> before or after the lo definition. However, the skeleton package
 >> completely overwrites the file, so indeed, it doesn't work.

 > So leave it as is in the skeleton.mk?

I think that is the only place we can add it, yes.

With that said, there's afaik no packages using interface.d, so if this
is just for project customization then you might as well handle it there
(E.G. you might already have a custom interfaces or appending the line
to it in your post-build is easy).

-- 
Venlig hilsen,
Peter Korsgaard 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v2] skeleton: /etc/network/interface.d/* support
  2016-10-25  6:25         ` Peter Korsgaard
@ 2016-10-25 13:14           ` Matthew Weber
  0 siblings, 0 replies; 7+ messages in thread
From: Matthew Weber @ 2016-10-25 13:14 UTC (permalink / raw)
  To: buildroot

Peter,

On Tue, Oct 25, 2016 at 1:25 AM, Peter Korsgaard <peter@korsgaard.com> wrote:
>>>>>> "Matthew" == Matthew Weber <matthew.weber@rockwellcollins.com> writes:
>
> Hi,
>
>  >> > We afaik provide no explicit guarantees on the ordering of the various
>  >> > _TARGET_FINALIZE hooks
>  >>
>  >> Correct.
>  >>
>  >> >, but it afaik will run in (package-)alphabetical
>  >> > order, E.G. before the finalize hooks of skeleton so this doesn't work
>  >> > :/
>  >>
>  >> Hum, my thinking was that it did not matter if the "source" line is
>  >> before or after the lo definition. However, the skeleton package
>  >> completely overwrites the file, so indeed, it doesn't work.
>
>  > So leave it as is in the skeleton.mk?
>
> I think that is the only place we can add it, yes.
>
> With that said, there's afaik no packages using interface.d, so if this
> is just for project customization then you might as well handle it there
> (E.G. you might already have a custom interfaces or appending the line
> to it in your post-build is easy).

Agree, but in this case we thought it might make sense to include by
default, so that we encourage the practice of using that style of
interface configuration which follows the behavior/intent of larger
Linux distros.  Especially since the user intentionally enables
ifupdown for more advanced use cases.

I'm good either way.

-- 
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / Security Systems and Software / Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA
www.rockwellcollins.com

Note: Any Export License Required Information and License Restricted
Third Party Intellectual Property (TPIP) content must be encrypted and
sent to matthew.weber at corp.rockwellcollins.com.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-10-25 13:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16 15:38 [Buildroot] [PATCH v2] skeleton: /etc/network/interface.d/* support Matt Weber
2016-10-22 21:28 ` Thomas Petazzoni
2016-10-23 12:06   ` Peter Korsgaard
2016-10-23 12:17     ` Thomas Petazzoni
2016-10-25  2:22       ` Matthew Weber
2016-10-25  6:25         ` Peter Korsgaard
2016-10-25 13:14           ` Matthew Weber

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.