summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-01 18:07:46 +0200
committerDave Reisner <dreisner@archlinux.org>2011-07-02 04:15:24 +0200
commit491a99b8a2531207121d651d8e4b15fe4febbd2b (patch)
treee0c0634bcfa15bc2facc415ddbd1ff644d8f4d46
parent3d42f00ecb01206e27640a40616ca51c71153624 (diff)
downloadmkinitcpio-491a99b8a2531207121d651d8e4b15fe4febbd2b.tar.gz
mkinitcpio-491a99b8a2531207121d651d8e4b15fe4febbd2b.tar.xz
install modules all at once
build an array of paths to modules, and install them all at once with mkdir -p and cp --parents. Cuts back on our major source of calls to install(1). This is a tad ugly in that it creates some amount of data duplication, keeping an array of paths in addition to module names. However, turns out to be a worthwhile tradeoff as merging the two datasets into one results in the need for massive string trimming.
-rw-r--r--functions3
-rwxr-xr-xmkinitcpio5
2 files changed, 6 insertions, 2 deletions
diff --git a/functions b/functions
index 314748f..ac7da7e 100644
--- a/functions
+++ b/functions
@@ -167,7 +167,8 @@ add_module() {
return 1
fi
- _add_file "${path#$BASEDIR}" "$path" 644
+ # aggregate modules and add them all at once to save some forks
+ MODPATHS+=("$path")
ADDED_MODULES+=("${module//-/_}")
# explicit module depends
diff --git a/mkinitcpio b/mkinitcpio
index fb705e1..dec139b 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -25,7 +25,7 @@ COMPRESSION=gzip
declare TMPDIR BASEDIR MODULE_FILE GENIMG PRESET COMPRESSION_OPTIONS BUILDROOT
declare NC= BOLD= BLUE= GREEN= RED= YELLOW=
declare -i QUIET=1 SHOW_AUTOMODS=0 SAVELIST=0 COLOR=1
-declare -a SKIPHOOKS ADDED_MODULES
+declare -a SKIPHOOKS ADDED_MODULES MODPATHS
# Add /{,usr}/sbin to path
# works around undetected problems like in #8448
@@ -323,6 +323,9 @@ set +E
trap ERR
if (( ${#ADDED_MODULES[*]} )); then
+ mkdir -p "${MODPATHS[@]%/*}"
+ cp --parents "${MODPATHS[@]}" "$BUILDROOT"
+
msg "Generating module dependencies"
/sbin/depmod -b "${TMPDIR}/root" "${KERNELVERSION}"
rm "$BUILDROOT/lib/modules/$KERNELVERSION"/modules.!(dep.bin|alias.bin|symbols.bin)