All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marco d'Itri" <md@Linux.IT>
To: linux-hotplug@vger.kernel.org
Subject: Re: [patch] install initscript in udev rpm
Date: Wed, 17 Dec 2003 08:28:40 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-107165153710914@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-107159510124551@msgid-missing>

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

On Dec 17, Greg KH <greg@kroah.com> wrote:

 >> Actually I would be *very* surprised if the init script I wrote for
 >> debian (which I sent you a few weeks ago) did not work with every
 >> distribution.
 >Can you resend it?  I don't seem to be able to find it anymore.

Here it is.
There is a bug I have not fixed yet (it breaks if /sys/class/video4linux/
does not exist).

-- 
ciao, |
Marco | [3649 grArswY7ca0qI]

[-- Attachment #2: udev --]
[-- Type: text/plain, Size: 1524 bytes --]

#!/bin/sh -e

PATH=/sbin:/bin:/usr/sbin:/usr/bin

UDEV=/sbin/udev

[ -x $UDEV -a -e /proc/sys/kernel/hotplug ] || exit 0
[ -c /dev/.devfsd ] && exit 0

case "$(uname -r)" in
  2.[01234].*)
    echo "udev requires a 2.6.x kernel, not started."
    exit 0
    ;;
esac

mount_sysfs() {
  [ -d /sys ] || mkdir /sys
  [ -d /sys/class ] || mount -t sysfs sysfs: /sys
}

synthesize_events() {
  echo -n "Creating initial udev device nodes..."
  export ACTION=add
  # add tty devices
  for i in /sys/class/tty/* /sys/class/video4linux/*; do
    export DEVPATH=${i#/sys}
#    echo -n " $DEVPATH"
    $UDEV tty
  done
  # add block devices and their partitions
  for i in /sys/block/*; do
    export DEVPATH=${i#/sys}
#    echo -n " $DEVPATH"
    $UDEV block
    for j in $i/*; do
      [ -f "$j/dev" ] || continue
      export DEVPATH=${j#/sys}
#      echo -n " $DEVPATH"
      $UDEV block
    done
  done
  echo "done."
  return 0
}

case "$1" in
  start|restart|force-reload)
    [ -d /udev ] || mkdir /udev
    mount_sysfs
    synthesize_events
    if [ "$(cat /proc/sys/kernel/hotplug)" = "/sbin/hotplug" ]; then
      :
    else
      echo $UDEV > /proc/sys/kernel/hotplug
      echo "/dev management daemon (udev) enabled."
    fi
    ;;
  stop)
    if [ "$(cat /proc/sys/kernel/hotplug)" = "$UDEV" ]; then
      echo /bin/true > /proc/sys/kernel/hotplug
      echo "/dev management daemon (udev) disabled."
    fi
    ;;
  *)
    echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"
    exit 1
    ;;
esac

exit 0

  parent reply	other threads:[~2003-12-17  8:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-16 17:11 [patch] install initscript in udev rpm Marco d'Itri
2003-12-16 17:23 ` Greg KH
2003-12-16 17:31 ` Rob Love
2003-12-16 23:31 ` Greg KH
2003-12-17  0:13 ` Marco d'Itri
2003-12-17  1:01 ` Greg KH
2003-12-17  8:28 ` Marco d'Itri [this message]
2003-12-17 15:46 ` Rob Love
2003-12-17 18:11 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2003-12-16 17:03 Rob Love

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=marc-linux-hotplug-107165153710914@msgid-missing \
    --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.