summaryrefslogtreecommitdiff
path: root/scripts/init-premount/ide
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/init-premount/ide')
-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