remove-old

来自「intelWiFi 芯片linux下 802.11 driver」· 代码 · 共 117 行

TXT
117
字号
#!/bin/sh -xKERN=/lib/modules/`uname -r`if [ -z "$1" ]; then	if [ -d ${KERN}/source ]; then		KSRC=${KERN}/source	else		KSRC=${KERN}/build	fielse	KSRC="$1"fiecho ${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 ${KERN} ${KSRC} -follow -type f -name \			'ieee80211[_.]*' | grep -v mac80211 | \			grep -v 'include/linux/ieee80211.h' | \			grep -v 'include/config' | \			grep -v d80211 |			while read fn; do				[ ! -d $fn ] && (rm -f ${fn} || return 1)			done || return 1			return 0;;		*) continue;;                esac	done || return 1}ask_strip(){        while true; do		echo -n "ieee80211 symbols are found from $1. Do you want to strip them? [y],n "		read REPLY        	case ${REPLY} in		n) return 1;;		""|y)	sed -i -e 's:^.*net/ieee80211/ieee80211.*::' $1 || return 1			sed -i '/^$/d' $1 || return 1			return 0;;		*) continue;;                esac	done || return 1}do_check(){	echo -n "Checking in ${KERN} "	if [ ${KERN} != `dirname ${KSRC}` ]; then		echo -n "and ${KSRC} "	fi	echo "for ieee80211 components..."	FILES=`find ${KERN} ${KSRC} -follow -type f -name \	'ieee80211[_.]*' |grep -v mac80211 | grep -v \	'include/linux/ieee80211.h' | grep -v 'include/config/' | \	grep -v d80211`	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)	FILE=`find ${KSRC} -type f -name Module.symvers`	if [ -n "${FILE}" ]; then		egrep -q "^.*net/ieee80211/ieee80211.*" ${FILE} || return 0		ask_strip ${FILE} || return 1	fi	return 0}do_check

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?