diff --git a/ieee80211/remove-old b/ieee80211/remove-old index 2441480..e22bbbd 100644 --- a/ieee80211/remove-old +++ b/ieee80211/remove-old @@ -1,12 +1,17 @@ #!/bin/sh -x +KERN=/lib/modules/`uname -r` if [ -z "$1" ]; then - KERN=/lib/modules/`uname -r`/build + if [ -d ${KERN}/source ]; then + KSRC=${KERN}/source + else + KSRC=${KERN}/build + fi else - KERN="$1" + KSRC="$1" fi -echo ${KERN} | grep "/\$" || KERN="${KERN}/" +echo ${KSRC} | grep "/\$" || KSRC="${KSRC}/" ask_comment() { @@ -19,10 +24,10 @@ ask_comment() ""|y) sed -i \ -e "s:^\(CONFIG_IEEE80211.*\):#\1:" \ - ${KERN}/.config || return 1 + ${KSRC}/.config || return 1 sed -i -r \ -e "s:^(#(un)?def.*CONFIG_IEEE80211.*):/*\1*/:" \ - ${KERN}/include/linux/autoconf.h || return 1 + ${KSRC}/include/linux/autoconf.h || return 1 return 0;; *) continue;; @@ -53,9 +58,9 @@ ask_remove() do_check() { - echo "Checking in ${1} for ieee80211 components..." + echo "Checking in ${KERN} for ieee80211 components..." - FILES=`find ${1} -type f -name 'ieee80211*'` + FILES=`find ${KERN} -type f -name 'ieee80211*'` if [ -n "${FILES}" ]; then for file in $FILES; do @@ -64,12 +69,12 @@ do_check() ask_remove || return 1 fi - ( egrep "^(CONFIG_IEEE80211.*)" ${1}/.config || \ + ( egrep "^(CONFIG_IEEE80211.*)" ${KSRC}/.config || \ egrep "^#(un)?def.*(CONFIG_IEEE80211.*)" \ - ${1}/include/linux/autoconf.h ) && \ + ${KSRC}/include/linux/autoconf.h ) && \ (ask_comment || return 1) return 0 } -do_check ${KERN} +do_check