diff options
author | Michael Lauer <mickey@vanille-media.de> | 2008-02-29 00:22:15 +0000 |
---|---|---|
committer | Michael Lauer <mickey@vanille-media.de> | 2008-02-29 00:22:15 +0000 |
commit | 0177a3d932dbb84f89b19628331ef9b4968e105c (patch) | |
tree | 5dbb1b62785e6db73dd5e0957236801a024403ee | |
parent | 4b0dafd8f68cfcd6ac4fdcf86335ce5ee2040974 (diff) |
udev 118 simplify init script, closes #3886
-rw-r--r-- | packages/udev/udev-118/init | 86 | ||||
-rw-r--r-- | packages/udev/udev_118.bb | 4 |
2 files changed, 17 insertions, 73 deletions
diff --git a/packages/udev/udev-118/init b/packages/udev/udev-118/init index 73c655a0ee..a6b8fa174f 100644 --- a/packages/udev/udev-118/init +++ b/packages/udev/udev-118/init @@ -30,7 +30,7 @@ mount_tmpfs() { # directory which is guaranteed to be available. mount -n -o bind /dev /etc/udev - if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs tmpfs /dev; then + if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs udev /dev; then umount /etc/udev echo "udev requires tmpfs support, not started." exit 1 @@ -55,6 +55,7 @@ mount_tmpfs() { # I hate this hack. -- Md make_extra_nodes() { + mknod -m 666 /dev/null c 1 3 if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then cp -a /lib/udev/devices/* /dev/ fi @@ -75,18 +76,11 @@ make_extra_nodes() { supported_kernel() { case "$(uname -r)" in 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; - 2.6.1[01]|2.6.1[01][!0-9]*) return 1 ;; + 2.6.1[0134]|2.6.1[01234][!0-9]*) return 1 ;; esac return 0 } -set_hotplug_handler() { - case "$(uname -r)" in - 2.6.1[0-4]|2.6.1[0-4][!0-9]*) HANDLER='/sbin/udevsend' ;; - esac - echo $HANDLER > /proc/sys/kernel/hotplug -} - # shell version of /usr/bin/tty my_tty() { [ -x /bin/readlink ] || return 0 @@ -94,24 +88,6 @@ my_tty() { readlink --silent /proc/self/fd/0 || true } -warn_if_interactive() { - if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then - return - fi - - TTY=$(my_tty) - if [ -z "$TTY" -o "$TTY" = "/dev/console" ]; then - return - fi - - printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n" - printf "has been run from an interactive shell.\n" - printf "It will probably not do what you expect, so this script will wait\n" - printf "60 seconds before continuing. Press ^C to stop it.\n" - printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n" - sleep 60 -} - ############################################################################## PATH="/sbin:/bin:/usr/bin" @@ -120,13 +96,11 @@ PATH="/sbin:/bin:/usr/bin" # defaults tmpfs_size="2M" -udev_root="/dev" -udevd_timeout=30 . /etc/udev/udev.conf if ! supported_kernel; then - echo "udev requires a kernel >= 2.6.12, not started." + echo "udev requires a kernel >= 2.6.15, not started." exit 1 fi @@ -145,61 +119,31 @@ if [ ! -d /sys/class/ ]; then exit 1 fi -if [ ! -e /proc/sys/kernel/hotplug ]; then - echo "udev requires hotplug support, not started." - exit 1 -fi - ############################################################################## # When modifying this script, do not forget that between the time that # the new /dev has been mounted and udevsynthesize has been run there will be # no /dev/null. This also means that you cannot use the "&" shell command. - case "$1" in start) - if [ -e "$udev_root/.udev/" ]; then - if mountpoint -q /dev/; then - TMPFS_MOUNTED=1 - else - echo ".udev/ already exists on the static $udev_root!" - fi - else - warn_if_interactive - fi + unmount_devpts + mount_tmpfs + [ -d /proc/1 ] || mount -n /proc - echo "Starting the hotplug events dispatcher" "udevd" - udevd --daemon - - set_hotplug_handler + # /dev/null must be created before udevd is started + make_extra_nodes - if [ -z "$TMPFS_MOUNTED" ]; then - unmount_devpts - mount_tmpfs - [ -d /proc/1 ] || mount -n /proc + # It's all over netlink now + if [ -e /proc/sys/kernel/hotplug ]; then + echo "" > /proc/sys/kernel/hotplug fi - # if this directory is not present /dev will not be updated by udev - mkdir -p /dev/.udev/ /dev/.udev/db/ /dev/.udev/queue/ /dev/.udevdb/ - # /dev/null must be created before udevd is started - make_extra_nodes + echo "Starting the hotplug events dispatcher" "udevd" + udevd --daemon echo "Synthesizing the initial hotplug events" udevtrigger - - # wait for the udevd childs to finish - echo "Waiting for /dev to be fully populated" - while [ -d /dev/.udev/queue/ ]; do - sleep 1 - udevd_timeout=$(($udevd_timeout - 1)) - if [ $udevd_timeout -eq 0 ]; then - # ps axf - break - fi - done - if [ $udevd_timeout -eq 0 ]; then - echo 'timeout' - fi + udevsettle ;; stop) diff --git a/packages/udev/udev_118.bb b/packages/udev/udev_118.bb index a4c12877f5..18479a3d13 100644 --- a/packages/udev/udev_118.bb +++ b/packages/udev/udev_118.bb @@ -3,9 +3,9 @@ DESCRIPTION = "udev is a daemon which dynamically creates and removes device nod the hotplug package and requires a kernel not older than 2.6.12." RPROVIDES_${PN} = "hotplug" -PR = "r0" +PR = "r2" -DEFAULT_PREFERENCE = "-115" +DEFAULT_PREFERENCE = "-118" SRC_URI = "\ http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \ |