e2fsprogs: prevent undesired cleanup with a usr merged target

The following commit prevents the e2fsprogs package from inadvertently
removing its own binaries when a target includes BusyBox and is
targeting a usr-merged environment.

While an action has been added to cleanup BusyBox-provided (if any)
ext2-related tools when including e2fsprogs, the action will delete
desired e2fsprogs binaries in an already prepared usr-merged target.
Adjusting the cleanup to occur before installing e2fsprogs binaries so
that if a usr-merged target exists, it will first delete the previous
binaries (if any) followed by installing new binaries.

Signed-off-by: James Knight <james.knight@rockwellcollins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
James Knight 2015-10-28 17:36:26 -04:00 committed by Thomas Petazzoni
parent f700463c66
commit 9a9950dba8

View file

@ -106,9 +106,16 @@ ifeq ($(BR2_PACKAGE_E2FSPROGS_E2FSCK),y)
E2FSPROGS_POST_INSTALL_TARGET_HOOKS += E2FSPROGS_TARGET_E2FSCK_SYMLINKS
endif
# Remove busybox tune2fs and e2label, since we want the e2fsprogs full
# blown variants to take precedence, but they are not installed in the
# same location.
# If BusyBox is included, its configuration may supply its own variant
# of ext2-related tools. Since Buildroot desires having full blown
# variants take precedence (in this case, e2fsprogs), we want to remove
# BusyBox's variant of e2fsprogs provided binaries. e2fsprogs targets
# /usr/{bin,sbin} where BusyBox targets /{bin,sbin}. We will attempt to
# remove BusyBox-generated ext2-related tools from /{bin,sbin}. We need
# to do this in the pre-install stage to ensure we do not accidentally
# remove e2fsprogs's binaries in usr-merged environments (ie. if they
# are removed, they would be re-installed in this package's install
# stage).
ifeq ($(BR2_PACKAGE_BUSYBOX),y)
E2FSPROGS_DEPENDENCIES += busybox
@ -119,7 +126,7 @@ define E2FSPROGS_REMOVE_BUSYBOX_APPLETS
$(RM) -f $(TARGET_DIR)/sbin/tune2fs
$(RM) -f $(TARGET_DIR)/sbin/e2label
endef
E2FSPROGS_POST_INSTALL_TARGET_HOOKS += E2FSPROGS_REMOVE_BUSYBOX_APPLETS
E2FSPROGS_PRE_INSTALL_TARGET_HOOKS += E2FSPROGS_REMOVE_BUSYBOX_APPLETS
endif
define E2FSPROGS_TARGET_TUNE2FS_SYMLINK