Skip to content
Snippets Groups Projects
Commit d73d34e0 authored by Dave Reisner's avatar Dave Reisner
Browse files

error out if asked to extract a kver from image on non-x86

Version extraction only works on x86 (i686 and x86_64) kernels.

ref: https://bugs.archlinux.org/task/43256
parent 14487ea9
No related branches found
Tags v20
No related merge requests found
......@@ -49,8 +49,9 @@ Options
*-k, \--kernel* 'kernelversion'::
Use 'kernelversion', instead of the current running kernel. This may be a
path to a kernel image, a specific kernel version or the special keyword
'none'. In the latter case, no kernel modules are added to the image.
path to a kernel image (only supported for x86-based architectures), a specific
kernel version or the special keyword 'none'. In the latter case, no kernel
modules are added to the image.
*-L, \--listhooks*::
List all available hooks.
......
......@@ -85,7 +85,7 @@ cleanup() {
}
resolve_kernver() {
local kernel=$1 offset kver
local kernel=$1 arch= offset kver
if [[ -z $kernel ]]; then
uname -r
......@@ -97,6 +97,12 @@ resolve_kernver() {
return 0
fi
arch=$(uname -m)
if [[ $arch != @(i686|x86_64) ]]; then
error "kernel version extraction from image not supported for \`%s' architecture" "$arch"
return 1
fi
if [[ ! -e $kernel ]]; then
error "specified kernel image does not exist: \`%s'" "$kernel"
return 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment