summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-12-30 19:22:51 +0100
committerDave Reisner <dreisner@archlinux.org>2013-05-07 19:17:52 +0200
commit2e4666a3c0c69e4f8ff5d8533893c7b6f15d5414 (patch)
tree122fd8760591e716bcbcb9aefc91e2cef097cb0b
parent601aab2477f5cb6fc3298216625b9804d6a18dad (diff)
downloadmkinitcpio-2e4666a3c0c69e4f8ff5d8533893c7b6f15d5414.tar.gz
mkinitcpio-2e4666a3c0c69e4f8ff5d8533893c7b6f15d5414.tar.xz
move install_modules to functions to allow for testing
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r--functions41
-rwxr-xr-xmkinitcpio41
2 files changed, 41 insertions, 41 deletions
diff --git a/functions b/functions
index 43e3b7d..8a4e3be 100644
--- a/functions
+++ b/functions
@@ -719,4 +719,45 @@ try_enable_color() {
fi
}
+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 "$@" "$moduledest/kernel"
+
+ # unzip modules prior to recompression
+ 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 "$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 >"$moduledest/modules.order"
+
+ depmod -b "$BUILDROOT" "$KERNELVERSION"
+
+ # remove all non-binary module.* files (except devname for on-demand module loading)
+ rm "$moduledest"/modules.!(*.bin|devname)
+}
+
# vim: set ft=sh ts=4 sw=4 et:
diff --git a/mkinitcpio b/mkinitcpio
index f698198..6e03635 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -291,47 +291,6 @@ process_preset() (
exit $ret
)
-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 "$@" "$moduledest/kernel"
-
- # unzip modules prior to recompression
- 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 "$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 >"$moduledest/modules.order"
-
- depmod -b "$BUILDROOT" "$KERNELVERSION"
-
- # remove all non-binary module.* files (except devname for on-demand module loading)
- rm "$moduledest"/modules.!(*.bin|devname)
-}
-
. "$_f_functions"
trap 'cleanup 130' INT