summaryrefslogtreecommitdiff
path: root/scripts/init-premount
diff options
context:
space:
mode:
authormaximilian attems <maks@debian.org>2005-12-29 10:30:39 +0100
committermaximilian attems <maks@debian.org>2005-12-29 10:30:39 +0100
commit0f9b079738bd9e63896735b80d1768e34fc0b8ea (patch)
tree80ed280620734c7b4dd1c4f5ebabcc07945596b8 /scripts/init-premount
parente0de055ba1a1c32acb70f92ec65bf23139b73b8f (diff)
downloadinitramfs-tools-0f9b079738bd9e63896735b80d1768e34fc0b8ea.tar.gz
initramfs-tools-0f9b079738bd9e63896735b80d1768e34fc0b8ea.zip
add hook ide depending on udev
loads ide-disk and ide-generic on all needed ide cases.
Diffstat (limited to 'scripts/init-premount')
-rw-r--r--scripts/init-premount/ide38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/init-premount/ide b/scripts/init-premount/ide
new file mode 100644
index 0000000..03a3fdf
--- /dev/null
+++ b/scripts/init-premount/ide
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+PREREQ="udev"
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+modprobe -q ide-generic
+
+[ -e /proc/ide ] || return
+
+for drive in /proc/ide/*; do
+ [ -e ${drive}/media ] || continue
+ # nothing to do if the device has already been took in charge
+ unit=${drive#/proc/ide/}
+ [ -d /sys/block/$unit ] && continue
+
+ read media < $drive/media
+ case "$media" in
+ disk) MODULE=ide-disk ;;
+ cdrom) MODULE=ide-cd ;;
+ tape) MODULE=ide-tape ;;
+ floppy) MODULE=ide-floppy ;;
+ *) MODULE=ide-generic ;;
+ esac
+
+ modprobe -q ${MODULE}
+done