diff options
-rw-r--r-- | Makefile | 1 | ||||
-rwxr-xr-x | uninstall-modules-sh | 36 |
2 files changed, 37 insertions, 0 deletions
@@ -450,6 +450,7 @@ endif # Specific to a kernel version: install-modules: modules ifeq ($(BUILDVER),linux26) + @./uninstall-modules-sh $(DESTDIR)/lib/modules/$(KVERS) $(MODULES) for x in $(MODULESKO); do \ rm -f $(DESTDIR)/lib/modules/$(KVERS)/extra/$$x ; \ done diff --git a/uninstall-modules-sh b/uninstall-modules-sh new file mode 100755 index 0000000..d70255c --- /dev/null +++ b/uninstall-modules-sh @@ -0,0 +1,36 @@ +#!/bin/sh +# uninstall-modules-sh +# +# Remove all the modules passed in on the command line from the modules +# directory. This script is called by the makefile. +# +# USAGE: uninstall-modules-sh <modules dir> modules to delete ... + +KERNEL_MODULES_DIR=$1 +shift +MODULES=$@ + +function usage { + echo "$0: Used to delete kernel modules from the modules directory." +} + +if [ -z "$KERNEL_MODULES_DIR" ]; then + echo "Missing kernel module directory." + usage + exit 1; +fi + +if [ -z "$MODULES" ]; then + echo "Missing one or more modules to delete." + usage + exit 1; +fi +for mod in $MODULES; do + for file in `cat $KERNEL_MODULES_DIR/modules.dep | cut -d : -f 1 | grep $mod`; do + if [ -e "$file" ]; then + echo "Deleting $file." + rm -f $file + fi + done +done +exit 0 |