File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,12 +26,21 @@ _cleanup_package_cache() {
2626
2727# Resolve the kernel version to the form major.minor.patch-revision-flavor where flavor defaults to generic.
2828_resolve_kernel_version () {
29+ echo " Resolving Linux kernel version..."
30+
31+ # If headers for the exact running kernel exist, use KERNEL_VERSION as-is.
32+ # This supports non-standard kernel naming (e.g. custom/distro kernels)
33+ # where the upstream version regex would fail.
34+ if apt-cache show " linux-headers-${KERNEL_VERSION} " > /dev/null 2>&1 ; then
35+ echo " Proceeding with Linux kernel version ${KERNEL_VERSION} "
36+ return 0
37+ fi
38+
2939 local version=$( apt-cache show " linux-headers-${KERNEL_VERSION} " 2> /dev/null | \
3040 sed -nE ' s/^Version:\s+(([0-9]+\.){2}[0-9]+)[-.]([0-9]+).*/\1-\3/p' | head -1)
3141 local kernel_flavor=$( echo ${KERNEL_VERSION} | sed ' s/[^a-z]*//' )
3242 kernel_flavor=" ${kernel_flavor// virtual/ generic} "
3343
34- echo " Resolving Linux kernel version..."
3544 if [ -z " ${version} " ]; then
3645 echo " Could not resolve Linux kernel version" >&2
3746 return 1
Original file line number Diff line number Diff line change @@ -29,12 +29,21 @@ _cleanup_package_cache() {
2929
3030# Resolve the kernel version to the form major.minor.patch-revision-flavor where flavor defaults to generic.
3131_resolve_kernel_version () {
32+ echo " Resolving Linux kernel version..."
33+
34+ # If headers for the exact running kernel exist, use KERNEL_VERSION as-is.
35+ # This supports non-standard kernel naming (e.g. custom/distro kernels)
36+ # where the upstream version regex would fail.
37+ if apt-cache show " linux-headers-${KERNEL_VERSION} " > /dev/null 2>&1 ; then
38+ echo " Proceeding with Linux kernel version ${KERNEL_VERSION} "
39+ return 0
40+ fi
41+
3242 local version=$( apt-cache show " linux-headers-${KERNEL_VERSION} " 2> /dev/null | \
3343 sed -nE ' s/^Version:\s+(([0-9]+\.){2}[0-9]+)[-.]([0-9]+).*/\1-\3/p' | head -1)
3444 local kernel_flavor=$( echo ${KERNEL_VERSION} | sed ' s/[^a-z]*//' )
3545 kernel_flavor=" ${kernel_flavor// virtual/ generic} "
3646
37- echo " Resolving Linux kernel version..."
3847 if [ -z " ${version} " ]; then
3948 echo " Could not resolve Linux kernel version" >&2
4049 return 1
Original file line number Diff line number Diff line change @@ -46,12 +46,21 @@ _update_ca_certificates() {
4646
4747# Resolve the kernel version to the form major.minor.patch-revision-flavor where flavor defaults to generic.
4848_resolve_kernel_version () {
49+ echo " Resolving Linux kernel version..."
50+
51+ # If headers for the exact running kernel exist, use KERNEL_VERSION as-is.
52+ # This supports non-standard kernel naming (e.g. custom/distro kernels)
53+ # where the upstream version regex would fail.
54+ if apt-cache show " linux-headers-${KERNEL_VERSION} " > /dev/null 2>&1 ; then
55+ echo " Proceeding with Linux kernel version ${KERNEL_VERSION} "
56+ return 0
57+ fi
58+
4959 local version=$( apt-cache show " linux-headers-${KERNEL_VERSION} " 2> /dev/null | \
5060 sed -nE ' s/^Version:\s+(([0-9]+\.){2}[0-9]+)[-.]([0-9]+).*/\1-\3/p' | head -1)
5161 local kernel_flavor=$( echo ${KERNEL_VERSION} | sed ' s/[^a-z]*//' )
5262 kernel_flavor=" ${kernel_flavor// virtual/ generic} "
5363
54- echo " Resolving Linux kernel version..."
5564 if [ -z " ${version} " ]; then
5665 echo " Could not resolve Linux kernel version" >&2
5766 return 1
Original file line number Diff line number Diff line change @@ -62,12 +62,21 @@ _update_ca_certificates() {
6262
6363# Resolve the kernel version to the form major.minor.patch-revision-flavor where flavor defaults to generic.
6464_resolve_kernel_version () {
65+ echo " Resolving Linux kernel version..."
66+
67+ # If headers for the exact running kernel exist, use KERNEL_VERSION as-is.
68+ # This supports non-standard kernel naming (e.g. custom/distro kernels)
69+ # where the upstream version regex would fail.
70+ if apt-cache show " linux-headers-${KERNEL_VERSION} " > /dev/null 2>&1 ; then
71+ echo " Proceeding with Linux kernel version ${KERNEL_VERSION} "
72+ return 0
73+ fi
74+
6575 local version=$( apt-cache show " linux-headers-${KERNEL_VERSION} " 2> /dev/null | \
6676 sed -nE ' s/^Version:\s+(([0-9]+\.){2}[0-9]+)[-.]([0-9]+).*/\1-\3/p' | head -1)
6777 local kernel_flavor=$( echo ${KERNEL_VERSION} | sed ' s/[^a-z]*//' )
6878 kernel_flavor=" ${kernel_flavor// virtual/ generic} "
6979
70- echo " Resolving Linux kernel version..."
7180 if [ -z " ${version} " ]; then
7281 echo " Could not resolve Linux kernel version" >&2
7382 return 1
Original file line number Diff line number Diff line change @@ -72,12 +72,21 @@ _update_ca_certificates() {
7272
7373# Resolve the kernel version to the form major.minor.patch-revision-flavor where flavor defaults to generic.
7474_resolve_kernel_version () {
75+ echo " Resolving Linux kernel version..."
76+
77+ # If headers for the exact running kernel exist, use KERNEL_VERSION as-is.
78+ # This supports non-standard kernel naming (e.g. custom/distro kernels)
79+ # where the upstream version regex would fail.
80+ if apt-cache show " linux-headers-${KERNEL_VERSION} " > /dev/null 2>&1 ; then
81+ echo " Proceeding with Linux kernel version ${KERNEL_VERSION} "
82+ return 0
83+ fi
84+
7585 local version=$( apt-cache show " linux-headers-${KERNEL_VERSION} " 2> /dev/null | \
7686 sed -nE ' s/^Version:\s+(([0-9]+\.){2}[0-9]+)[-.]([0-9]+).*/\1-\3/p' | head -1)
7787 local kernel_flavor=$( echo ${KERNEL_VERSION} | sed ' s/[^a-z]*//' )
7888 kernel_flavor=" ${kernel_flavor// virtual/ generic} "
7989
80- echo " Resolving Linux kernel version..."
8190 if [ -z " ${version} " ]; then
8291 echo " Could not resolve Linux kernel version" >&2
8392 return 1
Original file line number Diff line number Diff line change @@ -27,12 +27,21 @@ _cleanup_package_cache() {
2727
2828# Resolve the kernel version to the form major.minor.patch-revision-flavor where flavor defaults to generic.
2929_resolve_kernel_version () {
30+ echo " Resolving Linux kernel version..."
31+
32+ # If headers for the exact running kernel exist, use KERNEL_VERSION as-is.
33+ # This supports non-standard kernel naming (e.g. custom/distro kernels)
34+ # where the upstream version regex would fail.
35+ if apt-cache show " linux-headers-${KERNEL_VERSION} " > /dev/null 2>&1 ; then
36+ echo " Proceeding with Linux kernel version ${KERNEL_VERSION} "
37+ return 0
38+ fi
39+
3040 local version=$( apt-cache show " linux-headers-${KERNEL_VERSION} " 2> /dev/null | \
3141 sed -nE ' s/^Version:\s+(([0-9]+\.){2}[0-9]+)[-.]([0-9]+).*/\1-\3/p' | head -1)
3242 local kernel_flavor=$( echo ${KERNEL_VERSION} | sed ' s/[^a-z]*//' )
3343 kernel_flavor=" ${kernel_flavor// virtual/ generic} "
3444
35- echo " Resolving Linux kernel version..."
3645 if [ -z " ${version} " ]; then
3746 echo " Could not resolve Linux kernel version" >&2
3847 return 1
Original file line number Diff line number Diff line change @@ -29,12 +29,21 @@ _cleanup_package_cache() {
2929
3030# Resolve the kernel version to the form major.minor.patch-revision-flavor where flavor defaults to generic.
3131_resolve_kernel_version () {
32+ echo " Resolving Linux kernel version..."
33+
34+ # If headers for the exact running kernel exist, use KERNEL_VERSION as-is.
35+ # This supports non-standard kernel naming (e.g. custom/distro kernels)
36+ # where the upstream version regex would fail.
37+ if apt-cache show " linux-headers-${KERNEL_VERSION} " > /dev/null 2>&1 ; then
38+ echo " Proceeding with Linux kernel version ${KERNEL_VERSION} "
39+ return 0
40+ fi
41+
3242 local version=$( apt-cache show " linux-headers-${KERNEL_VERSION} " 2> /dev/null | \
3343 sed -nE ' s/^Version:\s+(([0-9]+\.){2}[0-9]+)[-.]([0-9]+).*/\1-\3/p' | head -1)
3444 local kernel_flavor=$( echo ${KERNEL_VERSION} | sed ' s/[^a-z]*//' )
3545 kernel_flavor=" ${kernel_flavor// virtual/ generic} "
3646
37- echo " Resolving Linux kernel version..."
3847 if [ -z " ${version} " ]; then
3948 echo " Could not resolve Linux kernel version" >&2
4049 return 1
Original file line number Diff line number Diff line change @@ -29,12 +29,21 @@ _cleanup_package_cache() {
2929
3030# Resolve the kernel version to the form major.minor.patch-revision-flavor where flavor defaults to generic.
3131_resolve_kernel_version () {
32+ echo " Resolving Linux kernel version..."
33+
34+ # If headers for the exact running kernel exist, use KERNEL_VERSION as-is.
35+ # This supports non-standard kernel naming (e.g. custom/distro kernels)
36+ # where the upstream version regex would fail.
37+ if apt-cache show " linux-headers-${KERNEL_VERSION} " > /dev/null 2>&1 ; then
38+ echo " Proceeding with Linux kernel version ${KERNEL_VERSION} "
39+ return 0
40+ fi
41+
3242 local version=$( apt-cache show " linux-headers-${KERNEL_VERSION} " 2> /dev/null | \
3343 sed -nE ' s/^Version:\s+(([0-9]+\.){2}[0-9]+)[-.]([0-9]+).*/\1-\3/p' | head -1)
3444 local kernel_flavor=$( echo ${KERNEL_VERSION} | sed ' s/[^a-z]*//' )
3545 kernel_flavor=" ${kernel_flavor// virtual/ generic} "
3646
37- echo " Resolving Linux kernel version..."
3847 if [ -z " ${version} " ]; then
3948 echo " Could not resolve Linux kernel version" >&2
4049 return 1
You can’t perform that action at this time.
0 commit comments