Skip to content

Commit

Permalink
Fix 'make install' overly broad 'rm'
Browse files Browse the repository at this point in the history
When running 'make install' without DESTDIR set the module install
rules would mistakenly destroy the 'modules.*' files for ALL of
your installed kernels.  This could lead to a non-functional system
for the alternate kernels because 'depmod -a' will only be run for
the kernel which was compiled against.  This issue would not impact
anyone using the 'make <deb|rpm|pkg>' build targets to build and
install packages.

The fix for this issue is to only remove extraneous build products
when DESTDIR is set.  This almost exclusively indicates we are
building packages and installed the build products in to a temporary
staging location.  Additionally, limit the removal the unneeded
build products to the target kernel version.

Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#328
  • Loading branch information
behlendorf committed Jul 20, 2011
1 parent d936522 commit e80cd06
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion module/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ modules_install:
$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
INSTALL_MOD_PATH=$(DESTDIR) \
INSTALL_MOD_DIR=addon/spl $@
find $(DESTDIR)/lib/modules/ -name 'modules.*' | xargs $(RM)
@# Remove extraneous build products when packaging
if [ -n "$(DESTDIR)" ]; then \
find $(DESTDIR)/lib/modules/@LINUX_VERSION@ \
-name 'modules.*' | xargs $(RM); \
fi
sysmap=$(DESTDIR)/boot/System.map-@LINUX_VERSION@; \
if [ -f $$sysmap ]; then \
depmod -ae -F $$sysmap @LINUX_VERSION@; \
Expand Down

0 comments on commit e80cd06

Please sign in to comment.