All of lore.kernel.org
 help / color / mirror / Atom feed
From: md@Linux.IT (Marco d'Itri)
To: linux-hotplug@vger.kernel.org
Subject: ide.rc
Date: Fri, 29 Oct 2004 14:15:09 +0000	[thread overview]
Message-ID: <20041029141509.GA9119@wonderland.linux.it> (raw)

[-- 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


             reply	other threads:[~2004-10-29 14:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-29 14:15 Marco d'Itri [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041029141509.GA9119@wonderland.linux.it \
    --to=md@linux.it \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.