From: ASIC Felix Date: Fri, 21 Jun 2013 05:02:52 +0000 (-0700) Subject: backports: re-introduce make uninstall X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3740976137324d70c15e140302c7acd08b54652b;p=openwrt%2Fstaging%2Fblogic.git backports: re-introduce make uninstall 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 [mcgrof: extended the commit log a bit] Signed-off-by: Luis R. Rodriguez --- diff --git a/backport/Makefile.real b/backport/Makefile.real index 2a1f640fbe04..c09663c32ac2 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/compress_modules.sh b/backport/scripts/compress_modules.sh index bbf264f4e677..b2034c2c4b46 100755 --- a/backport/scripts/compress_modules.sh +++ b/backport/scripts/compress_modules.sh @@ -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 index 000000000000..0845b3e3a047 --- /dev/null +++ b/backport/scripts/mod_helpers.sh @@ -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 index 000000000000..99f74ab1a0a7 --- /dev/null +++ b/backport/scripts/uninstall.sh @@ -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