From: Roger Shimizu <rosh@debian.org>
Date: Fri, 17 Apr 2020 00:08:34 +0900
Subject: Parse KERNELRELEASE into VERSION, PATCHLEVEL, and SUBLEVEL

This fixes build error message:
====
/bin/sh: 1: [: Illegal number:
/bin/sh: 1: [: Illegal number:
Wireless Extension is the only possible API for this kernel version
Using Wireless Extension API
====

Closes: #886512
---
 Makefile | 4 ++++
 1 files changed, 4 insertions(+)

diff --git a/amd64/Makefile b/amd64/Makefile
index 994a146..ed16dfc 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,10 @@
 
 ifneq ($(KERNELRELEASE),)
 
+  VERSION := $(shell echo $(KERNELRELEASE) | sed -e 's/\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\(.*\)/\1/')
+  PATCHLEVEL := $(shell echo $(KERNELRELEASE) | sed -e 's/\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\(.*\)/\2/')
+  SUBLEVEL := $(shell echo $(KERNELRELEASE) | sed -e 's/\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\(.*\)/\3/')
+
   LINUXVER_GOODFOR_CFG80211:=$(strip $(shell \
     if [ "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge "32" -o "$(VERSION)" -ge "3" ]; then \
       echo TRUE; \
