summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-11-23 21:31:56 +0100
committerDave Reisner <dreisner@archlinux.org>2012-11-26 02:08:57 +0100
commitd64243de39f6d76edf8150b1d81d586345758fed (patch)
tree10a0b775736b1889bfeabf1990e653a47d4c875f
parent91ea008b715fb6697517e678e5e1b13971a76157 (diff)
downloadmkinitcpio-d64243de39f6d76edf8150b1d81d586345758fed.tar.gz
mkinitcpio-d64243de39f6d76edf8150b1d81d586345758fed.tar.xz
selectively decompress modules on install
Don't make any assumptions about the compression on modules and scan the passed in module list for telltale extensions. This has the benefit of doing nothing when modules are uncompressed, and adds support for decompression of XZ modules. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rwxr-xr-xmkinitcpio25
1 files changed, 19 insertions, 6 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 5303f2d..7c75572 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -219,31 +219,44 @@ process_preset() {
}
install_modules() {
+ local m moduledest=$BUILDROOT/lib/modules/$KERNELVERSION
+ local -a xz_comp gz_comp
+
if (( $# == 0 )); then
warning "No modules were added to the image. This is probably not what you want."
return 0
fi
- cp "$@" "$BUILDROOT/lib/modules/$KERNELVERSION/kernel"
+ cp "$@" "$moduledest/kernel"
# unzip modules prior to recompression
- gzip -dr "$BUILDROOT/lib/modules/$KERNELVERSION/kernel"
+ for m in "$@"; do
+ case $m in
+ *.xz)
+ xz_comp+=("$moduledest/kernel/${m##*/}")
+ ;;
+ *.gz)
+ gz_comp+=("$moduledest/kernel/${m##*/}")
+ ;;
+ esac
+ done
+ (( ${#xz_comp[*]} )) && xz -d "${xz_comp[@]}"
+ (( ${#gz_comp[*]} )) && gzip -d "${gz_comp[@]}"
msg "Generating module dependencies"
- install -m644 -t "$BUILDROOT/lib/modules/$KERNELVERSION" \
- "$_d_kmoduledir"/modules.builtin
+ install -m644 -t "$moduledest" "$_d_kmoduledir"/modules.builtin
# we install all modules into kernel/, making the .order file incorrect for
# the module tree. munge it, so that we have an accurate index. This avoids
# some rare and subtle issues with module loading choices when an alias
# resolves to multiple modules, only one of which can claim a device.
awk -F'/' '{ print "kernel/" $NF }' \
- "$_d_kmoduledir"/modules.order >"$BUILDROOT/lib/modules/$KERNELVERSION/modules.order"
+ "$_d_kmoduledir"/modules.order >"$moduledest/modules.order"
depmod -b "$BUILDROOT" "$KERNELVERSION"
# remove all non-binary module.* files (except devname for on-demand module loading)
- rm "$BUILDROOT/lib/modules/$KERNELVERSION"/modules.!(*.bin|devname)
+ rm "$moduledest"/modules.!(*.bin|devname)
}
. "$_f_functions"