All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton
@ 2012-07-11  4:14 Danomi Manchego
  2012-07-14 21:43 ` Arnout Vandecappelle
  2012-07-17 21:45 ` Thomas Petazzoni
  0 siblings, 2 replies; 8+ messages in thread
From: Danomi Manchego @ 2012-07-11  4:14 UTC (permalink / raw)
  To: buildroot

To allow custom scripts in the target skeletons.

Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>
---
 package/avahi/avahi.mk |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/package/avahi/avahi.mk b/package/avahi/avahi.mk
index 32e3df7..481da03 100644
--- a/package/avahi/avahi.mk
+++ b/package/avahi/avahi.mk
@@ -144,8 +144,14 @@ AVAHI_POST_INSTALL_TARGET_HOOKS += AVAHI_REMOVE_INITSCRIPT
 
 define AVAHI_INSTALL_AUTOIPD
 	rm -rf $(TARGET_DIR)/etc/dhcp3/
-	$(INSTALL) -D -m 0755 package/avahi/busybox-udhcpc-default.script $(TARGET_DIR)/usr/share/udhcpc/default.script
-	$(INSTALL) -m 0755 package/avahi/S05avahi-setup.sh $(TARGET_DIR)/etc/init.d/
+	if [ ! -f $(TARGET_DIR)/usr/share/udhcpc/default.script ]; then \
+		$(INSTALL) -m 0755 -D package/avahi/busybox-udhcpc-default.script \
+			$(TARGET_DIR)/usr/share/udhcpc/default.script; \
+	fi
+	if [ ! -f $(TARGET_DIR)/etc/init.d/S05avahi-setup.sh ]; then \
+		$(INSTALL) -m 0755 -D package/avahi/S05avahi-setup.sh \
+			$(TARGET_DIR)/etc/init.d/S05avahi-setup.sh; \
+	fi
 	rm -f $(TARGET_DIR)/var/lib/avahi-autoipd
 	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/lib
 	ln -sf /tmp/avahi-autoipd $(TARGET_DIR)/var/lib/avahi-autoipd
-- 
1.7.9.5

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

