diff options
author | Dave Reisner <dreisner@archlinux.org> | 2012-05-11 23:21:36 +0200 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2012-05-18 15:39:04 +0200 |
commit | b7c1887306c1067984b5e5b564f25a12631b8162 (patch) | |
tree | 9c8320a2f99da70ce539d744e3c047f22a0ca33b | |
parent | 261b731e8fb918309f2740b5262d9678378491fa (diff) | |
download | mkinitcpio-b7c1887306c1067984b5e5b564f25a12631b8162.tar.gz mkinitcpio-b7c1887306c1067984b5e5b564f25a12631b8162.tar.xz |
use new API for install hooks
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r-- | functions | 2 | ||||
-rw-r--r-- | install/consolefont | 6 | ||||
-rw-r--r-- | install/filesystems | 4 | ||||
-rw-r--r-- | install/fw | 8 | ||||
-rw-r--r-- | install/ide | 4 | ||||
-rw-r--r-- | install/keymap | 4 | ||||
-rw-r--r-- | install/memdisk | 9 | ||||
-rw-r--r-- | install/mmc | 7 | ||||
-rw-r--r-- | install/pata | 6 | ||||
-rw-r--r-- | install/resume | 2 | ||||
-rw-r--r-- | install/sata | 6 | ||||
-rw-r--r-- | install/scsi | 9 | ||||
-rw-r--r-- | install/shutdown | 7 | ||||
-rw-r--r-- | install/sleep | 2 | ||||
-rw-r--r-- | install/usb | 12 | ||||
-rw-r--r-- | install/usbinput | 5 | ||||
-rw-r--r-- | install/virtio | 2 |
17 files changed, 49 insertions, 46 deletions
@@ -219,7 +219,7 @@ all_modules() { mod=${mod##*/} mod="${mod%.ko*}" printf '%s\n' "${mod//-/_}" - done < <(find "$MODULEDIR" -name '*.ko*' -print0 2>/dev/null | grep -Zz "$@") + done < <(find "$MODULEDIR" -name '*.ko*' -print0 2>/dev/null | grep -EZz "$@") (( count )) } diff --git a/install/consolefont b/install/consolefont index cefbc45..8127502 100644 --- a/install/consolefont +++ b/install/consolefont @@ -1,8 +1,6 @@ #!/bin/bash build() { - local file ext - # subshell to avoid namespace pollution ( for cfg in /etc/{rc,vconsole}.conf; do @@ -29,9 +27,7 @@ build() { warning "consolefont: no font found in configuration" exit 1 fi - ) - - (( $? == 0 )) && SCRIPT=consolefont + ) && add_runscript } help() { diff --git a/install/filesystems b/install/filesystems index 9230b94..162768a 100644 --- a/install/filesystems +++ b/install/filesystems @@ -2,9 +2,9 @@ build() { if (( fs_autodetect_failed )); then - MODULES=$(all_modules '/kernel/fs' | grep -v "nls") + add_all_modules -f 'nls' '/kernel/fs' else - MODULES=$(checked_modules '/kernel/fs' | grep -v "nls") + add_checked_modules -f 'nls' '/kernel/fs' fi } @@ -1,9 +1,13 @@ #!/bin/bash build() { - MODULES=$(checked_modules "/drivers/firewire/") + local mod - [[ $MODULES ]] && MODULES+=" firewire-sbp2? sd_mod? sr_mod?" + if add_checked_modules '/drivers/firewire/'; then + for mod in firewire-sbp2 sd_mod sr_mod; do + add_module "$mod?" + done + fi } help() { diff --git a/install/ide b/install/ide index a8d9e97..5531132 100644 --- a/install/ide +++ b/install/ide @@ -1,9 +1,7 @@ #!/bin/bash build() { - MODULES="$(checked_modules "/ide/" | grep -v "legacy")" - - [[ $MODULES ]] && MODULES+=" ide-gd_mod?" + add_checked_modules "/ide/" && add_module "ide-gd_mod?" } help() { diff --git a/install/keymap b/install/keymap index 1dc25aa..99b816a 100644 --- a/install/keymap +++ b/install/keymap @@ -24,9 +24,7 @@ build() { warning "keymap: hook specified, but no KEYMAP found in configuration" return 1 fi - ) - - (( $? == 0 )) && SCRIPT=keymap + ) && add_runscript } help() { diff --git a/install/memdisk b/install/memdisk index b0d03f3..9b3577d 100644 --- a/install/memdisk +++ b/install/memdisk @@ -1,10 +1,13 @@ #!/bin/bash build() { - MODULES="phram mtdblock" - BINARIES="/usr/bin/memdiskfind" - SCRIPT="memdisk" + add_module 'phram' + add_module 'mtdblock' + add_file /usr/lib/initcpio/udev/01-memdisk.rules /lib/udev/rules.d/01-memdisk.rules + add_binary "memdiskfind" + + add_runscript } help() { diff --git a/install/mmc b/install/mmc index fb89239..60068df 100644 --- a/install/mmc +++ b/install/mmc @@ -1,10 +1,9 @@ #!/bin/bash build() { - MODULES=$(checked_modules "/mmc") - - if [[ $MODULES ]]; then - MODULES+=" tifm_7xx1 mmc_block" + if add_checked_modules '/mmc'; then + add_module 'tifm_7xx1' + add_module 'mmc_block' fi } diff --git a/install/pata b/install/pata index 76f268c..bcf3809 100644 --- a/install/pata +++ b/install/pata @@ -1,11 +1,13 @@ #!/bin/bash build() { + local filter added + for filter in 'ata/pata_*' 'ata/ata_generic' 'ata/ata_piix'; do - MODULES+=" $(checked_modules "$filter")" + add_checked_modules "$filter" && (( ++added )) done - [[ $MODULES ]] && MODULES+=" sd_mod?" + (( added )) && add_module "sd_mod?" } help() { diff --git a/install/resume b/install/resume index d261aad..914bca2 100644 --- a/install/resume +++ b/install/resume @@ -1,7 +1,7 @@ #!/bin/bash build() { - SCRIPT="resume" + add_runscript } help() { diff --git a/install/sata b/install/sata index c9b67c3..c6a2ade 100644 --- a/install/sata +++ b/install/sata @@ -1,12 +1,14 @@ #!/bin/bash build() { + local filter added + for filter in 'scsi/.*ata' 'block/sx8' 'ata/sata_*' \ 'ata/ahci' 'ata/pdc_adma' 'ata/ata_piix'; do - MODULES+=" $(checked_modules "$filter")" + add_checked_modules "$filter" && (( ++added )) done - [[ $MODULES ]] && MODULES+=" sd_mod?" + (( added )) && add_module "sd_mod?" } help() { diff --git a/install/scsi b/install/scsi index 4c2abc5..7c5a771 100644 --- a/install/scsi +++ b/install/scsi @@ -1,12 +1,13 @@ #!/bin/bash build(){ + local filter added - MODULES="$(checked_modules "/scsi/" | grep -vE '(imm|ata|pcmcia)') - $(checked_modules "/block/" | grep -E '(cciss|cpqarray|DAC960)') - $(checked_modules "/fusion/")" + add_checked_modules -f '(imm|ata|pcmcia)' '/scsi/' && (( ++added )) + add_checked_modules -f '(cciss|cpqarray|DAC960)' '/block/' && (( ++added )) + add_checked_modules '/fusion/' && (( ++added )) - [[ $MODULES ]] && MODULES+=" sd_mod?" + (( added )) && add_module 'sd_mod?' } help() { diff --git a/install/shutdown b/install/shutdown index 600209e..e9a5d93 100644 --- a/install/shutdown +++ b/install/shutdown @@ -1,10 +1,11 @@ #!/bin/bash build() { - BINARIES='cp lsblk' - SCRIPT='shutdown' - + add_binary cp + add_binary lsblk add_file "/usr/lib/initcpio/shutdown" "/shutdown" + + add_runscript } help() { diff --git a/install/sleep b/install/sleep index b81e1ca..c2bdcab 100644 --- a/install/sleep +++ b/install/sleep @@ -1,7 +1,7 @@ #!/bin/bash build() { - SCRIPT="sleep" + add_runscript } help() { diff --git a/install/usb b/install/usb index fcb2a47..2b36c35 100644 --- a/install/usb +++ b/install/usb @@ -1,13 +1,11 @@ #!/bin/bash build() { - local module= - - MODULES="$(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")" - - if [[ $MODULES ]]; then - MODULES+=" usb_storage? sd_mod? sr_mod?" - MODULES+=" $(checked_modules "drivers/usb/storage/ums-*")" + if add_checked_modules -f '(_cs|sl811_hcd|isp116x_hcd)' '/usb/host'; then + add_module 'usb_storage?' + add_module 'sd_mod?' + add_module 'sr_mod?' + add_checked_modules 'drivers/usb/storage/ums-*' fi } diff --git a/install/usbinput b/install/usbinput index f89d0bd..f427600 100644 --- a/install/usbinput +++ b/install/usbinput @@ -1,8 +1,9 @@ #!/bin/bash build() { - MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")" - MODULES+=" $(all_modules "/hid/hid-") usbhid?" + add_checked_modules -f '(_cs|sl811_hcd|isp116x_hcd)' '/usb/host' + add_all_modules '/hid/hid-' + add_module 'usbhid?' } help() { diff --git a/install/virtio b/install/virtio index 0343e9f..10037ab 100644 --- a/install/virtio +++ b/install/virtio @@ -1,7 +1,7 @@ #!/bin/bash build() { - MODULES="$(checked_modules 'virtio_\(blk\|pci\)')" + add_checked_modules 'virtio_(blk|pci)' } help() { |