summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-05-04 08:23:11 +0200
committerAaron Griffin <aaron@archlinux.org>2006-05-04 08:23:11 +0200
commit30f04e5f7e9b4b77995836c362e57d0b25bde25f (patch)
treead06bc2dc558fe9b4ba7b98e5630387b9208f222 /install
parent76167effbaa98d6e5d967451aa65902e4a5d4782 (diff)
downloadmkinitcpio-30f04e5f7e9b4b77995836c362e57d0b25bde25f.tar.gz
mkinitcpio-30f04e5f7e9b4b77995836c362e57d0b25bde25f.tar.xz
Improved autodetect functionality with a checked_modules
function git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@53 880c04e9-e011-0410-abf7-b926e227c9cd
Diffstat (limited to 'install')
-rw-r--r--install/autodetect50
-rw-r--r--install/filesystems2
-rw-r--r--install/ide2
-rw-r--r--install/sata2
-rw-r--r--install/scsi6
-rw-r--r--install/usb2
6 files changed, 25 insertions, 39 deletions
diff --git a/install/autodetect b/install/autodetect
index 70dc779..6371d35 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -3,10 +3,9 @@
install ()
{
msg ":: Autodetecting modules"
+ MODULE_FILE="$(mktemp /tmp/initcpio_modules.XXXXXX)"
#blegh, we'll let /tmp clean itself up
- modtmp=$( mktemp /tmp/initcpio_modules.XXXXXX )
- modall=$( mktemp /tmp/initcpio_modulesall.XXXXXX )
- AUTODETECT=" $(auto_modules "/scsi/" | grep -v "imm"| grep -v "pcmcia" | grep -v "ide" && echo "sd_mod sr_mod")
+ AUTODETECT=" $((auto_modules "/scsi/" | grep -ve "imm" -e "pcmcia" -e "ide") && echo "sd_mod sr_mod")
$(auto_modules "/block/" && echo "sd_mod sr_mod")
$(auto_modules "/fusion/" && echo "sd_mod sr_mod")
$(auto_modules "/usb/" && echo "usb_storage usbhid sd_mod sr_mod")
@@ -14,33 +13,21 @@ install ()
$(auto_modules "/ieee1394/" && echo "sbp2 sd_mod sr_mod")
$(auto_modules "/cdrom/")
$(cat /proc/filesystems | grep -v nodev) "
-
+
for m in $AUTODETECT; do
- echo $(basename ${m//\.ko/}) >> $modtmp
+ modname="$(basename ${m%%\.ko})"
+ grep "${modname}" "${MODULE_FILE}" >/dev/null 2>&1 && continue
+ echo "${modname}" >> "${MODULE_FILE}"
# fixing missing depends for filesystems
- [ "$m" == "ext3" ] && echo "jbd" >> $modtmp
- [ "$m" == "afs" ] && echo "rxrpc" >> $modtmp
- [ "$m" == "cramfs" ] && echo "zlib_inflate" >> $modtmp
- [ "$m" == "isofs" ] && echo "zlib_inflate" >> $modtmp
- [ "$m" == "msdos" ] && echo "fat" >> $modtmp
- [ "$m" == "vfat" ] && echo "fat" >> $modtmp
- [ "$m" == "ocfs2" ] && echo "ocfs2_dlm" >> $modtmp
- [ "$m" == "ocfs2" ] && echo "jbd" >> $modtmp
- [ "$m" == "ocfs2" ] && echo "ocfs2_nodemanager" >> $modtmp
- [ "$m" == "ocfs2" ] && echo "configfs" >> $modtmp
+ [ "$m" = "ext3" ] && echo "jbd" >> "${MODULE_FILE}"
+ [ "$m" = "afs" ] && echo "rxrpc" >> "${MODULE_FILE}"
+ [ "$m" = "cramfs" ] && echo "zlib_inflate" >> "${MODULE_FILE}"
+ [ "$m" = "isofs" ] && echo "zlib_inflate" >> "${MODULE_FILE}"
+ [ "$m" = "msdos" ] && echo "fat" >> "${MODULE_FILE}"
+ [ "$m" = "vfat" ] && echo "fat" >> "${MODULE_FILE}"
+ [ "$m" = "ocfs2" ] && echo -e "ocfs2_dlm\njbd\nocfs2_nodemanager\nconfigfs" >> "${MODULE_FILE}"
done
- grep "file /lib/modules" ${FILELIST} >>$modall
- for i in `cat $modtmp`; do
- sed -i -e "\=/$i=d" $modall
- done
- for i in `grep "file /lib/modules" $modall | awk '{print $2}'`; do
- sed -i -e "\=$i=d" ${FILELIST}
- done
- msg "Included MODULES:"
- msg "-----------------"
- msg "$(grep "file /lib/modules/" ${FILELIST} | awk '{print $2}')"
- msg "-----------------"
BINARIES=""
FILES=""
SCRIPT=""
@@ -50,11 +37,10 @@ help ()
{
cat <<HELPEOF
This hook shrinks your initramdisk to a smaller size
- by autodetecting your needed modules.
- Please take a look at the included modules for completeness,
- else your system might be unbootable.
- Valid Hooks are: base,udev,ide,scsi,sata,usb,fw,filesystems
- Put this hook at the end of your valid hooks.
- Put other hooks behind autodetect hook.
+ by autodetecting your needed modules. Be sure to verify
+ included modules are correct and none are missing.
+ This hook must be run before other subsystem hooks in
+ order to take advantage of auto-detection. Any hooks
+ placed before 'autodetect' will be installed in full.
HELPEOF
}
diff --git a/install/filesystems b/install/filesystems
index bebef3e..c9528a7 100644
--- a/install/filesystems
+++ b/install/filesystems
@@ -2,7 +2,7 @@
install ()
{
- MODULES=" $(all_modules '/kernel/fs' | grep -v "nls") "
+ MODULES=" $(checked_modules '/kernel/fs' | grep -v "nls") "
BINARIES=""
FILES=""
SCRIPT="filesystems"
diff --git a/install/ide b/install/ide
index ac0ea62..67b5be1 100644
--- a/install/ide
+++ b/install/ide
@@ -2,7 +2,7 @@
install ()
{
- MODULES=" $(all_modules "/ide/" | grep -v "legacy") ";
+ MODULES=" $(checked_modules "/ide/" | grep -v "legacy") ";
BINARIES=""
FILES=""
SCRIPT=""
diff --git a/install/sata b/install/sata
index a31b55a..51a61a7 100644
--- a/install/sata
+++ b/install/sata
@@ -2,7 +2,7 @@
install ()
{
- MODULES=" $(all_modules "scsi/.*ata") sx8 ahci pdc_adma sd_mod sr_mod piix"
+ MODULES=" $(checked_modules "scsi/.*ata" && echo "sx8 ahci pdc_adma sd_mod sr_mod piix")"
BINARIES=""
FILES=""
SCRIPT=""
diff --git a/install/scsi b/install/scsi
index fc6f940..2f107bc 100644
--- a/install/scsi
+++ b/install/scsi
@@ -2,9 +2,9 @@
install ()
{
- MODULES=" $(all_modules "/scsi/" | grep -ve "imm" -e "pdc_adma" -e "ahci" -e "ata" -e "pcmcia" -e "ide")
- $(all_modules "/block/" | grep -v "sx8")
- $(all_modules "/fusion/")"
+ MODULES=" $(checked_modules "/scsi/" | grep -ve "imm" -e "pdc_adma" -e "ahci" -e "ata" -e "pcmcia" -e "ide")
+ $(checked_modules "/block/" | grep -v "sx8")
+ $(checked_modules "/fusion/")"
BINARIES=""
FILES=""
SCRIPT=""
diff --git a/install/usb b/install/usb
index 0e655bd..03ed024 100644
--- a/install/usb
+++ b/install/usb
@@ -2,7 +2,7 @@
install ()
{
- MODULES=" $(all_modules "/usb/host" | grep -ve "_cs" -e "sl1811-hcd" -e "isp116x-hcd")
+ MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl1811-hcd" -e "isp116x-hcd")
usb_storage usbhid sd_mod sr_mod "
BINARIES=""
FILES=""