* [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton
  2012-07-11  4:14 [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton Danomi Manchego
@ 2012-07-14 21:43 ` Arnout Vandecappelle
  2012-07-17 21:45 ` Thomas Petazzoni
  1 sibling, 0 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2012-07-14 21:43 UTC (permalink / raw)
  To: buildroot

On 07/11/12 06:14, Danomi Manchego wrote:
> To allow custom scripts in the target skeletons.
>
> Signed-off-by: Danomi Manchego<danomimanchego123@gmail.com>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton
  2012-07-11  4:14 [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton Danomi Manchego
  2012-07-14 21:43 ` Arnout Vandecappelle
@ 2012-07-17 21:45 ` Thomas Petazzoni
  2012-07-20  1:53   ` Danomi Manchego
  1 sibling, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2012-07-17 21:45 UTC (permalink / raw)
  To: buildroot

Le Wed, 11 Jul 2012 00:14:36 -0400,
Danomi Manchego <danomimanchego123@gmail.com> a ?crit :

> +	if [ ! -f $(TARGET_DIR)/usr/share/udhcpc/default.script ]; then \
> +		$(INSTALL) -m 0755 -D package/avahi/busybox-udhcpc-default.script \
> +			$(TARGET_DIR)/usr/share/udhcpc/default.script; \
> +	fi

This doesn't work: the Busybox package already installs a
default.script file in usr/share/udhcpc. If avahi is built before
Busybox, then you'll have the Avahi script. If Busybox is built before
Avahi, then you'll have the Busybox script. This doesn't look correct.

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton
  2012-07-17 21:45 ` Thomas Petazzoni
@ 2012-07-20  1:53   ` Danomi Manchego
  2012-07-20  8:02     ` Thomas Petazzoni
  0 siblings, 1 reply; 8+ messages in thread
From: Danomi Manchego @ 2012-07-20  1:53 UTC (permalink / raw)
  To: buildroot

Thomas,

> If avahi is built before
> Busybox, then you'll have the Avahi script. If Busybox is built before
> Avahi, then you'll have the Busybox script. This doesn't look correct.

Would it be appropriate to add something like this to busybox.mk, so that
Avahi always gets built first?

ifeq ($(BR2_PACKAGE_AVAHI),y)
# Compile Avahi first, to ensure proper preference of conditional
udhcpc/default.script installations
BUSYBOX_DEPENDENCIES += avahi
endif

Dan -

On Tue, Jul 17, 2012 at 5:45 PM, Thomas Petazzoni <
thomas.petazzoni@free-electrons.com> wrote:

> Le Wed, 11 Jul 2012 00:14:36 -0400,
> Danomi Manchego <danomimanchego123@gmail.com> a ?crit :
>
> > +     if [ ! -f $(TARGET_DIR)/usr/share/udhcpc/default.script ]; then \
> > +             $(INSTALL) -m 0755 -D
> package/avahi/busybox-udhcpc-default.script \
> > +                     $(TARGET_DIR)/usr/share/udhcpc/default.script; \
> > +     fi
>
> This doesn't work: the Busybox package already installs a
> default.script file in usr/share/udhcpc. If avahi is built before
> Busybox, then you'll have the Avahi script. If Busybox is built before
> Avahi, then you'll have the Busybox script. This doesn't look correct.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120719/82c9d98f/attachment.html>

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

* [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton
  2012-07-20  1:53   ` Danomi Manchego
@ 2012-07-20  8:02     ` Thomas Petazzoni
  2012-07-20  8:57       ` Peter Korsgaard
  2012-07-21  2:55       ` Danomi Manchego
  0 siblings, 2 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2012-07-20  8:02 UTC (permalink / raw)
  To: buildroot

Le Thu, 19 Jul 2012 21:53:45 -0400,
Danomi Manchego <danomimanchego123@gmail.com> a ?crit :

> > If avahi is built before
> > Busybox, then you'll have the Avahi script. If Busybox is built before
> > Avahi, then you'll have the Busybox script. This doesn't look correct.
> 
> Would it be appropriate to add something like this to busybox.mk, so that
> Avahi always gets built first?
> 
> ifeq ($(BR2_PACKAGE_AVAHI),y)
> # Compile Avahi first, to ensure proper preference of conditional
> udhcpc/default.script installations
> BUSYBOX_DEPENDENCIES += avahi
> endif

Well, I think the whole idea of testing whether a configuration file has
already been copied or not to the target filesystem to avoid
overwriting files from the skeleton is not nice (I think using the
post-build script to overwrite configuration files is a much better
idea), but I know Peter wants this to work.

So, if we indeed want the Avahi udhcpc configuration file to take
precedence over the busybox one, we would have to do what you suggest.

I ran a diff between the Busybox udhcpc script and the Avahi one and
got the following result:

--- ../busybox/udhcpc.script	2012-03-09 11:23:50.255418372 +0100
+++ busybox-udhcpc-default.script	2011-05-12 22:43:39.000000000 +0200
@@ -10,10 +10,29 @@
 
 case "$1" in
 	deconfig)
-		/sbin/ifconfig $interface 0.0.0.0
+		grep -q -v ip= /proc/cmdline
+		if [ $? -eq 0 ]; then
+			/sbin/ifconfig $interface up
+		fi
+		grep -q -v nfsroot= /proc/cmdline
+		if [ $? -eq 0 ]; then
+			/sbin/ifconfig $interface 0.0.0.0
+		fi
+		if [ -x /usr/sbin/avahi-autoipd ]; then
+			/usr/sbin/avahi-autoipd -k $interface
+		fi
+		;;
+
+	leasefail|nak)
+		if [ -x /usr/sbin/avahi-autoipd ]; then
+			/usr/sbin/avahi-autoipd -wD $interface --no-chroot
+		fi
 		;;
 
 	renew|bound)
+		if [ -x /usr/sbin/avahi-autoipd ]; then
+			/usr/sbin/avahi-autoipd -k $interface
+		fi
 		/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
 
 		if [ -n "$router" ] ; then

The parts around avahi-autoipd are obviously here for a reason, but why
does it need to test for ip= and nfsroot= in the kernel command line in
Avahi case and not in Busybox case?

One possibility would be to simply put the Avahi variant of the script
into the Busybox package. When Avahi is not installed, the
avahi-autoipd tests would simply ensure that the script does not try to
use Avahi.

Also, the current Avahi installation makes the assumption that Busybox
is in the system, and that its DHCP client is used. But we have another
DHCP client packaged in Buildroot (though I admit most people probably
use the one from Busybox).

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton
  2012-07-20  8:02     ` Thomas Petazzoni
@ 2012-07-20  8:57       ` Peter Korsgaard
  2012-07-20  9:10         ` Thomas Petazzoni
  2012-07-21  2:55       ` Danomi Manchego
  1 sibling, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2012-07-20  8:57 UTC (permalink / raw)
  To: buildroot

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

 Thomas> Le Thu, 19 Jul 2012 21:53:45 -0400,
 Thomas> Danomi Manchego <danomimanchego123@gmail.com> a ?crit :

 >> > If avahi is built before
 >> > Busybox, then you'll have the Avahi script. If Busybox is built before
 >> > Avahi, then you'll have the Busybox script. This doesn't look correct.
 >> 
 >> Would it be appropriate to add something like this to busybox.mk, so that
 >> Avahi always gets built first?
 >> 
 >> ifeq ($(BR2_PACKAGE_AVAHI),y)
 >> # Compile Avahi first, to ensure proper preference of conditional
 >> udhcpc/default.script installations
 >> BUSYBOX_DEPENDENCIES += avahi
 >> endif

 Thomas> Well, I think the whole idea of testing whether a configuration file has
 Thomas> already been copied or not to the target filesystem to avoid
 Thomas> overwriting files from the skeleton is not nice (I think using the
 Thomas> post-build script to overwrite configuration files is a much better
 Thomas> idea), but I know Peter wants this to work.

I don't really feel that strongly about it.

 Thomas> The parts around avahi-autoipd are obviously here for a reason,
 Thomas> but why does it need to test for ip= and nfsroot= in the kernel
 Thomas> command line in Avahi case and not in Busybox case?

 Thomas> One possibility would be to simply put the Avahi variant of the
 Thomas> script into the Busybox package. When Avahi is not installed,
 Thomas> the avahi-autoipd tests would simply ensure that the script
 Thomas> does not try to use Avahi.

That was my thought exactly. I had a quick look at it just before I got
ill, but then forgot about it.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton
  2012-07-20  8:57       ` Peter Korsgaard
@ 2012-07-20  9:10         ` Thomas Petazzoni
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2012-07-20  9:10 UTC (permalink / raw)
  To: buildroot

Hello Peter,

Le Fri, 20 Jul 2012 10:57:25 +0200,
Peter Korsgaard <jacmet@uclibc.org> a ?crit :

>  Thomas> Well, I think the whole idea of testing whether a
>  Thomas> configuration file has already been copied or not to the
>  Thomas> target filesystem to avoid overwriting files from the
>  Thomas> skeleton is not nice (I think using the post-build script to
>  Thomas> overwrite configuration files is a much better idea), but I
>  Thomas> know Peter wants this to work.
> 
> I don't really feel that strongly about it.

Ok, but either we support it, and we support it completely, or we don't
support it and we remove all those conditional file installations (by
making them unconditional).

>  Thomas> The parts around avahi-autoipd are obviously here for a
>  Thomas> reason, but why does it need to test for ip= and nfsroot= in
>  Thomas> the kernel command line in Avahi case and not in Busybox
>  Thomas> case?
> 
>  Thomas> One possibility would be to simply put the Avahi variant of
>  Thomas> the script into the Busybox package. When Avahi is not
>  Thomas> installed, the avahi-autoipd tests would simply ensure that
>  Thomas> the script does not try to use Avahi.
> 
> That was my thought exactly. I had a quick look at it just before I
> got ill, but then forgot about it.

Ok, thanks for your input!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton
  2012-07-20  8:02     ` Thomas Petazzoni
  2012-07-20  8:57       ` Peter Korsgaard
@ 2012-07-21  2:55       ` Danomi Manchego
  1 sibling, 0 replies; 8+ messages in thread
From: Danomi Manchego @ 2012-07-21  2:55 UTC (permalink / raw)
  To: buildroot

Thomas,

> but why does it need to test for ip= and nfsroot= in the kernel command
> line in Avahi case and not in Busybox case?

We use our own udhcpc.script which doesn't have these clauses, but I think
that we can make some guesses:

-	/sbin/ifconfig $interface 0.0.0.0
+	grep -q -v ip= /proc/cmdline
+	if [ $? -eq 0 ]; then
+	/sbin/ifconfig $interface up
+	fi
+	grep -q -v nfsroot= /proc/cmdline
+	if [ $? -eq 0 ]; then
+	/sbin/ifconfig $interface 0.0.0.0
+	fi

Regarding the "nfsroot=" test: According to udhcpc man page, "deconfig" is
used when udhcpc starts, in addition to when a lease is lost.  But if you
are using an nfs-rooted setup, then you already have an IP address, and
you need to avoid loosing it.  So I imagine that this is just an attempt
to avoid the breakdown of an nfs-rooted development setup during the
"deconfig" if udhcpc is started, or shut down.

Regarding the "ip=" test: I'm not so sure ... if you set up a static IP
address on the command line, then what's the harm in setting an interface
to "up" again?  I'm wondering if the originator of this file (Eric Andersen?)
was simply excising all the interface ups and downs, to avoid messing with
a static IP setup, such as might be used during a project development.

> One possibility would be to simply put the Avahi variant of the script
> into the Busybox package.

That would solve my problem too.  Though, I'm coming around to the notion
of installing custom target skeletons at the end of the process, rather
than the beginning, just to avoid this kind of policing.  Either way, it sounds
like I should withdraw this version of the patch ...

Danomi -


On Fri, Jul 20, 2012 at 4:02 AM, Thomas Petazzoni <
thomas.petazzoni@free-electrons.com> wrote:

> Le Thu, 19 Jul 2012 21:53:45 -0400,
> Danomi Manchego <danomimanchego123@gmail.com> a ?crit :
>
> > > If avahi is built before
> > > Busybox, then you'll have the Avahi script. If Busybox is built before
> > > Avahi, then you'll have the Busybox script. This doesn't look correct.
> >
> > Would it be appropriate to add something like this to busybox.mk, so
> that
> > Avahi always gets built first?
> >
> > ifeq ($(BR2_PACKAGE_AVAHI),y)
> > # Compile Avahi first, to ensure proper preference of conditional
> > udhcpc/default.script installations
> > BUSYBOX_DEPENDENCIES += avahi
> > endif
>
> Well, I think the whole idea of testing whether a configuration file has
> already been copied or not to the target filesystem to avoid
> overwriting files from the skeleton is not nice (I think using the
> post-build script to overwrite configuration files is a much better
> idea), but I know Peter wants this to work.
>
> So, if we indeed want the Avahi udhcpc configuration file to take
> precedence over the busybox one, we would have to do what you suggest.
>
> I ran a diff between the Busybox udhcpc script and the Avahi one and
> got the following result:
>
> --- ../busybox/udhcpc.script    2012-03-09 11:23:50.255418372 +0100
> +++ busybox-udhcpc-default.script       2011-05-12 22:43:39.000000000 +0200
> @@ -10,10 +10,29 @@
>
>  case "$1" in
>         deconfig)
> -               /sbin/ifconfig $interface 0.0.0.0
> +               grep -q -v ip= /proc/cmdline
> +               if [ $? -eq 0 ]; then
> +                       /sbin/ifconfig $interface up
> +               fi
> +               grep -q -v nfsroot= /proc/cmdline
> +               if [ $? -eq 0 ]; then
> +                       /sbin/ifconfig $interface 0.0.0.0
> +               fi
> +               if [ -x /usr/sbin/avahi-autoipd ]; then
> +                       /usr/sbin/avahi-autoipd -k $interface
> +               fi
> +               ;;
> +
> +       leasefail|nak)
> +               if [ -x /usr/sbin/avahi-autoipd ]; then
> +                       /usr/sbin/avahi-autoipd -wD $interface --no-chroot
> +               fi
>                 ;;
>
>         renew|bound)
> +               if [ -x /usr/sbin/avahi-autoipd ]; then
> +                       /usr/sbin/avahi-autoipd -k $interface
> +               fi
>                 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
>
>                 if [ -n "$router" ] ; then
>
> The parts around avahi-autoipd are obviously here for a reason, but why
> does it need to test for ip= and nfsroot= in the kernel command line in
> Avahi case and not in Busybox case?
>
> One possibility would be to simply put the Avahi variant of the script
> into the Busybox package. When Avahi is not installed, the
> avahi-autoipd tests would simply ensure that the script does not try to
> use Avahi.
>
> Also, the current Avahi installation makes the assumption that Busybox
> is in the system, and that its DHCP client is used. But we have another
> DHCP client packaged in Buildroot (though I admit most people probably
> use the one from Busybox).
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120720/4ca7261e/attachment.html>

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

end of thread, other threads:[~2012-07-21  2:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11  4:14 [Buildroot] [PATCH] avahi: only install default.script/S05avahi-setup.sh if not present in fs skeleton Danomi Manchego
2012-07-14 21:43 ` Arnout Vandecappelle
2012-07-17 21:45 ` Thomas Petazzoni
2012-07-20  1:53   ` Danomi Manchego
2012-07-20  8:02     ` Thomas Petazzoni
2012-07-20  8:57       ` Peter Korsgaard
2012-07-20  9:10         ` Thomas Petazzoni
2012-07-21  2:55       ` Danomi Manchego

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.