[svn-commits] sruffell: branch 1.4 r3351 - in /branches/1.4: Makefile uninstall-modules-sh

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Dec 7 17:51:00 CST 2007


Author: sruffell
Date: Fri Dec  7 17:50:59 2007
New Revision: 3351

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3351
Log:
The previous cleanup wasn't quite working when there were multiple old
modules in the modules.dep folder.  Moved the cleanup to external script
for the time being.

Added:
    branches/1.4/uninstall-modules-sh   (with props)
Modified:
    branches/1.4/Makefile

Modified: branches/1.4/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/Makefile?view=diff&rev=3351&r1=3350&r2=3351
==============================================================================
--- branches/1.4/Makefile (original)
+++ branches/1.4/Makefile Fri Dec  7 17:50:59 2007
@@ -530,30 +530,25 @@
 uninstall-hotplug:
 	$(MAKE) -C firmware hotplug-uninstall DESTDIR=$(DESTDIR)
 
+BASENAMES=$(sort $(shell for x in $(ALL_MODULES); do basename $x; done))
 uninstall-modules:
 ifeq ($(BUILDVER),linux24)
 else
-	for x in $(ALL_MODULES); do \
+	@./uninstall-modules-sh $(DESTDIR)/lib/modules/$(KVERS) $(BASENAMES)
+	@for x in $(ALL_MODULES); do \
 		rm -f $(DESTDIR)/lib/modules/$(KVERS)/extra/$$x ; \
 		rm -f $(DESTDIR)/lib/modules/$(KVERS)/misc/$$x ; \
 		rm -f $(DESTDIR)/lib/modules/$(KVERS)/zaptel/$$x ; \
 	done;
 endif
 
+BASENAMES=$(sort $(shell for mod in $(ALL_MODULES); do basename $$mod; done))
+
 install-modules: $(INSTALL_MODULES) uninstall-modules
 ifeq ($(BUILDVER),linux24)
 	$(INSTALL) -d $(DESTDIR)$(MOD_DIR)
 	$(INSTALL) -m 644 $(INSTALL_MODULES) $(DESTDIR)$(MOD_DIR)
 else
-	@# Delete any existing drivers before installing the new ones.  This
-	@# prevents problems when upgrading from a previous version of zaptel 
-	@# where the drivers may have been in a different location. In this
-	@# case, when depmod is run, the old drivers may be found and used
-	@# before the new drivers.
-	@for mod in $(INSTALL_MODULES); do \
-		rm -f `cat $(DESTDIR)/lib/modules/$(KVERS)/modules.dep | \
-			cut -d : -f 1 | grep -m 1 $$mod`; \
-	done;
 	$(KMAKE_INST)
   ifneq (,$(wildcard datamods/syncppp.ko))
 	$(MAKE) -C datamods install

Added: branches/1.4/uninstall-modules-sh
URL: http://svn.digium.com/view/zaptel/branches/1.4/uninstall-modules-sh?view=auto&rev=3351
==============================================================================
--- branches/1.4/uninstall-modules-sh (added)
+++ branches/1.4/uninstall-modules-sh Fri Dec  7 17:50:59 2007
@@ -1,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

Propchange: branches/1.4/uninstall-modules-sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/1.4/uninstall-modules-sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: branches/1.4/uninstall-modules-sh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: branches/1.4/uninstall-modules-sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the svn-commits mailing list