#!/bin/bash
resolution_kernel(){
local info=`dpkg -l | grep $1 | grep linux-image-`uname -r` | awk '{printf "%s\n",$3}'`
echo "$1 经过匹配后的信息是:"
if realpath /lib/modules/$1/build/Kbuild|grep hwe; then
echo "判断结果是:"
echo "$1 是 hwe 内核!"
else
echo "$info" >> result/logic.log
echo $info | grep -E '^[0-9]+[.][0-9]+[.][0-9]+-[0-9]+[.][0-9]+.*+[0-9][.]+(04|10).*'
[ $? -eq 0 ] && echo "判断结果是:/n$1 是 hwe 内核!" || echo "判断结果是:/n$1 是 ga 内核!"
fi
}
#for test in `ls /lib/modules`
#do
# resolution_kernel $test
#done
test=`uname -r`
resolution_kernel $test