summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-06-08 22:29:40 +0200
committerThomas Bächler <thomas@archlinux.org>2011-06-25 12:25:45 +0200
commit99c2b87cdbc3f449b68ed6d0bf2fec624d539972 (patch)
tree8acc5152c4ce01a22d13a6c9e6b3544c63ed5d25
parent733afaaa9c52e55d047d5e6a5d689131e1fde3e6 (diff)
downloadmkinitcpio-99c2b87cdbc3f449b68ed6d0bf2fec624d539972.tar.gz
mkinitcpio-99c2b87cdbc3f449b68ed6d0bf2fec624d539972.tar.xz
install/{sata,pata,scsi}: cleanup and simplify
* Use loops where possible for module addition * remove superfluous trim operation * remove antiquated filters for modules which do not exist Signed-off-by: Dave Reisner <d@falconindy.com>
-rw-r--r--install/pata33
-rw-r--r--install/sata35
-rw-r--r--install/scsi33
3 files changed, 41 insertions, 60 deletions
diff --git a/install/pata b/install/pata
index 1d750dc..75a75c1 100644
--- a/install/pata
+++ b/install/pata
@@ -1,26 +1,19 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=" $(checked_modules "ata/pata_*") $(checked_modules "ata/ata_generic")
- $(checked_modules "ata/ata_piix")"
+build() {
+ for filter in 'ata/pata_*' 'ata/ata_generic' 'ata/ata_piix'; do
+ MODULES+=" $(checked_modules "$filter")"
+ done
- MODULES=$(echo ${MODULES}) #trim whitespace
- if [ -n "${MODULES}" ]; then
- MODULES="${MODULES} sd_mod"
- fi
-
- BINARIES=""
- FILES=""
- SCRIPT=""
+ [[ $MODULES ]] && MODULES+=" sd_mod"
}
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for a pata (ide) root device,
- using the new libata subsystem.
- Detection will take place at runtime. To minimize the modules
- in the image, add the autodetect hook too.
+help() {
+ cat<<HELPEOF
+This hook loads the necessary modules for a pata (ide) root device, using the
+new libata subsystem. Detection will take place at runtime. To minimize the
+modules in the image, add the autodetect hook too.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/sata b/install/sata
index cbd2db2..1b39d5f 100644
--- a/install/sata
+++ b/install/sata
@@ -1,27 +1,20 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=" $(checked_modules "scsi/.*ata") $(checked_modules "block/sx8")
- $(checked_modules "scsi/ahci") $(checked_modules "scsi/pdc_adma")
- $(checked_modules "ata/sata_*") $(checked_modules "ata/ahci")
- $(checked_modules "ata/pdc_adma") $(checked_modules "ata/ata_piix")"
+build() {
+ for filter in 'scsi/.*ata' 'block/sx8' 'ata/sata_*' \
+ 'ata/ahci' 'ata/pdc_adma' 'ata/ata_piix'; do
+ MODULES+=" $(checked_modules "$filter")"
+ done
- MODULES=$(echo ${MODULES}) #trim whitespace
- if [ -n "${MODULES}" ]; then
- MODULES="${MODULES} sd_mod"
- fi
-
- BINARIES=""
- FILES=""
- SCRIPT=""
+ [[ $MODULES ]] && MODULES+=" sd_mod"
}
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for an sata root device.
- Detection will take place at runtime. To minimize the modules
- in the image, add the autodetect hook too.
+help() {
+ cat<<HELPEOF
+This hook loads the necessary modules for an sata root device. Detection will
+take place at runtime. To minimize the modules in the image, add the autodetect
+hook too.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/scsi b/install/scsi
index 9a97a8c..2641255 100644
--- a/install/scsi
+++ b/install/scsi
@@ -1,25 +1,20 @@
-# vim: set ft=sh:
+#!/bin/bash
-build()
-{
- MODULES=" $(checked_modules "/scsi/" | grep -ve "imm" -e "pdc_adma" -e "ahci" -e "ata" -e "pcmcia" -e "ide")
- $(checked_modules "/block/" | grep -e "cciss" -e "cpqarray" -e "DAC960")
- $(checked_modules "/fusion/")"
+build(){
- MODULES=$(echo ${MODULES}) #trim whitespace
- if [ -n "${MODULES}" ]; then
- MODULES="${MODULES} sd_mod"
- fi
- BINARIES=""
- FILES=""
- SCRIPT=""
+ MODULES="$(checked_modules "/scsi/" | grep -vE '(imm|ata|pcmcia)')
+ $(checked_modules "/block/" | grep -E '(cciss|cpqarray|DAC960)')
+ $(checked_modules "/fusion/")"
+
+ [[ $MODULES ]] && MODULES+=" sd_mod"
}
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for an scsi root device.
- Detection will take place at runtime. To minimize the modules
- in the image, add the autodetect hook too.
+help() {
+ cat<<HELPEOF
+This hook loads the necessary modules for an scsi root device. Detection will
+take place at runtime. To minimize the modules in the image, add the autodetect
+hook too.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et: