Skip to content

Commit 692a91e

Browse files
committed
Make retrieve of kernel version more robust
Closes #214
1 parent 42eaafc commit 692a91e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

build/init/fetch-linux-headers.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ fetch_generic_linux_sources()
3939
# 4.19.76-linuxkit -> 4.19.76
4040
# 4.14.154-128.181.amzn2.x86_64 -> 4.14.154
4141
# 4.19.76+gcp-something -> 4.19.76
42-
kernel_version="$(echo "${KERNEL_VERSION}" | awk -vFS='[-+]' '{ print $1 }')"
43-
major_version="$(echo "${KERNEL_VERSION}" | awk -vFS=. '{ print $1 }')"
42+
# 6.6.87.2-microsoft-standard-WSL2 -> 6.6.87
43+
raw_kernel_version="$(echo "${KERNEL_VERSION}" | awk -vFS='[-+]' '{ print $1 }')"
44+
kernel_version="$(echo "${raw_kernel_version}" | awk -vFS=. '{ print $1 "." $2 "." $3 }')"
45+
major_version="$(echo "${raw_kernel_version}" | awk -vFS=. '{ print $1 }')"
4446

4547
# Remove the '.0' as the initial kernel major release isn't published with a patch number.
4648
if [[ $kernel_version == *.0 ]]; then

0 commit comments

Comments
 (0)