[PATCH] backports: re-introduce make uninstall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Re-introducing make uninstall. It works, but feel more than welcome to
tidy it up.

Signed-off-by: Felix Bitterli <ic.felix@xxxxxxxxx>
---
 backport/Makefile.real        |   10 ++++++++++
 backport/scripts/uninstall.sh |   26 ++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100755 backport/scripts/uninstall.sh

diff --git a/backport/Makefile.real b/backport/Makefile.real
index 2a1f640..40d91bd 100644
--- a/backport/Makefile.real
+++ b/backport/Makefile.real
@@ -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
diff --git a/backport/scripts/uninstall.sh b/backport/scripts/uninstall.sh
new file mode 100755
index 0000000..4deb7c1
--- /dev/null
+++ b/backport/scripts/uninstall.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+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")
+}
+
+if test "$(mod_filename mac80211)" = "mac80211.ko.gz" ; then
+    compr=".ko"
+else
+    compr=""
+fi
+
+for driver in $(find -type f -name *.ko); do
+    mod_name=$KLIB"updates/"$driver$compr
+    rm -f $mod_name
+done
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux