From 2ed876b6b5c7b431caf5c452d6ee4a67241c4d01 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 27 Apr 2006 17:08:47 +0000 Subject: Added 'autodetect' hook, intended to replace *-auto scripts Beginnings of raid and dm hooks Used sysfs for ide parsing git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@25 880c04e9-e011-0410-abf7-b926e227c9cd --- hooks/autodetect | 9 +++++++++ hooks/ide | 14 +------------- hooks/raid | 12 +----------- install/autodetect | 25 +++++++++++++++++++++++++ install/dm | 17 +++++++++++++++++ install/raid | 17 +++++++++++++++++ mkinitcpio.conf | 2 +- 7 files changed, 71 insertions(+), 25 deletions(-) create mode 100644 hooks/autodetect create mode 100644 install/autodetect create mode 100644 install/dm create mode 100644 install/raid diff --git a/hooks/autodetect b/hooks/autodetect new file mode 100644 index 0000000..bffdff3 --- /dev/null +++ b/hooks/autodetect @@ -0,0 +1,9 @@ +# vim: set ft=sh: +run_hook () +{ + if [ -e /modules ]; then + while read mod; do + /bin/modprobe -q $mod >/dev/null 2>&1 + done < /modules + fi +} diff --git a/hooks/ide b/hooks/ide index 0a81062..a6ca17c 100644 --- a/hooks/ide +++ b/hooks/ide @@ -3,19 +3,7 @@ run_hook () { if [ -e /proc/ide ]; then msg -n "Loading ide modules..." - /bin/modprobe -q ide-generic >/dev/null 2>&1 - for d in /proc/ide/*; do - unit=${d#/proc/ide/} - if [ -e "${d}/media" -a ! -d "/sys/block/${unit}" ]; then - read m < "${d}/media" - case "${m}" in - disk) /bin/modprobe -q ide-disk >/dev/null 2>&1;; - cdrom) /bin/modprobe -q ide-cd >/dev/null 2>&1;; - tape) /bin/modprobe -q ide-tape >/dev/null 2>&1;; - floppy) /bin/modprobe -q ide-floppy >/dev/null 2>&1;; - esac - fi - done + /bin/modprobe -q -a $(/bin/cat /sys/bus/ide/devices/*/modalias) >/dev/null 2>&1 msg "done" else msg "No ide devices detected..." diff --git a/hooks/raid b/hooks/raid index a81c172..d83e2ae 100644 --- a/hooks/raid +++ b/hooks/raid @@ -1,15 +1,5 @@ # vim: set ft=sh: - -# kinit handles md/raid assembly -# we just need modules - -install () -{ - MODULES=" $(find "${MODULEDIR}/kernel/drivers/md/" -name *.ko) md raid0 raid1 raid2 raid5 raid6" - BINARIES="" - FILES="" -} - +# kinit handles md/raid assembly we just need modules run_hook () { #TODO diff --git a/install/autodetect b/install/autodetect new file mode 100644 index 0000000..9e23783 --- /dev/null +++ b/install/autodetect @@ -0,0 +1,25 @@ +# vim: set ft=sh: + +install () +{ + msg ":: Autodetecting modules" + #blegh, we'll let /tmp clean itself up + modtmp=$( mktemp /tmp/initcpio_modules.XXXXXX ) + MODULES=" $(auto_modules "/scsi/" | grep -v "ata") + $(auto_modules "/block/") + $(auto_modules "/fusion/") + $(auto_modules "/usb/") usb_storage usbhid + $(auto_modules "scsi/.*ata") + $(auto_modules "/ide/") + $(cat /proc/filesystems | grep -v nodev) " + for m in $MODULES; do + echo $(basename ${m//\.ko/}) >> $modtmp + [ "$m" == "ata_piix" ] && echo "piix" >> $modtmp + done + + add_file $modtmp "/modules" + + BINARIES="" + FILES="" + SCRIPT="autodetect" +} diff --git a/install/dm b/install/dm new file mode 100644 index 0000000..7011f5e --- /dev/null +++ b/install/dm @@ -0,0 +1,17 @@ +# vim: set ft=sh: + +install () +{ + MODULES=" $(all_modules "/md/" | grep -v "raid")" + BINARIES="" + FILES="" + SCRIPT="UNKNOWN" +} + +help () +{ +cat<