Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/ifplugd: add option to override sysconfdir
@ 2024-01-15 14:27 Alisa Volk via buildroot
  2024-02-05 17:09 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Alisa Volk via buildroot @ 2024-01-15 14:27 UTC (permalink / raw)
  To: buildroot; +Cc: Alisa Volk, ovlevin

Add BR2_PACKAGE_IFPLUGD_SYSCONFDIR option to pass custom --sysconfdir argument.

Ifplugd init script is auto-generated with sysconfdir="etc/" by default.
As a result path to ifplugd configuration file is hardcoded
to /etc/ifplugd/ifplugd.conf.

This patch allows to override sysconfdir making it possible
to use custom path to configuration file.

Signed-off-by: Alisa Volk <aolvolk@salutedevices.com>
---
 package/ifplugd/Config.in  | 6 ++++++
 package/ifplugd/ifplugd.mk | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/package/ifplugd/Config.in b/package/ifplugd/Config.in
index c4b5b5b9d1..772c084132 100644
--- a/package/ifplugd/Config.in
+++ b/package/ifplugd/Config.in
@@ -12,3 +12,9 @@ config BR2_PACKAGE_IFPLUGD
 	  configure the interface when a cable is really connected.
 
 	  http://0pointer.de/lennart/projects/ifplugd/
+
+config BR2_PACKAGE_IFPLUGD_SYSCONFDIR
+	string "sysconfdir"
+	default "/etc"
+	help
+	  Path to ifplugd.conf and ifplugd.action files.
diff --git a/package/ifplugd/ifplugd.mk b/package/ifplugd/ifplugd.mk
index 6de7f17641..5d7f1562d3 100644
--- a/package/ifplugd/ifplugd.mk
+++ b/package/ifplugd/ifplugd.mk
@@ -13,7 +13,9 @@ IFPLUGD_AUTORECONF = YES
 
 # install-strip unconditionally overwrites $(TARGET_DIR)/etc/ifplugd/ifplugd.*
 IFPLUGD_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install-exec
-IFPLUGD_CONF_OPTS = --disable-lynx --with-initdir=/etc/init.d/
+IFPLUGD_CONF_OPTS = --disable-lynx \
+	--with-initdir=/etc/init.d/ \
+	--sysconfdir=$(BR2_PACKAGE_IFPLUGD_SYSCONFDIR)
 IFPLUGD_DEPENDENCIES = libdaemon
 
 define IFPLUGD_INSTALL_FIXUP
-- 
2.39.3 (Apple Git-145)

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/ifplugd: add option to override sysconfdir
  2024-01-15 14:27 [Buildroot] [PATCH] package/ifplugd: add option to override sysconfdir Alisa Volk via buildroot
@ 2024-02-05 17:09 ` Thomas Petazzoni via buildroot
       [not found]   ` <d63d6a13-770c-4a4c-bad3-c4d97a54d747@salutedevices.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-02-05 17:09 UTC (permalink / raw)
  To: Alisa Volk via buildroot; +Cc: Alisa Volk, ovlevin

Hello Alisa,

On Mon, 15 Jan 2024 17:27:44 +0300
Alisa Volk via buildroot <buildroot@buildroot.org> wrote:

> Add BR2_PACKAGE_IFPLUGD_SYSCONFDIR option to pass custom --sysconfdir argument.
> 
> Ifplugd init script is auto-generated with sysconfdir="etc/" by default.
> As a result path to ifplugd configuration file is hardcoded
> to /etc/ifplugd/ifplugd.conf.

Thanks a lot for your patch! However, looking at it, the --sysconfdir
option has no impact on the path to the ifplugd.conf file. This file is
sourced by the init script before starting ifplugd, as explained in the
ifplugd man page:

FILES
       /etc/ifplugd/ifplugd.conf: this file is sourced by the init
       script /etc/init.d/ifplugd and contains the interface to be
       monitored and the options to be used.

Looking at the code, the only file affected by the --sysconfdir option
is ifplugd.action, and the path to this file can be overridden at
runtime using:

       -r | --run= EXEC
              Specify program to execute when link status changes
              (default: /etc/ifplugd/ifplugd.action)

So, in the end, it looks like your patch is not needed, as the location
of both ifplugd.conf and ifplugd.action is runtime configurable.

BTW, the ifplugd package does not have a Buildroot init script, it
would be nice to add one, if you have some time of course :-)

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/ifplugd: add option to override sysconfdir
       [not found]   ` <d63d6a13-770c-4a4c-bad3-c4d97a54d747@salutedevices.com>
@ 2024-02-09 22:00     ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-02-09 22:00 UTC (permalink / raw)
  To: Alisa Volk; +Cc: ovlevin, buildroot@buildroot.org

Hello Alisa,

Your e-mail wraps very weirdly the messages you reply to, as it forgets
the quotation mark on the second line of the quoted text.

On Fri, 9 Feb 2024 14:02:14 +0300
Alisa Volk <aolvolk@salutedevices.com> wrote:

> The init script is auto-generated, and the path to ifplugd.conf file 
> inside it is configured with sysconfdir option.

Correct, I hadn't realized this init script was installed. Usually,
Buildroot provides its own init scripts. My suggestion here will be to
patch/override this init script in your root filesystem overlay, or
using a post-build script.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2024-02-09 22:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-15 14:27 [Buildroot] [PATCH] package/ifplugd: add option to override sysconfdir Alisa Volk via buildroot
2024-02-05 17:09 ` Thomas Petazzoni via buildroot
     [not found]   ` <d63d6a13-770c-4a4c-bad3-c4d97a54d747@salutedevices.com>
2024-02-09 22:00     ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox