linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ide.rc
@ 2004-10-29 14:15 Marco d'Itri
  2004-10-30  2:36 ` ide.rc Alexander E. Patrakov
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Marco d'Itri @ 2004-10-29 14:15 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

I'm attaching a .rc script for hotplug which loads at boot time the
ide-* modules needed by the system (which, as everybody knows by now,
cannot be automatically loaded anymore when using udev).

-- 
ciao, |
Marco | [8804 tr7xD/mgdubuA]

[-- Attachment #2: ide.rc --]
[-- Type: text/plain, Size: 1503 bytes --]

#!/bin/sh -e
#
# ide.rc	loads the modules for IDE devices at boot time, if needed
#		it requires a 2.6 kernel
#
# Copyright (C) 2004 Marco d'Itri <md@linux.it>
#

# only 2.6 kernels are supported
[ -d /sys/block/ ] || exit 0

cd /etc/hotplug
. ./hotplug.functions

# XXX this function should be moved to hotplug.functions
is_blacklisted() {
    MODULE_EXPR="$(echo $1 | sed -e 's/[-_]/[-_]/g')"
    if grep -qs "^${MODULE_EXPR}$" \
		$HOTPLUG_DIR/blacklist $HOTPLUG_DIR/blacklist.d/*; then
	return 0
    fi
    return 1
}

ide_boot_events() {
    [ "$(echo /proc/ide/*/media)" = "/proc/ide/*/media" ] && return

    for drive in /proc/ide/*/media; do
	# nothing to do if the device has already been took in charge
	unit=${drive#/proc/ide/}; unit=${unit%/media}
	[ -d /sys/block/$unit ] && continue

	read media < $drive
	case "$media" in
	    disk)     MODULE=ide-disk ;;
	    cdrom)    MODULE=ide-cd ;;
	    tape)     MODULE=ide-tape ;;
	    floppy)   MODULE=ide-floppy ;;
	    *)        MODULE=ide-generic ;;
	esac

	# ignore blacklisted modules
	if is_blacklisted $MODULE; then
	    mesg "     $MODULE: blacklisted"
	    continue
	fi

	if modprobe --quiet $MODULE; then
	    mesg "     $MODULE: loaded sucessfully"
	else
	    mesg "     $MODULE: can't be loaded"
	fi
    done
}   

# See how we were called.
case "$1" in
    start|restart)
        ide_boot_events
        ;;
    stop)
        ;;
    status)
        ;;
    *)
        echo "Usage: $0 {start|stop|status|restart}"
        exit 1
esac


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-11-01  3:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-29 14:15 ide.rc Marco d'Itri
2004-10-30  2:36 ` ide.rc Alexander E. Patrakov
2004-10-30  7:14 ` ide.rc Remco
2004-10-30 15:31 ` ide.rc Alexander E. Patrakov
2004-11-01  1:47 ` ide.rc Marco d'Itri
2004-11-01  3:01 ` ide.rc Alexander E. Patrakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).