Permalink
Browse files

udev-171: make it uclibc-frendly

Signed-off-by: Vladimir Smirnov <civil.over@gmail.com>
  • Loading branch information...
1 parent ed9ee63 commit baca1cfae401db2f0c9b539784068301377f3785 @Civil Civil committed Jan 22, 2012
Showing with 7,904 additions and 0 deletions.
  1. +103 −0 sys-fs/udev/Manifest
  2. +45 −0 sys-fs/udev/files/136/shell-compat-KV.sh
  3. +43 −0 sys-fs/udev/files/136/shell-compat-addon.sh
  4. +95 −0 sys-fs/udev/files/136/udev-dev-tarball.initd
  5. +107 −0 sys-fs/udev/files/136/udev-mount.initd
  6. +31 −0 sys-fs/udev/files/136/udev-postmount.initd
  7. +54 −0 sys-fs/udev/files/136/udev-start.sh
  8. +13 −0 sys-fs/udev/files/136/udev-stop.sh
  9. +56 −0 sys-fs/udev/files/136/udev.confd
  10. +246 −0 sys-fs/udev/files/136/udev.initd
  11. +45 −0 sys-fs/udev/files/147/shell-compat-KV.sh
  12. +71 −0 sys-fs/udev/files/147/shell-compat-addon.sh
  13. +95 −0 sys-fs/udev/files/147/udev-dev-tarball.initd
  14. +114 −0 sys-fs/udev/files/147/udev-mount.initd
  15. +35 −0 sys-fs/udev/files/147/udev-postmount.initd
  16. +55 −0 sys-fs/udev/files/147/udev-start.sh
  17. +13 −0 sys-fs/udev/files/147/udev-stop.sh
  18. +56 −0 sys-fs/udev/files/147/udev.confd
  19. +263 −0 sys-fs/udev/files/147/udev.initd
  20. +45 −0 sys-fs/udev/files/151-r4/shell-compat-KV.sh
  21. +71 −0 sys-fs/udev/files/151-r4/shell-compat-addon.sh
  22. +95 −0 sys-fs/udev/files/151-r4/udev-dev-tarball.initd
  23. +119 −0 sys-fs/udev/files/151-r4/udev-mount.initd
  24. +35 −0 sys-fs/udev/files/151-r4/udev-postmount.initd
  25. +55 −0 sys-fs/udev/files/151-r4/udev-start.sh
  26. +13 −0 sys-fs/udev/files/151-r4/udev-stop.sh
  27. +63 −0 sys-fs/udev/files/151-r4/udev.confd
  28. +273 −0 sys-fs/udev/files/151-r4/udev.initd
  29. +14 −0 sys-fs/udev/files/156/40-gentoo.rules
  30. +8 −0 sys-fs/udev/files/156/90-network.rules
  31. +45 −0 sys-fs/udev/files/156/shell-compat-KV.sh
  32. +71 −0 sys-fs/udev/files/156/shell-compat-addon.sh
  33. +95 −0 sys-fs/udev/files/156/udev-dev-tarball.initd
  34. +107 −0 sys-fs/udev/files/156/udev-mount.initd
  35. +37 −0 sys-fs/udev/files/156/udev-postmount.initd
  36. +55 −0 sys-fs/udev/files/156/udev-start.sh
  37. +13 −0 sys-fs/udev/files/156/udev-stop.sh
  38. +64 −0 sys-fs/udev/files/156/udev.confd
  39. +272 −0 sys-fs/udev/files/156/udev.initd
  40. +14 −0 sys-fs/udev/files/161/40-gentoo.rules
  41. +8 −0 sys-fs/udev/files/161/90-network.rules
  42. +45 −0 sys-fs/udev/files/161/shell-compat-KV.sh
  43. +71 −0 sys-fs/udev/files/161/shell-compat-addon.sh
  44. +95 −0 sys-fs/udev/files/161/udev-dev-tarball.initd
  45. +107 −0 sys-fs/udev/files/161/udev-mount.initd
  46. +37 −0 sys-fs/udev/files/161/udev-postmount.initd
  47. +55 −0 sys-fs/udev/files/161/udev-start.sh
  48. +13 −0 sys-fs/udev/files/161/udev-stop.sh
  49. +64 −0 sys-fs/udev/files/161/udev.confd
  50. +272 −0 sys-fs/udev/files/161/udev.initd
  51. +14 −0 sys-fs/udev/files/164/40-gentoo.rules
  52. +8 −0 sys-fs/udev/files/164/90-network.rules
  53. +45 −0 sys-fs/udev/files/164/shell-compat-KV.sh
  54. +71 −0 sys-fs/udev/files/164/shell-compat-addon.sh
  55. +95 −0 sys-fs/udev/files/164/udev-dev-tarball.initd
  56. +107 −0 sys-fs/udev/files/164/udev-mount.initd
  57. +53 −0 sys-fs/udev/files/164/udev-postmount.initd
  58. +55 −0 sys-fs/udev/files/164/udev-start.sh
  59. +13 −0 sys-fs/udev/files/164/udev-stop.sh
  60. +64 −0 sys-fs/udev/files/164/udev.confd
  61. +272 −0 sys-fs/udev/files/164/udev.initd
  62. +26 −0 sys-fs/udev/files/blacklist-110
  63. +29 −0 sys-fs/udev/files/blacklist-146
  64. +93 −0 sys-fs/udev/files/modprobe-114.sh
  65. +102 −0 sys-fs/udev/files/modprobe-115.sh
  66. +25 −0 sys-fs/udev/files/move_tmp_persistent_rules-112-r1.sh
  67. +28 −0 sys-fs/udev/files/net-104-r10.sh
  68. +34 −0 sys-fs/udev/files/net-118-r1.sh
  69. +34 −0 sys-fs/udev/files/net-130-r1.sh
  70. +17 −0 sys-fs/udev/files/pnp-aliases
  71. +57 −0 sys-fs/udev/files/shell-compat-118-r2.sh
  72. +75 −0 sys-fs/udev/files/shell-compat-118-r3.sh
  73. +47 −0 sys-fs/udev/files/shell-compat-KV.sh
  74. +148 −0 sys-fs/udev/files/udev-110-root-link-1.diff
  75. +164 −0 sys-fs/udev/files/udev-114-root-link-2.diff
  76. +13 −0 sys-fs/udev/files/udev-122-rules-update.diff
  77. +27 −0 sys-fs/udev/files/udev-124-cdrom-autoclose-bug.diff
  78. +13 −0 sys-fs/udev/files/udev-124-encoding-overflow.patch
  79. +39 −0 sys-fs/udev/files/udev-124-netlink-owner-check.patch
  80. +16 −0 sys-fs/udev/files/udev-141-remove-devfs-names.diff
  81. +29 −0 sys-fs/udev/files/udev-150-fix-missing-firmware-timeout.diff
  82. +53 −0 sys-fs/udev/files/udev-151-readd-hd-rules.diff
  83. +47 −0 sys-fs/udev/files/udev-164-remove-v4l1.patch
  84. +32 −0 sys-fs/udev/files/udev-167-revert-disable-all-extras.patch
  85. +159 −0 sys-fs/udev/files/udev-171-uclibc.patch
  86. +94 −0 sys-fs/udev/files/udev-175-zlib.patch
  87. +23 −0 sys-fs/udev/files/udev-postmount-initd-111-r2
  88. +247 −0 sys-fs/udev/files/udev-start-113-r2.sh
  89. +234 −0 sys-fs/udev/files/udev-start-114-r1.sh
  90. +203 −0 sys-fs/udev/files/udev-start-118-r2.sh
  91. +239 −0 sys-fs/udev/files/udev-start-122-r1.sh
  92. +80 −0 sys-fs/udev/files/udev-stop-111-r2.sh
  93. +71 −0 sys-fs/udev/files/udev-stop-118-r2.sh
  94. +28 −0 sys-fs/udev/files/udev.conf.post_113
  95. +11 −0 sys-fs/udev/files/udev.conf.post_114
  96. +8 −0 sys-fs/udev/files/udev.confd
  97. +59 −0 sys-fs/udev/files/udev.initd
  98. +29 −0 sys-fs/udev/files/write_root_link_rule
  99. +29 −0 sys-fs/udev/files/write_root_link_rule-125
  100. +574 −0 sys-fs/udev/udev-171-r5.ebuild
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -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
+
@@ -0,0 +1,43 @@
+# 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
+if ! cmd_exist fstabinfo; then
+ fstabinfo() {
+ [ "$1" = "--quiet" ] && shift
+ local dir="$1"
+
+ # only check RC_USE_FSTAB on baselayout-1
+ yesno "${RC_USE_FSTAB}" || return 1
+
+ # check if entry is in /etc/fstab
+ local ret=$(gawk 'BEGIN { found="false"; }
+ $1 ~ "^#" { next }
+ $2 == "'$dir'" { found="true"; }
+ END { print found; }
+ ' /etc/fstab)
+
+ "${ret}"
+ }
+fi
+
+
@@ -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}"
+}
+
@@ -0,0 +1,107 @@
+#!/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()
+{
+ # No options are processed here as they should all be in /etc/fstab
+ ebegin "Mounting /dev"
+ if fstabinfo --quiet /dev; then
+ mount -n /dev
+ else
+ # Some devices require exec, Bug #92921
+ mount -n -t tmpfs -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
+
+ # 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
+ 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
+ restorecon /dev > /selinux/null
+ fi
+
+ # make sure it exists
+ mkdir -p /dev/.udev
+
+ seed_dev
+
+ return 0
+}
@@ -0,0 +1,31 @@
+#!/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/136/udev-postmount.initd,v 1.3 2009/02/23 16:30:53 zzam Exp $
+
+depend() {
+ need localmount
+}
+
+dir_writeable()
+{
+ mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
+}
+
+start() {
+ # check if this system uses udev
+ [ -d /dev/.udev/ ] || return 0
+
+ # 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
@@ -0,0 +1,54 @@
+# 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
+ )
+}
+
+# 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
+
+# inject into boot runlevel
+IN_HOTPLUG=1 /etc/init.d/udev-postmount start >/dev/null 2>&1
+
+# udev started successfully
+exit 0
@@ -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
Oops, something went wrong.

0 comments on commit baca1cf

Please sign in to comment.