diff options
author | Dave Reisner <dreisner@archlinux.org> | 2016-07-02 21:18:11 +0200 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2016-07-02 21:18:11 +0200 |
commit | d73d34e017ecb0e89c2de8e39da6b14afd6c5f1c (patch) | |
tree | e28dcd95896506fab521243fa71a8aba0d455f97 | |
parent | 14487ea9a6104c17b00c6fa7bcb65c617c7490c8 (diff) | |
download | mkinitcpio-20.tar.gz mkinitcpio-20.tar.xz |
error out if asked to extract a kver from image on non-x86v20
Version extraction only works on x86 (i686 and x86_64) kernels.
ref: https://bugs.archlinux.org/task/43256
-rw-r--r-- | man/mkinitcpio.8.txt | 5 | ||||
-rwxr-xr-x | mkinitcpio | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/man/mkinitcpio.8.txt b/man/mkinitcpio.8.txt index 05d71c4..2f1bb84 100644 --- a/man/mkinitcpio.8.txt +++ b/man/mkinitcpio.8.txt @@ -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 |