summaryrefslogtreecommitdiffstats
path: root/init.d/coldplug
diff options
context:
space:
mode:
Diffstat (limited to 'init.d/coldplug')
-rwxr-xr-xinit.d/coldplug66
1 files changed, 66 insertions, 0 deletions
diff --git a/init.d/coldplug b/init.d/coldplug
new file mode 100755
index 0000000..a39f39f
--- /dev/null
+++ b/init.d/coldplug
@@ -0,0 +1,66 @@
+#!/sbin/runscript
+
+trigger_uevents() {
+ local i
+ for i in /sys/bus/*/devices/*/uevent\
+ /sys/class/*/*/uevent\
+ /sys/block/*/uevent\
+ /sys/block/*/*/uevent ; do
+ case "$i" in
+ */device/uevent)
+ continue
+ ;;
+ */class/mem/*|*/class/tty/*)
+ echo add > "$i"
+ ;;
+ */block/md*|*/block/dm-*)
+ last="$last $i"
+ ;;
+ */*)
+ default="$default $i"
+ ;;
+ esac
+ done
+ for i in $default $last ; do
+ echo add > "$i"
+ done
+}
+
+# coldplug devices
+start() {
+ unset NOCOLDPLUG
+ # check for boot option "nocoldplug"
+ for i in `cat /proc/cmdline`; do
+ [ "$i" = "nocoldplug" ] && NOCOLDPLUG=true
+ done
+
+ if [ "$NOCOLDPLUG" ]; then
+ ebegin "Skipping coldplugging"
+ eend 0
+ return
+ fi
+
+# for rc in /etc/hotplug/*.rc ; do
+# name=`basename $rc .rc`
+# ebegin "Coldplugging $name devices"
+# $rc start 2>/tmp/coldplug.err
+# eend 0
+# done
+ ebegin "Coldplugging devices"
+# while [ -d /dev/.udev/queue ] ; do
+# sleep 1
+# echo -n "."
+# done
+# trigger_uevents
+# sleep 1
+# while [ -d /dev/.udev/queue ] ; do
+# sleep 1
+# echo -n "."
+# done
+ find /sys -name modalias | while read a ; do
+ modprobe `cat $a` 2>/dev/null || echo $a >> /tmp/failed
+ done
+ eend 0
+}
+
+