add an cmd line option for choosing compile with compatible kernel; clean up more when uninstalling

This commit is contained in:
KillingJacky 2020-04-27 07:58:47 +01:00 committed by turmary
parent b83519eb82
commit 901b451bd5

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
FORCE_KERNEL="1.20190925+1-1" FORCE_KERNEL="1.20200819-1"
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root (use sudo)" 1>&2 echo "This script must be run as root (use sudo)" 1>&2
@ -115,6 +115,14 @@ function download_install_debpkg() {
return $r return $r
} }
option_pattern="compat-kernel"
if [[ $1 =~ ${option_pattern} ]]; then
echo "will compile with a compatible kernel..."
else
FORCE_KERNEL=""
echo "will compile with the latest kernel..."
fi
function install_kernel() { function install_kernel() {
local _url _prefix local _url _prefix
@ -181,6 +189,10 @@ function install_module {
for _i in $kernels; do for _i in $kernels; do
dkms build -k $_i -m $mod -v $ver && { dkms build -k $_i -m $mod -v $ver && {
dkms install --force -k $_i -m $mod -v $ver dkms install --force -k $_i -m $mod -v $ver
} || {
echo "Can't compile with this kernel, aborting"
echo "Please try to compile with the option --compat-kernel"
exit 1
} }
done done