[Buildroot] [git commit] lvm: fix installation to target dir

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Sun Aug 2 08:00:41 UTC 2009

commit: http://git.buildroot.net/buildroot/commit/?id=b0629253765226375fd1bf7e296ef1174cf9c620
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

The installation to the target directory was broken for two reasons:

 * Due to how the lvm2.mk file was written, for each file listed in
   reinstalling all the files listed in those variables. When a target
   contains several elements, there's no need to make a loop to handle
   each of the elements: the rule will get executed as many times as
   they are elements in the target.

 * For some odd reason, lvm2 build system installs executable with 555
   and libraries with 444. Therefore, once copied to the target
   directory, these executables and libraries cannot be
   overwritten... for example by a later execution of Buildroot. We
   fix this up by changing the permissions of the binaries and
   libraries installed by lvm2 to saner values (755 and 644)

Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
 package/lvm2/lvm2.mk |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/package/lvm2/lvm2.mk b/package/lvm2/lvm2.mk
index b3467b5..3727e36 100644
--- a/package/lvm2/lvm2.mk
+++ b/package/lvm2/lvm2.mk
@@ -81,17 +81,19 @@ $(LVM2_DIR)/.configured: $(LVM2_DIR)/.unpacked
 $(LVM2_DIR)/.built: $(LVM2_DIR)/.configured
 	$(MAKE1) -C $(LVM2_DIR) DESTDIR=$(STAGING_DIR) install
+	# Fixup write permissions so that the files can be overwritten
+	# several times in the $(TARGET_DIR)
+	chmod 755 $(STAGING_DIR)/sbin/lvm
+	chmod 755 $(STAGING_DIR)/sbin/dmsetup
+	chmod 644 $(STAGING_DIR)/lib/$(LVM2_LIB)
 	touch $(LVM2_DIR)/.built
-$(LVM2_TARGET_SBINS): $(LVM2_DIR)/.built
-	for binary in $(LVM2_SBIN); do echo $$binary; cp -a $(STAGING_DIR)/sbin/$$binary $(TARGET_DIR)/sbin; done
-	for binary in $(LVM2_DMSETUP_SBIN); do echo $$binary; cp -a $(STAGING_DIR)/sbin/$$binary $(TARGET_DIR)/sbin; done
+	cp -a $(STAGING_DIR)/sbin/$(notdir $@) $@
 $(LVM2_TARGET_LIBS): $(LVM2_DIR)/.built
-	for lib in $(LVM2_LIB); do echo $$lib; cp -a $(STAGING_DIR)/lib/$$lib $(TARGET_DIR)/lib; done
+	cp -a $(STAGING_DIR)/lib/$(notdir $@) $@

More information about the buildroot mailing list