aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-fs/udev/files')
-rw-r--r--sys-fs/udev/files/151/shell-compat-KV.sh45
-rw-r--r--sys-fs/udev/files/151/shell-compat-addon.sh71
-rwxr-xr-xsys-fs/udev/files/151/udev-dev-tarball.initd95
-rwxr-xr-xsys-fs/udev/files/151/udev-mount.initd119
-rwxr-xr-xsys-fs/udev/files/151/udev-postmount.initd35
-rw-r--r--sys-fs/udev/files/151/udev-start.sh55
-rw-r--r--sys-fs/udev/files/151/udev-stop.sh13
-rw-r--r--sys-fs/udev/files/151/udev.confd56
-rw-r--r--sys-fs/udev/files/151/udev.initd263
-rw-r--r--sys-fs/udev/files/udev-150-fix-missing-firmware-timeout.diff29
-rw-r--r--sys-fs/udev/files/udev-151-readd-hd-rules.diff53
11 files changed, 834 insertions, 0 deletions
diff --git a/sys-fs/udev/files/151/shell-compat-KV.sh b/sys-fs/udev/files/151/shell-compat-KV.sh
new file mode 100644
index 0000000..be74fe4
--- /dev/null
+++ b/sys-fs/udev/files/151/shell-compat-KV.sh
@@ -0,0 +1,45 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# provides get_KV and KV_to_int as not all openrc-versions installed via ebuild have these
+
+cmd_exist()
+{
+ type "$1" >/dev/null 2>&1
+}
+
+# does exist in baselayout-1
+# does not exist in openrc, but is added by openrc-ebuild since some time
+if ! cmd_exist KV_to_int; then
+ KV_to_int() {
+ [ -z $1 ] && return 1
+
+ local x=${1%%-*}
+ local KV_MAJOR=${x%%.*}
+ x=${x#*.}
+ local KV_MINOR=${x%%.*}
+ x=${x#*.}
+ local KV_MICRO=${x%%.*}
+ local KV_int=$((${KV_MAJOR} * 65536 + ${KV_MINOR} * 256 + ${KV_MICRO} ))
+
+ # We make version 2.2.0 the minimum version we will handle as
+ # a sanity check ... if its less, we fail ...
+ [ "${KV_int}" -lt 131584 ] && return 1
+
+ echo "${KV_int}"
+ }
+fi
+
+# same as KV_to_int
+if ! cmd_exist get_KV; then
+ _RC_GET_KV_CACHE=""
+ get_KV() {
+ [ -z "${_RC_GET_KV_CACHE}" ] \
+ && _RC_GET_KV_CACHE="$(uname -r)"
+
+ echo "$(KV_to_int "${_RC_GET_KV_CACHE}")"
+
+ return $?
+ }
+fi
+
diff --git a/sys-fs/udev/files/151/shell-compat-addon.sh b/sys-fs/udev/files/151/shell-compat-addon.sh
new file mode 100644
index 0000000..c271abf
--- /dev/null
+++ b/sys-fs/udev/files/151/shell-compat-addon.sh
@@ -0,0 +1,71 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# functions that may not be defined, but are used by the udev-start and udev-stop addon
+# used by baselayout-1 and openrc before version 0.4.0
+
+cmd_exist()
+{
+ type "$1" >/dev/null 2>&1
+}
+
+# does not exist in baselayout-1, does exist in openrc
+if ! cmd_exist yesno; then
+ yesno() {
+ [ -z "$1" ] && return 1
+ case "$1" in
+ yes|Yes|YES) return 0 ;;
+ esac
+ return 1
+ }
+fi
+
+# does not exist in baselayout-1, does exist in openrc
+#
+# mountinfo <path>
+# check if some filesystem is mounted at mountpoint <path>
+#
+# return value:
+# 0 filesystem is mounted at <path>
+# 1 no filesystem is mounted exactly at <path>
+if ! cmd_exist mountinfo; then
+ mountinfo() {
+ [ "$1" = "-q" ] && shift
+ local dir="$1"
+
+ # check if entry is in /proc/mounts
+ local ret=$(gawk 'BEGIN { found="false"; }
+ $1 ~ "^#" { next }
+ $2 == "'$dir'" { found="true"; }
+ END { print found; }
+ ' /proc/mounts)
+
+ "${ret}"
+ }
+fi
+
+# does not exist in baselayout-1, does exist in openrc
+#
+# used syntax: fstabinfo --mount /dev
+# it should mount /dev if an entry exists in /etc/fstab
+#
+# return value:
+# 0 mount succeeded
+# 1 mount failed or no entry exists
+#
+if ! cmd_exist fstabinfo; then
+ fstabinfo() {
+ [ "$1" = "--mount" ] || return 1
+ local dir="$2"
+
+ # RC_USE_FSTAB does only exist in baselayout-1
+ # this emulation is only needed on bl-1, so check always
+ yesno "${RC_USE_FSTAB}" || return 1
+
+ # no need to check fstab, mount does this already for us
+
+ # try mounting - better first check fstab and then mount without surpressing errors
+ mount -n "${dir}" 2>/dev/null
+ return $?
+ }
+fi
diff --git a/sys-fs/udev/files/151/udev-dev-tarball.initd b/sys-fs/udev/files/151/udev-dev-tarball.initd
new file mode 100755
index 0000000..2cdce4f
--- /dev/null
+++ b/sys-fs/udev/files/151/udev-dev-tarball.initd
@@ -0,0 +1,95 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Maintain a tarball of not udev managed device nodes"
+[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev
+
+rc_device_tarball=${rc_device_tarball:-${RC_DEVICE_TARBALL:-NO}}
+device_tarball=/lib/udev/state/devices.tar.bz2
+
+depend() {
+ if [ -f /etc/init.d/sysfs ]; then
+ need udev-mount
+ fi
+}
+
+start()
+{
+ _start
+}
+
+_start() {
+ if yesno "${rc_device_tarball}" && \
+ [ -s "${device_tarball}" ]
+ then
+ ebegin "Populating /dev with saved device nodes"
+ tar -jxpf "${device_tarball}" -C /dev
+ eend $?
+ fi
+}
+
+stop() {
+ if [ -e /dev/.devfsd ] || [ ! -e /dev/.udev ] || [ ! -z "${CDBOOT}" ] || \
+ ! yesno "${rc_device_tarball}" || \
+ ! touch "${device_tarball}" 2>/dev/null
+ then
+ return 0
+ fi
+
+ ebegin "Saving device nodes"
+ # Handle our temp files
+ save_tmp_base=/tmp/udev.savedevices."$$"
+ devices_udev="${save_tmp_base}"/devices.udev
+ devices_real="${save_tmp_base}"/devices.real
+ devices_totar="${save_tmp_base}"/devices.totar
+ device_tmp_tarball="${save_tmp_base}"/devices
+
+ rm -rf "${save_tmp_base}"
+ mkdir "${save_tmp_base}"
+ touch "${devices_udev}" "${devices_real}" \
+ "${devices_totar}" "${device_tmp_tarball}"
+
+ if [ -f "${devices_udev}" -a -f "${devices_real}" -a \
+ -f "${devices_totar}" -a -f "${device_tmp_tarball}" ]
+ then
+ cd /dev
+ # Find all devices, but ignore .udev directory
+ find . -xdev -type b -or -type c -or -type l | \
+ cut -d/ -f2- | \
+ grep -v ^\\.udev >"${devices_real}"
+
+ # Figure out what udev created
+ udevadm info --export-db | sed -ne 's,^[SN]: \(.*\),\1,p' >"${devices_udev}"
+ # These ones we also do not want in there
+ for x in MAKEDEV core fd initctl pts shm stderr stdin stdout root; do
+ echo "${x}" >> "${devices_udev}"
+ done
+ if [ -d /lib/udev/devices ]; then
+ cd /lib/udev/devices
+ find . -xdev -type b -or -type c -or -type l | \
+ cut -d/ -f2- >> "${devices_udev}"
+ cd /dev
+ fi
+
+ fgrep -x -v -f "${devices_udev}" "${devices_real}" > "${devices_totar}"
+
+ # Now only tarball those not created by udev if we have any
+ if [ -s "${devices_totar}" ]; then
+ # we dont want to descend into mounted filesystems (e.g. devpts)
+ # looking up username may involve NIS/network
+ # and net may be down
+ tar --one-file-system --numeric-owner \
+ -jcpf "${device_tmp_tarball}" -T "${devices_totar}"
+ mv -f "${device_tmp_tarball}" "${device_tarball}"
+ else
+ rm -f "${device_tarball}"
+ fi
+ eend 0
+ else
+ eend 1 "Could not create temporary files!"
+ fi
+
+ rm -rf "${save_tmp_base}"
+}
+
diff --git a/sys-fs/udev/files/151/udev-mount.initd b/sys-fs/udev/files/151/udev-mount.initd
new file mode 100755
index 0000000..4acdf09
--- /dev/null
+++ b/sys-fs/udev/files/151/udev-mount.initd
@@ -0,0 +1,119 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Mount tmpfs on /dev"
+[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev
+
+# get_KV and KV_to_int
+. /lib/udev/shell-compat-KV.sh
+
+# FIXME
+# Instead of this script testing kernel version, udev itself should
+# Maybe something like udevd --test || exit $?
+check_kernel()
+{
+ if [ $(get_KV) -lt $(KV_to_int '%KV_MIN%') ]; then
+ eerror "Your kernel is too old to work with this version of udev."
+ eerror "Current udev only supports Linux kernel %KV_MIN% and newer."
+ return 1
+ fi
+
+ yesno "${unreliable_kernel_warning:-yes}" || return 0
+
+ if [ $(get_KV) -lt $(KV_to_int '%KV_MIN_RELIABLE%') ]; then
+ ewarn "You need at least Linux kernel %KV_MIN_RELIABLE% for reliable operation of udev."
+ fi
+ return 0
+}
+
+
+mount_dev_directory()
+{
+ if mountinfo -q /dev; then
+ einfo "/dev is already mounted"
+ return 0
+ fi
+
+ # No options are processed here as they should all be in /etc/fstab
+ ebegin "Mounting /dev"
+ if ! fstabinfo --mount /dev; then
+ # we mount devtmpfs if supported
+ local fs=tmpfs
+ grep -qs devtmpfs /proc/filesystems && fs=devtmpfs
+
+ # Some devices require exec, Bug #92921
+ mount -n -t "$fs" -o "exec,nosuid,mode=0755,size=10M" udev /dev
+ fi
+ eend $?
+}
+
+seed_dev()
+{
+ # Seed /dev with some things that we know we need
+
+ # creating /dev/console, /dev/tty and /dev/tty1 to be able to write
+ # to $CONSOLE with/without bootsplash before udevd creates it
+ [ -c /dev/console ] || mknod -m 600 /dev/console c 5 1
+ [ -c /dev/tty1 ] || mknod -m 620 /dev/tty1 c 4 1
+ [ -c /dev/tty ] || mknod -m 666 /dev/tty c 5 0
+
+ # udevd will dup its stdin/stdout/stderr to /dev/null
+ # and we do not want a file which gets buffered in ram
+ [ -c /dev/null ] || mknod -m 666 /dev/null c 1 3
+ ${HAVE_SELINUX} && restorecon /dev/null
+
+ # so udev can add its start-message to dmesg
+ [ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11
+
+ # copy over any persistant things
+ if [ -d /lib/udev/devices ]; then
+ cp -RPp /lib/udev/devices/* /dev 2>/dev/null
+ fi
+
+ # Not provided by sysfs but needed
+ ln -snf /proc/self/fd /dev/fd
+ ln -snf fd/0 /dev/stdin
+ ln -snf fd/1 /dev/stdout
+ ln -snf fd/2 /dev/stderr
+ [ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core
+
+ # Create problematic directories
+ mkdir -p /dev/pts /dev/shm
+ ${HAVE_SELINUX} && restorecon -R /dev >/dev/null
+ return 0
+}
+
+
+start()
+{
+ # do not run this on too old baselayout - udev-addon is already loaded!
+ if [ ! -f /etc/init.d/sysfs ]; then
+ eerror "The $SVCNAME init-script is written for baselayout-2!"
+ eerror "Please do not use it with baselayout-1!".
+ return 1
+ fi
+
+ _start
+}
+
+_start()
+{
+ check_kernel || return 1
+ mount_dev_directory || return 1
+
+ # Selinux lovin; /selinux should be mounted by selinux-patched init
+ if [ -x /sbin/restorecon -a -c /selinux/null ]; then
+ HAVE_SELINUX=true
+ restorecon /dev > /selinux/null
+ else
+ HAVE_SELINUX=false
+ fi
+
+ # make sure it exists
+ mkdir -p /dev/.udev /dev/.udev/rules.d
+
+ seed_dev
+
+ return 0
+}
diff --git a/sys-fs/udev/files/151/udev-postmount.initd b/sys-fs/udev/files/151/udev-postmount.initd
new file mode 100755
index 0000000..1619d5a
--- /dev/null
+++ b/sys-fs/udev/files/151/udev-postmount.initd
@@ -0,0 +1,35 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/files/151/udev-postmount.initd,v 1.1 2010/01/29 21:14:43 zzam Exp $
+
+depend() {
+ need localmount
+ after dbus # for trigger failed
+}
+
+dir_writeable()
+{
+ mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
+}
+
+start() {
+ # check if this system uses udev
+ [ -d /dev/.udev/ ] || return 0
+
+ # Run the events that failed at first udev trigger
+ udevadm trigger --type=failed -v
+
+ # only continue if rules-directory is writable
+ dir_writeable /etc/udev/rules.d || return 0
+
+ # store persistent-rules that got created while booting
+ # when / was still read-only
+ /lib/udev/move_tmp_persistent_rules.sh
+}
+
+stop() {
+ :
+}
+
+# vim:ts=4
diff --git a/sys-fs/udev/files/151/udev-start.sh b/sys-fs/udev/files/151/udev-start.sh
new file mode 100644
index 0000000..e927e8c
--- /dev/null
+++ b/sys-fs/udev/files/151/udev-start.sh
@@ -0,0 +1,55 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev
+
+. /lib/udev/shell-compat-addon.sh
+
+compat_volume_nodes()
+{
+ # Only do this for baselayout-1*
+ # This check is likely to get false positives due to some multilib stuff,
+ # but that should not matter, as this can only happen on old openrc versions
+ # no longer available as ebuilds.
+ if [ ! -e /lib/librc.so ]; then
+
+ # Create nodes that udev can't
+ [ -x /sbin/lvm ] && \
+ /sbin/lvm vgscan -P --mknodes --ignorelockingfailure &>/dev/null
+ # Running evms_activate on a LiveCD causes lots of headaches
+ [ -z "${CDBOOT}" -a -x /sbin/evms_activate ] && \
+ /sbin/evms_activate -q &>/dev/null
+ fi
+}
+
+start_initd()
+{
+ (
+ . /etc/init.d/"$1"
+ _start
+ )
+}
+
+# set it as openrc does
+RC_BOOTLEVEL=${BOOTLEVEL:-default}
+RC_DEFAULTLEVEL=${DEFAULTLEVEL:-default}
+
+# mount tmpfs on /dev
+start_initd udev-mount || exit 1
+
+# Create a file so that our rc system knows it's still in sysinit.
+# Existance means init scripts will not directly run.
+# rc will remove the file when done with sysinit.
+# this is no longer needed as of openrc-0.4.0
+touch /dev/.rcsysinit
+
+# load device tarball
+start_initd udev-dev-tarball
+
+# run udevd
+start_initd udev || exit 1
+
+compat_volume_nodes
+
+# udev started successfully
+exit 0
diff --git a/sys-fs/udev/files/151/udev-stop.sh b/sys-fs/udev/files/151/udev-stop.sh
new file mode 100644
index 0000000..47e0956
--- /dev/null
+++ b/sys-fs/udev/files/151/udev-stop.sh
@@ -0,0 +1,13 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# for function yesno
+. /lib/udev/shell-compat-addon.sh
+
+# store device tarball
+(
+ . /etc/init.d/udev-dev-tarball
+ stop
+)
+
+exit 0
diff --git a/sys-fs/udev/files/151/udev.confd b/sys-fs/udev/files/151/udev.confd
new file mode 100644
index 0000000..bffea35
--- /dev/null
+++ b/sys-fs/udev/files/151/udev.confd
@@ -0,0 +1,56 @@
+# /etc/conf.d/udev: config file for udev
+
+# We discourage to disable persistent-net!!
+# this may lead to random interface naming
+
+# Disable adding new rules for persistent-net
+persistent_net_disable="no"
+
+# Disable adding new rules for persistent-cd
+# Disabling this will stop new cdrom devices to appear
+# as /dev/{cdrom,cdrw,dvd,dvdrw}
+persistent_cd_disable="no"
+
+# Set to "yes" if you want to save /dev to a tarball on shutdown
+# and restore it on startup. This is useful if you have a lot of
+# custom device nodes that udev does not handle/know about.
+#
+# As this option is fragile, we recommend you
+# to create your devices in /lib/udev/devices.
+# These will be copied to /dev on boot.
+#rc_device_tarball="NO"
+
+# udev can trigger coldplug events which cause services to start and
+# kernel modules to be loaded.
+# Services are deferred to start in the boot runlevel.
+# Set rc_coldplug="NO" if you don't want this.
+# If you want module coldplugging but not coldplugging of services then you
+# can disable service coldplugging in baselayout/openrc config files.
+# The setting is named different in different versions.
+# in /etc/rc.conf: rc_hotplug="!*" or
+# in /etc/conf.d/rc: rc_plug_services="!*"
+#rc_coldplug="YES"
+
+
+
+
+# Expert options:
+
+# Disable warning about unreliable kernel/udev combination
+#unreliable_kernel_warning="no"
+
+# Timeout in seconds to wait for processing of uevents at boot.
+# There should be no need to change this.
+#udev_settle_timeout="60"
+
+# Run udevadmin monitor to get a log of all events
+# in /dev/.udev/udevmonitor.log
+#udev_monitor="YES"
+
+# Keep udevmonitor running after populating /dev.
+#udev_monitor_keep_running="no"
+
+# Set cmdline options for udevmonitor.
+# could be some of --env --kernel --udev
+#udev_monitor_opts="--env"
+
diff --git a/sys-fs/udev/files/151/udev.initd b/sys-fs/udev/files/151/udev.initd
new file mode 100644
index 0000000..36a7c05
--- /dev/null
+++ b/sys-fs/udev/files/151/udev.initd
@@ -0,0 +1,263 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Run udevd and create the device-nodes"
+
+[ -e /etc/udev/udev.conf ] && . /etc/udev/udev.conf
+
+rc_coldplug=${rc_coldplug:-${RC_COLDPLUG:-YES}}
+
+depend()
+{
+ if [ -f /etc/init.d/sysfs ]; then
+ # require new enough openrc with sysinit being extra runlevel
+ # on linux we just check if sysfs init-script exists
+ # this is to silence out ugly warnings about not-existing sysfs script
+ provide dev
+ if yesno "${rc_device_tarball:-no}"; then
+ need sysfs udev-mount udev-dev-tarball
+ else
+ need sysfs udev-mount
+ fi
+ before checkfs fsck
+
+ # udev does not work inside vservers
+ keyword novserver
+ fi
+}
+
+cleanup()
+{
+ # fail more gracely and not leave udevd running
+ start-stop-daemon --stop --exec /sbin/udevd
+ exit 1
+}
+
+disable_hotplug_agent()
+{
+ if [ -e /proc/sys/kernel/hotplug ]; then
+ echo "" >/proc/sys/kernel/hotplug
+ fi
+}
+
+root_link()
+{
+ /lib/udev/write_root_link_rule
+}
+
+rules_disable_switch()
+{
+ # this function disables rules files
+ # by creating new files with the same name
+ # in a temp rules directory with higher priority
+ local f=/dev/.udev/rules.d/"$1" bname="$1" onoff="$2"
+
+ if yesno "${onoff}"; then
+ echo "# This file disables ${bname} due to /etc/conf.d/udev" \
+ > "${f}"
+ else
+ rm -f "${f}"
+ fi
+}
+
+# only called on openrc
+is_service_enabled() {
+ local svc="$1"
+
+ [ ! -e "/etc/init.d/${svc}" ] && return 1
+
+ [ -e "/etc/runlevels/${RC_BOOTLEVEL}/${svc}" ] && return 0
+ [ -e "/etc/runlevels/${RC_DEFAULTLEVEL}/${svc}" ] && return 0
+ return 1
+}
+
+check_openrc_net()
+{
+ local f=/dev/.udev/rules.d/90-network.rules
+ is_service_enabled network || return 0
+
+ # disable network hotplugging
+ echo "# This file disables network hotplug events calling old-style openrc net scripts" >> "${f}"
+ echo "# as we use new-style network init script /etc/init.d/network" >> "${f}"
+}
+
+start_udevd()
+{
+ # load unix domain sockets if built as module, Bug #221253
+ if [ -e /proc/modules ] ; then
+ modprobe -q unix 2>/dev/null
+ fi
+ ebegin "Starting udevd"
+ start-stop-daemon --start --exec /sbin/udevd -- --daemon
+ eend $?
+}
+
+# populate /dev with devices already found by the kernel
+populate_dev()
+{
+ if get_bootparam "nocoldplug" ; then
+ rc_coldplug="NO"
+ ewarn "Skipping udev coldplug as requested in kernel cmdline"
+ fi
+
+ ebegin "Populating /dev with existing devices through uevents"
+ if yesno "${rc_coldplug}"; then
+ udevadm trigger
+ else
+ # Do not run any init-scripts, Bug #206518
+ udevadm control --env do_not_run_plug_service=1
+
+ # only create device nodes
+ udevadm trigger --attr-match=dev
+
+ # run persistent-net stuff, bug 191466
+ udevadm trigger --subsystem-match=net
+ fi
+ eend $?
+
+ # we can speed up booting under these conditions:
+ # * using devtmpfs so kernel creates device nodes for us
+ # * only using kernel created device nodes at boot (in /etc/fstab and elsewhere)
+ #
+ ebegin "Waiting for uevents to be processed"
+ udevadm settle --timeout=${udev_settle_timeout:-60}
+ eend $?
+
+ udevadm control --env do_not_run_plug_service=
+ return 0
+}
+
+# for debugging
+start_udevmonitor()
+{
+ yesno "${udev_monitor:-no}" || return 0
+
+ udevmonitor_log=/dev/.udev/udevmonitor.log
+ udevmonitor_pid=/dev/.udev/udevmonitor.pid
+
+ einfo "udev: Running udevadm monitor ${udev_monitor_opts} to get a log of all events"
+ start-stop-daemon --start --stdout "${udevmonitor_log}" \
+ --make-pidfile --pidfile "${udevmonitor_pid}" \
+ --background --exec /sbin/udevadm -- monitor ${udev_monitor_opts}
+}
+
+stop_udevmonitor()
+{
+ yesno "${udev_monitor:-no}" || return 0
+
+ if yesno "${udev_monitor_keep_running:-no}"; then
+ ewarn "udev: udevmonitor is still running and writing into ${udevmonitor_log}"
+ else
+ einfo "udev: Stopping udevmonitor: Log is in ${udevmonitor_log}"
+ start-stop-daemon --stop --pidfile "${udevmonitor_pid}" --exec /sbin/udevadm
+ fi
+}
+
+display_hotplugged_services() {
+ local svcfile= svc= services=
+ for svcfile in "${RC_SVCDIR}"/hotplugged/*; do
+ svc="${svcfile##*/}"
+ [ -x "${svcfile}" ] || continue
+
+ services="${services} ${svc}"
+ done
+ [ -n "${services}" ] && einfo "Device initiated services:${HILITE}${services}${NORMAL}"
+}
+
+check_persistent_net()
+{
+ # check if there are problems with persistent-net
+ local syspath= devs= problem=false
+ for syspath in /sys/class/net/*_rename*; do
+ if [ -d "${syspath}" ]; then
+ devs="${devs} ${syspath##*/}"
+ problem=true
+ fi
+ done
+
+ ${problem} || return 0
+
+ eerror "UDEV: Your system has a problem assigning persistent names"
+ eerror "to these network interfaces: ${devs}"
+
+ einfo "Checking persistent-net rules:"
+ # the sed-expression lists all duplicate lines
+ # from the input, like "uniq -d" does, but uniq
+ # is installed into /usr/bin and not available at boot.
+ dups=$(
+ RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules'
+ . /lib/udev/rule_generator.functions
+ find_all_rules 'NAME=' '.*' | \
+ tr ' ' '\n' | \
+ sort | \
+ sed '$!N; s/^\(.*\)\n\1$/\1/; t; D'
+ )
+ if [ -n "${dups}" ]; then
+ ewarn "The rules create multiple entries assigning these names:"
+ eindent
+ ewarn "${dups}"
+ eoutdent
+ else
+ ewarn "Found no duplicate names in persistent-net rules,"
+ ewarn "there must be some other problem!"
+ fi
+ return 1
+}
+
+check_udev_works()
+{
+ # should exist on every system, else udev failed
+ if [ ! -e /dev/zero ]; then
+ eerror "Assuming udev failed somewhere, as /dev/zero does not exist."
+ return 1
+ fi
+ return 0
+}
+
+start()
+{
+ # do not run this on old baselayout where udev-addon gets loaded
+ if [ ! -f /etc/init.d/sysfs ]; then
+ eerror "The $SVCNAME init-script is written for baselayout-2!"
+ eerror "Please do not use it with baselayout-1!".
+ return 1
+ fi
+
+ check_openrc_net
+ _start
+
+ display_hotplugged_services
+
+ return 0
+}
+
+_start()
+{
+ if [ ! -e /etc/runlevels/${RC_DEFAULTLEVEL:-default}/udev-postmount ]; then
+ ewarn "You should add udev-postmount service to your default runlevel."
+ fi
+
+ root_link
+ rules_disable_switch 75-persistent-net-generator.rules "${persistent_net_disable:-no}"
+ rules_disable_switch 75-cd-aliases-generator.rules ${persistent_cd_disable:-no}
+
+ disable_hotplug_agent
+ start_udevd || cleanup
+ start_udevmonitor
+ populate_dev || cleanup
+
+ check_persistent_net
+
+ check_udev_works || cleanup
+ stop_udevmonitor
+
+ return 0
+}
+
+stop() {
+ ebegin "Stopping udevd"
+ start-stop-daemon --stop --exec /sbin/udevd
+ eend $?
+}
+
diff --git a/sys-fs/udev/files/udev-150-fix-missing-firmware-timeout.diff b/sys-fs/udev/files/udev-150-fix-missing-firmware-timeout.diff
new file mode 100644
index 0000000..7690f6b
--- /dev/null
+++ b/sys-fs/udev/files/udev-150-fix-missing-firmware-timeout.diff
@@ -0,0 +1,29 @@
+diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c
+index 8f70be4..16455de 100644
+--- a/extras/firmware/firmware.c
++++ b/extras/firmware/firmware.c
+@@ -149,6 +149,7 @@ int main(int argc, char **argv)
+
+ util_path_encode(firmware, fwencpath, sizeof(fwencpath));
+ util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.udev/firmware-missing/", fwencpath, NULL);
++ util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL);
+
+ if (fwfile == NULL) {
+ int err;
+@@ -166,6 +167,7 @@ int main(int argc, char **argv)
+ udev_selinux_resetfscreatecon(udev);
+ } while (err == -ENOENT);
+ rc = 2;
++ set_loading(udev, loadpath, "-1");
+ goto exit;
+ }
+
+@@ -176,7 +178,6 @@ int main(int argc, char **argv)
+ if (unlink(misspath) == 0)
+ util_delete_path(udev, misspath);
+
+- util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL);
+ set_loading(udev, loadpath, "1");
+
+ util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL);
+
diff --git a/sys-fs/udev/files/udev-151-readd-hd-rules.diff b/sys-fs/udev/files/udev-151-readd-hd-rules.diff
new file mode 100644
index 0000000..53e99b0
--- /dev/null
+++ b/sys-fs/udev/files/udev-151-readd-hd-rules.diff
@@ -0,0 +1,53 @@
+diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules
+index 132a680..a3e8e3c 100644
+--- a/extras/cdrom_id/60-cdrom_id.rules
++++ b/extras/cdrom_id/60-cdrom_id.rules
+@@ -2,4 +2,4 @@
+
+ # import optical drive properties
+ ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \
+- KERNEL=="sr[0-9]*|xvd*", IMPORT{program}="cdrom_id --export $tempnode"
++ KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]|xvd*", IMPORT{program}="cdrom_id --export $tempnode"
+diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
+index f8556d1..ba07079 100644
+--- a/rules/rules.d/50-udev-default.rules
++++ b/rules/rules.d/50-udev-default.rules
+@@ -77,9 +77,12 @@ SUBSYSTEM=="block", GROUP="disk"
+
+ # floppy
+ SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy"
++SUBSYSTEM=="block", KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0660 -G floppy $root/%k"
++KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions"
+
+ # cdrom
+ SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom"
++SUBSYSTEM=="block", KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="cdrom", GROUP="cdrom"
+ SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom"
+ KERNEL=="pktcdvd[0-9]*", GROUP="cdrom"
+ KERNEL=="pktcdvd", GROUP="cdrom"
+diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
+index 89041a9..6f12a9a 100644
+--- a/rules/rules.d/60-persistent-storage.rules
++++ b/rules/rules.d/60-persistent-storage.rules
+@@ -12,12 +12,21 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end"
+ # skip rules for inappropriate block devices
+ KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end"
+
++# never access non-cdrom removable ide devices, the drivers are causing event loops on open()
++KERNEL=="hd*[!0-9]", ATTR{removable}=="1", SUBSYSTEMS=="ide", ATTRS{media}=="disk|floppy", GOTO="persistent_storage_end"
++KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
++
+ # ignore partitions that span the entire disk
+ TEST=="whole_disk", GOTO="persistent_storage_end"
+
+ # for partitions import parent information
+ ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
+
++# by-id (hardware serial number)
++KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode"
++KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}"
++KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}-part%n"
++
+ # USB devices use their own serial number
+ KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
+ # ATA devices with their own "ata" kernel subsystem