backports: re-introduce make uninstall
authorASIC Felix <ic.felix@gmail.com>
Fri, 21 Jun 2013 05:02:52 +0000 (22:02 -0700)
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>
Wed, 26 Jun 2013 16:47:39 +0000 (09:47 -0700)
This approach only uninstalls modules you have built
previously on your current build directory for backports.
If this requires adjustments then we'll have to just have
to use our own new backports KMODDIR.

Signed-off-by: Felix Bitterli <ic.felix@gmail.com>
[mcgrof: extended the commit log a bit]
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backport/Makefile.real
backport/scripts/compress_modules.sh
backport/scripts/mod_helpers.sh [new file with mode: 0644]
backport/scripts/uninstall.sh [new file with mode: 0755]

index 2a1f640fbe045255ba9e993aabf72b60aae5c40a..c09663c32ac2831277afc5ea73855291bab5bbfd 100644 (file)
@@ -101,6 +101,16 @@ install: modules
 .PHONY: modules_install
 modules_install: install
 
+.PHONY: uninstall
+uninstall:
+       @./scripts/uninstall.sh
+       @/sbin/depmod -a
+       @./scripts/update-initramfs.sh $(KLIB)
+       @echo
+       @echo Your backported driver modules should be uninstalled now.
+       @echo Reboot.
+       @echo
+
 .PHONY: clean
 clean:
        @$(MAKE) -f Makefile.build clean
index bbf264f4e677197856e2a4047c522525318ab9aa..b2034c2c4b4664aad43f31c89e06e84cbc79e540 100755 (executable)
@@ -2,20 +2,11 @@
 
 set -e
 
-function mod_filename()
-{
-       which modinfo > /dev/null 2>&1
-       if [[ $? -eq 0 ]]; then
-               MOD_QUERY="modinfo -F filename"
-       else
-               MOD_QUERY="modprobe -l"
-       fi
-       mod_path="$($MOD_QUERY $1 | tail -1)"
-       echo $(basename "$mod_path")
-}
+source ./scripts/mod_helpers.sh
 
 if test "$(mod_filename mac80211)" = "mac80211.ko.gz" ; then
        for driver in $(find "$1" -type f -name *.ko); do
+               echo COMPRESS $driver
                gzip -9 $driver
        done
 fi
diff --git a/backport/scripts/mod_helpers.sh b/backport/scripts/mod_helpers.sh
new file mode 100644 (file)
index 0000000..0845b3e
--- /dev/null
@@ -0,0 +1,11 @@
+function mod_filename()
+{
+       which modinfo > /dev/null 2>&1
+       if [[ $? -eq 0 ]]; then
+               MOD_QUERY="modinfo -F filename"
+       else
+               MOD_QUERY="modprobe -l"
+       fi
+       mod_path="$($MOD_QUERY $1 | tail -1)"
+       echo $(basename "$mod_path")
+}
diff --git a/backport/scripts/uninstall.sh b/backport/scripts/uninstall.sh
new file mode 100755 (executable)
index 0000000..99f74ab
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+source ./scripts/mod_helpers.sh
+
+if test "$(mod_filename mac80211)" = "mac80211.ko.gz" ; then
+       compr=".gz"
+else
+       compr=""
+fi
+
+for driver in $(find ${BACKPORT_PWD} -type f -name *.ko); do
+       mod_name=${KLIB}${KMODDIR}/${driver}${compr}
+       echo "  uninstall" $mod_name
+       rm -f $mod_name
+done