summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-02-20 03:07:08 +0100
committerDave Reisner <dreisner@archlinux.org>2012-02-20 03:27:13 +0100
commit838ffa831dca80e5578df0de9d6ac67d903c58c7 (patch)
tree02ef4dce795e8f4cafe893b1527e8c6dde6083b5
parent914d5b391105a40945a6f88911cf95a701e1c68c (diff)
downloadmkinitcpio-838ffa831dca80e5578df0de9d6ac67d903c58c7.tar.gz
mkinitcpio-838ffa831dca80e5578df0de9d6ac67d903c58c7.tar.xz
lsinitcpio: detect kver separate from modules
mkinitcpio will always create /lib/modules/$kernver/kernel in the image, so we can use this to detect the kernel the image was built for, even if the image contains no modules. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rwxr-xr-xlsinitcpio10
1 files changed, 4 insertions, 6 deletions
diff --git a/lsinitcpio b/lsinitcpio
index 37d2764..0fc8c67 100755
--- a/lsinitcpio
+++ b/lsinitcpio
@@ -98,13 +98,11 @@ if (( analyze )); then
# read contents of image
while read -r line; do
- if [[ $line = *.ko?(.gz) ]]; then # module
- if [[ -z $kernver ]]; then
- [[ $line =~ /lib/modules/([^/]+)/ ]] && kernver=${BASH_REMATCH[1]}
- fi
+ if [[ $line = *.ko?(.?z) ]]; then
line=${line##*/}
- modules+=("${line%.ko?(.gz)}")
- continue
+ modules+=("${line%.ko?(.?z)}")
+ elif [[ -z $kernver && $line =~ /lib/modules/([^/]+)/ ]]; then
+ kernver=${BASH_REMATCH[1]}
elif [[ $line = ./hooks/* ]]; then
foundhooks+=("${line##*/}")
elif [[ $line = *@(/bin/|/sbin/)* ]]; then