]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
perf(90kernel-modules): use awk instead of shell monster
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Thu, 13 Oct 2022 16:14:53 +0000 (18:14 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Sat, 22 Oct 2022 13:08:07 +0000 (13:08 +0000)
~120ms -> ~2ms

Downstream: https://bugs.debian.org/1017411

modules.d/90kernel-modules/module-setup.sh

index 191af041b4dbb3d8a2714db255d021e210452633..566757bf36b8b4e906c84f86d7d6af5ae83c07ce 100755 (executable)
@@ -5,16 +5,6 @@ installkernel() {
     local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma|blk_mq_alloc_disk|blk_cleanup_disk'
     local -A _hostonly_drvs
 
-    find_kernel_modules_external() {
-        local a
-
-        [[ -f "$srcmods/modules.dep" ]] || return 0
-
-        while IFS=: read -r a _ || [[ $a ]]; do
-            [[ $a =~ ^/ ]] && printf "%s\n" "$a"
-        done < "$srcmods/modules.dep"
-    }
-
     record_block_dev_drv() {
 
         for _mod in $(get_dev_module /dev/block/"$1"); do
@@ -105,7 +95,7 @@ installkernel() {
                 "=drivers/scsi/hisi_sas"
         fi
 
-        find_kernel_modules_external | instmods
+        awk -F: '/^\// {print $1}' "$srcmods/modules.dep" 2> /dev/null | instmods
 
         # if not on hostonly mode, or there are hostonly block device
         # install block drivers