Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] initramfs: fix symlink test
@ 2010-11-16 14:58 Mike Frysinger
  2010-11-16 15:09 ` Thomas Petazzoni
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mike Frysinger @ 2010-11-16 14:58 UTC (permalink / raw)
  To: buildroot

We want to see if the symlink exists which means -L, not if the target
of the symlink exists.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 fs/initramfs/initramfs.mk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/initramfs/initramfs.mk b/fs/initramfs/initramfs.mk
index dd6aa94..594cc34 100644
--- a/fs/initramfs/initramfs.mk
+++ b/fs/initramfs/initramfs.mk
@@ -7,7 +7,7 @@
 #############################################################
 
 define ROOTFS_INITRAMFS_INIT_SYMLINK
-	if [ ! -e $(TARGET_DIR)/init ]; then \
+	if [ ! -L $(TARGET_DIR)/init ]; then \
 		ln -s sbin/init $(TARGET_DIR)/init; \
 	fi
 endef
@@ -20,4 +20,4 @@ endef
 
 ROOTFS_INITRAMFS_POST_TARGETS += linux26-rebuild-with-initramfs
 
-$(eval $(call ROOTFS_TARGET,initramfs))
\ No newline at end of file
+$(eval $(call ROOTFS_TARGET,initramfs))
-- 
1.7.3.2

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

* [Buildroot] [PATCH] initramfs: fix symlink test
  2010-11-16 14:58 [Buildroot] [PATCH] initramfs: fix symlink test Mike Frysinger
@ 2010-11-16 15:09 ` Thomas Petazzoni
  2010-11-16 15:27 ` Malte Starostik
  2010-11-17  6:46 ` [Buildroot] [PATCH v2] initramfs: fix init symlink creation Mike Frysinger
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2010-11-16 15:09 UTC (permalink / raw)
  To: buildroot

On Tue, 16 Nov 2010 09:58:46 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> We want to see if the symlink exists which means -L, not if the target
> of the symlink exists.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

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] 5+ messages in thread

* [Buildroot] [PATCH] initramfs: fix symlink test
  2010-11-16 14:58 [Buildroot] [PATCH] initramfs: fix symlink test Mike Frysinger
  2010-11-16 15:09 ` Thomas Petazzoni
@ 2010-11-16 15:27 ` Malte Starostik
  2010-11-17  6:46 ` [Buildroot] [PATCH v2] initramfs: fix init symlink creation Mike Frysinger
  2 siblings, 0 replies; 5+ messages in thread
From: Malte Starostik @ 2010-11-16 15:27 UTC (permalink / raw)
  To: buildroot

Am Dienstag, 16. November 2010, 15:58:46 schrieb Mike Frysinger:
> We want to see if the symlink exists which means -L, not if the target
> of the symlink exists.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  fs/initramfs/initramfs.mk |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/initramfs/initramfs.mk b/fs/initramfs/initramfs.mk
> index dd6aa94..594cc34 100644
> --- a/fs/initramfs/initramfs.mk
> +++ b/fs/initramfs/initramfs.mk
> @@ -7,7 +7,7 @@
>  #############################################################
> 
>  define ROOTFS_INITRAMFS_INIT_SYMLINK
> -	if [ ! -e $(TARGET_DIR)/init ]; then \
> +	if [ ! -L $(TARGET_DIR)/init ]; then \
>  		ln -s sbin/init $(TARGET_DIR)/init; \
>  	fi
>  endef
> @@ -20,4 +20,4 @@ endef
> 
>  ROOTFS_INITRAMFS_POST_TARGETS += linux26-rebuild-with-initramfs
> 
> -$(eval $(call ROOTFS_TARGET,initramfs))
> \ No newline at end of file
> +$(eval $(call ROOTFS_TARGET,initramfs))

Ack for not testing if the link target exists, but what if $(TARGET_DIR)/init 
exists but is not a symlink?  My custom skeleton contains an /init shell 
script? or is that considered unsupported?
Maybe something along the lines of
[ ! -e $(TARGET_DIR)/init -a ! -L $(TARGET_DIR)/init ]
?

Regards,
Malte

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

* [Buildroot] [PATCH v2] initramfs: fix init symlink creation
  2010-11-16 14:58 [Buildroot] [PATCH] initramfs: fix symlink test Mike Frysinger
  2010-11-16 15:09 ` Thomas Petazzoni
  2010-11-16 15:27 ` Malte Starostik
@ 2010-11-17  6:46 ` Mike Frysinger
  2010-11-17 20:21   ` Peter Korsgaard
  2 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2010-11-17  6:46 UTC (permalink / raw)
  To: buildroot

The -e test will dereference the symlink, so if there is no /bin/init,
we will constantly try to create the symlink.  So rather than error on
subsequent runs when the link exists, use the force flag to ln.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
	- drop the -L change and just recreate the symlink for people
	  who install their own file at /init

 fs/initramfs/initramfs.mk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/initramfs/initramfs.mk b/fs/initramfs/initramfs.mk
index dd6aa94..73122a8 100644
--- a/fs/initramfs/initramfs.mk
+++ b/fs/initramfs/initramfs.mk
@@ -8,7 +8,7 @@
 
 define ROOTFS_INITRAMFS_INIT_SYMLINK
 	if [ ! -e $(TARGET_DIR)/init ]; then \
-		ln -s sbin/init $(TARGET_DIR)/init; \
+		ln -sf sbin/init $(TARGET_DIR)/init; \
 	fi
 endef
 
@@ -20,4 +20,4 @@ endef
 
 ROOTFS_INITRAMFS_POST_TARGETS += linux26-rebuild-with-initramfs
 
-$(eval $(call ROOTFS_TARGET,initramfs))
\ No newline at end of file
+$(eval $(call ROOTFS_TARGET,initramfs))
-- 
1.7.3.2

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

* [Buildroot] [PATCH v2] initramfs: fix init symlink creation
  2010-11-17  6:46 ` [Buildroot] [PATCH v2] initramfs: fix init symlink creation Mike Frysinger
@ 2010-11-17 20:21   ` Peter Korsgaard
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2010-11-17 20:21 UTC (permalink / raw)
  To: buildroot

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

 Mike> The -e test will dereference the symlink, so if there is no /bin/init,
 Mike> we will constantly try to create the symlink.  So rather than error on
 Mike> subsequent runs when the link exists, use the force flag to ln.

Committed, thanks.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2010-11-17 20:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-16 14:58 [Buildroot] [PATCH] initramfs: fix symlink test Mike Frysinger
2010-11-16 15:09 ` Thomas Petazzoni
2010-11-16 15:27 ` Malte Starostik
2010-11-17  6:46 ` [Buildroot] [PATCH v2] initramfs: fix init symlink creation Mike Frysinger
2010-11-17 20:21   ` Peter Korsgaard

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