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
---
mkinitcpio | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/mkinitcpio b/mkinitcpio
index 5303f2d..e8ec413 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -219,6 +219,9 @@ process_preset() {
}
install_modules() {
+ local m
+ 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
@@ -227,7 +230,18 @@ install_modules() {
cp "$@" "$BUILDROOT/lib/modules/$KERNELVERSION/kernel"
# unzip modules prior to recompression
- gzip -dr "$BUILDROOT/lib/modules/$KERNELVERSION/kernel"
+ for m in "$@"; do
+ case ${m##*.} in
+ xz)
+ xz_comp+=("$BUILDROOT/lib/modules/$KERNELVERSION/kernel/${m##*/}")
+ ;;
+ gz)
+ gz_comp+=("$BUILDROOT/lib/modules/$KERNELVERSION/kernel/${m##*/}")
+ ;;
+ esac
+ done
+ (( ${#xz_comp[*]} )) && xz -dr "${xz_comp[@]}"
+ (( ${#gz_comp[*]} )) && gzip -dr "${gz_comp[@]}"
msg "Generating module dependencies"
install -m644 -t "$BUILDROOT/lib/modules/$KERNELVERSION" \
--
1.8.0