#!/bin/sh -x KERN=/lib/modules/`uname -r` if [ -z "$1" ]; then if [ -d ${KERN}/source ]; then KSRC=${KERN}/source else KSRC=${KERN}/build fi else KSRC="$1" fi echo ${KSRC} | grep "/\$" || KSRC="${KSRC}/" ask_comment() { while true; do echo -n "Above definitions found. Comment out? [y], n " read REPLY case ${REPLY} in n) return 1;; ""|y) sed -i \ -e "s:^\(CONFIG_IEEE80211.*\):#\1:" \ ${KSRC}/.config || return 1 sed -i -r \ -e "s:^(#(un)?def.*CONFIG_IEEE80211.*):/*\1*/:" \ ${KSRC}/include/linux/autoconf.h || return 1 return 0;; *) continue;; esac done || return 1 } ask_remove() { while true; do echo -n "Above files found. Remove? [y],n " read REPLY case ${REPLY} in n) return 1;; ""|y) find ${KSRC} -follow -type f -name 'ieee80211*' | \ while read fn; do [ ! -d $fn ] && (rm -f ${fn} || return 1) done || return 1 return 0;; *) continue;; esac done || return 1 } do_check() { echo "Checking in ${KSRC} for ieee80211 components..." FILES=`find ${KSRC} -follow -type f -name 'ieee80211*'` if [ -n "${FILES}" ]; then for file in $FILES; do echo "${file}" done ask_remove || return 1 fi ( egrep "^(CONFIG_IEEE80211.*)" ${KSRC}/.config || \ egrep "^#(un)?def.*(CONFIG_IEEE80211.*)" \ ${KSRC}/include/linux/autoconf.h ) && \ (ask_comment || return 1) return 0 } do_check